spateo.get_version ================== .. py:module:: spateo.get_version .. autoapi-nested-parse:: 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. Attributes ---------- .. autoapisummary:: spateo.get_version.RE_VERSION spateo.get_version.RE_GIT_DESCRIBE spateo.get_version.ON_RTD spateo.get_version.__version__ Classes ------- .. autoapisummary:: spateo.get_version.Version Functions --------- .. autoapisummary:: spateo.get_version.match_groups spateo.get_version.get_version_from_dirname spateo.get_version.get_version_from_git spateo.get_version.get_version_from_metadata spateo.get_version.get_version spateo.get_version.get_all_dependencies_version Module Contents --------------- .. py:data:: RE_VERSION :value: '([\\d.]+?)(?:\\.dev(\\d+))?(?:[_+-]([0-9a-zA-Z.]+))?' .. py:data:: RE_GIT_DESCRIBE :value: 'v?(?:([\\d.]+)-(\\d+)-g)?([0-9a-f]{7})(-dirty)?' .. py:data:: ON_RTD .. py:function:: match_groups(regex, target) .. py:class:: Version Bases: :py:obj:`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)]) .. py:attribute:: release :type: str .. py:attribute:: dev :type: Optional[str] .. py:attribute:: labels :type: List[str] .. py:method:: parse(ver) :staticmethod: .. py:method:: __str__() .. py:function:: get_version_from_dirname(name, parent) Extracted sdist .. py:function:: get_version_from_git(parent) .. py:function:: get_version_from_metadata(name: str, parent: Optional[pathlib.Path] = None) .. py:function:: get_version(package: Union[pathlib.Path, str]) -> str 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 of ``git describe`` #. The package metadata of an installed package (This is the only possibility when passing a name) :param package: package name or module path (``…/module.py`` or ``…/module/__init__.py``) .. py:function:: get_all_dependencies_version(display=True) Adapted from answer 2 in https://stackoverflow.com/questions/40428931/package-for-listing-version-of-packages-used-in-a-jupyter-notebook .. py:data:: __version__ :value: ''