Versioneer automates version string generation for Python packages based on their Git, Mercurial, or SVN tags. It works by embedding version-calculating code directly into your project's source tree, making your package self-sufficient for versioning even in sdist archives. It currently supports Python 3.7+ and is at version 0.29, with active development and releases tied to new Python versions and build system changes.
pip install versioneerVerified import paths — ran on the pinned version, not inferred.
This quickstart outlines the steps to integrate Versioneer into a new or existing Python project. It involves installing the Versioneer command-line tool, initializing it within your project (which generates `versioneer.py` and `_version.py`), configuring `pyproject.toml` for modern build systems, and optionally exposing the version via your package's `__init__.py`. Finally, commit the changes and tag a release in your version control system for Versioneer to detect the initial version.
Upgrade to Python 3.7+ and ensure your build system uses `setuptools` instead of `distutils`. If stuck on older Python, pin `versioneer<0.23`.
Always run `versioneer install` in your project's root directory and commit the generated `versioneer.py` and `_version.py` files to your version control system.
Ensure all changes are committed and your latest release is tagged. Use `git status` to verify a clean working tree before building release artifacts. Follow the recommended tag prefix (e.g., `v`) configured in `tool.versioneer.tag_prefix`.
Review the Unlicense terms and ensure it aligns with your project's licensing requirements. No code changes are required for this license update.
Carefully follow the `pyproject.toml` configuration examples in the official documentation, ensuring `build-system.requires` includes `versioneer[toml]`, `project.dynamic = ['version']`, and `tool.versioneer` paths like `versionfile_source` and `versionfile_build` match your project structure.
Run `versioneer install` in your project root, then ensure `versioneer.py` and `_version.py` are present and committed. If using `setup.py`, ensure `versioneer.py` is in the same directory or accessible on the Python path.
Ensure `versioneer install` has been run recently to get the latest `versioneer.py` and `_version.py`. Verify that your `setup.py` (if used) correctly calls `versioneer.get_version()` and `versioneer.get_cmdclass()`.
Initialize your project as a Git repository (`git init`), make an initial commit, and tag at least one release (`git tag v0.1.0`). Ensure Git is installed and in your system's PATH.
Carefully review your `pyproject.toml` against the official Versioneer documentation for correct syntax and required `build-system` and `tool.versioneer` sections. Use a TOML linter to check for syntax errors.
Ensure `versioneer install` was run and `_version.py` contains valid version-determining logic. Check if your SCM repository is clean and has tags for Versioneer to use. You might also want to add fallback logic for `__version__` in `__init__.py` for robustness.
No resource links recorded.