Get SCM version¶
Get semantic version from scm and write version file
Limit to setuptools-scm codebase. Is exactly equivalent to generic
setuptools-scm setup.py
- drain_swamp.monkey.wrap_get_version.log: logging.Logger¶
Module level logger
- drain_swamp.monkey.wrap_get_version.__all__: tuple[str, str, str] = ("scm_version", "write_to_file", "SEM_VERSION_FALLBACK_SANE")¶
- drain_swamp.monkey.wrap_get_version.scm_version(relative_to, sane_default='0.0.1')¶
Get the scm version from git or Mercurial
Does not write to the version_file
- drain_swamp.monkey.wrap_get_version.write_to_file(name: str, str_ver: str, write_to: str | None = None, dist_name: str | None = None, is_only_not_exists: bool | None = False) None ¶
Write version_file
read_pyproject default is to combine sections: [tool.drain_swamp] and [tool.pipenv-unlock]
Does not read section [tool-setuptools-scm]
- Parameters:
name¶ (str) – absolute path to a file on the repo base folder
write_to¶ (str | None) – Default None. override version_file. Used for testing
dist_name¶ (str | None) – Default None. pyproject.toml section [tool.[name]] Unspecified –> pipenv-unlock
is_only_not_exists¶ (bool | None) – Default False. Write file only if it does not already exit
- Raises:
LookupError
– Either pyproject.toml missing or required missing sectionsValueError
– Semantic version str invalid. Write to version file skipped