package documentation

Versions for Python packages.

See Version.

Package tests No package docstring; 3/3 modules documented
Module update No module docstring; 0/2 constant, 2/4 functions documented
Module _hatch Undocumented
Module _version Provides Incremental version information.

From __init__.py:

Class Version An encapsulation of a version for a project, with support for outputting PEP-440 compatible version strings.
Exception IncomparableVersions Two versions could not be compared.
Function getVersionString Get a friendly string for the given version object.
Class _IncrementalConfig Configuration loaded from a ``pyproject.toml`` file.
Class _Inf An object that is bigger than all other objects.
Function _cmp Compare two objects.
Function _existing_version Load the current version from a ``_version.py`` file.
Function _extract_tool_incremental Undocumented
Function _findPath Determine the package root directory.
Function _get_distutils_version Distutils integration: get the version from the package listed in the Distribution.
Function _get_setuptools_version Setuptools integration: load the version from the working directory
Function _load_pyproject_toml Load Incremental configuration from a ``pyproject.toml``
Function _load_toml Read the content of a TOML file.
Function _setuptools_version Undocumented
Variable _inf Undocumented
def getVersionString(version: Version) -> str:

Get a friendly string for the given version object.

Parameters
version:VersionA Version object.
Returns
strA string containing the package and short version number.
def _cmp(a: Any, b: Any) -> int:

Compare two objects.

Returns a negative number if a < b, zero if they are equal, and a positive number if a > b.

def _existing_version(version_path: str) -> Version:

Load the current version from a ``_version.py`` file.

def _extract_tool_incremental(data: dict[str, object]) -> dict[str, object] | None:

Undocumented

def _findPath(path: str, package: str) -> str:

Determine the package root directory.

The result is one of:

  • src/{package}
  • {package}

Where {package} is downcased.

def _get_distutils_version(dist: _Distribution, keyword: object, value: object):

Distutils integration: get the version from the package listed in the Distribution.

This function is invoked when a setup.py calls setup(use_incremental=True).

See Also
https://setuptools.pypa.io/en/latest/userguide/extension.html#adding-arguments
def _get_setuptools_version(dist: _Distribution):

Setuptools integration: load the version from the working directory

This function is registered as a setuptools.finalize_distribution_options entry point [1]. Consequently, it is called in all sorts of weird contexts. In setuptools, silent failure is the law.

[1]: https://setuptools.pypa.io/en/latest/userguide/extension.html#customizing-distribution-options

Parameters
dist:_DistributionA (possibly) empty setuptools.Distribution instance to mutate. There may be some metadata here if a `setup.py` called `setup()`, but this hook is always called before setuptools loads anything from ``pyproject.toml``.
def _load_pyproject_toml(toml_path: str) -> _IncrementalConfig:

Load Incremental configuration from a ``pyproject.toml``

If the [tool.incremental] section is empty we take the project name from the [project] section. Otherwise we require only a name key specifying the project name. Other keys are forbidden to allow future extension and catch typos.

Parameters
toml_path:strPath to the ``pyproject.toml`` to load.
Returns
_IncrementalConfigUndocumented
def _load_toml(f: BinaryIO) -> Any:

Read the content of a TOML file.

def _setuptools_version() -> str:

Undocumented

_inf =

Undocumented