spateo.get_version
#
A minimalistic version helper in the spirit of versioneer, that is able to run without build step using pkg_resources. Developed by P Angerer, see https://github.com/flying-sheep/get_version.
Module Contents#
Classes#
Typed version of namedtuple. |
Functions#
|
|
|
Extracted sdist |
|
|
|
|
|
Get the version of a package or module |
|
Adapted from answer 2 in |
Attributes#
- class spateo.get_version.Version[source]#
Bases:
NamedTuple
Typed version of namedtuple.
Usage in Python versions >= 3.6:
class Employee(NamedTuple): name: str id: int
This is equivalent to:
Employee = collections.namedtuple('Employee', ['name', 'id'])
The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:
Employee = NamedTuple('Employee', name=str, id=int)
In Python versions <= 3.5 use:
Employee = NamedTuple('Employee', [('name', str), ('id', int)])
- spateo.get_version.get_version_from_metadata(name: str, parent: pathlib.Path | None = None)[source]#
- spateo.get_version.get_version(package: pathlib.Path | str) str [source]#
Get the version of a package or module Pass a module path or package name. The former is recommended, since it also works for not yet installed packages. Supports getting the version from #. The directory name (as created by
setup.py sdist
) #. The output ofgit describe
#. The package metadata of an installed package(This is the only possibility when passing a name)
- Parameters:
- package
package name or module path (
…/module.py
or…/module/__init__.py
)
- spateo.get_version.get_all_dependencies_version(display=True)[source]#
Adapted from answer 2 in https://stackoverflow.com/questions/40428931/package-for-listing-version-of-packages-used-in-a-jupyter-notebook