{"id":18084893,"url":"https://github.com/jwodder/versioningit","last_synced_at":"2025-05-16T13:03:02.524Z","repository":{"id":37989787,"uuid":"383288220","full_name":"jwodder/versioningit","owner":"jwodder","description":"Versioning It with your Version In Git","archived":false,"fork":false,"pushed_at":"2025-05-09T16:21:57.000Z","size":899,"stargazers_count":88,"open_issues_count":15,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-09T17:29:12.625Z","etag":null,"topics":["available-on-pypi","git","hatch","mercurial","packaging","python","setuptools","vcs","version","versioningit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwodder.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-07-05T23:40:33.000Z","updated_at":"2025-05-03T05:56:57.000Z","dependencies_parsed_at":"2023-09-25T23:39:15.212Z","dependency_job_id":"a9c640bd-514f-4b13-95c8-195c68a428d1","html_url":"https://github.com/jwodder/versioningit","commit_stats":{"total_commits":329,"total_committers":5,"mean_commits":65.8,"dds":"0.033434650455927084","last_synced_commit":"b94aac6443139942fad2553b8393d4164aef1d70"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Fversioningit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Fversioningit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Fversioningit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwodder%2Fversioningit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwodder","download_url":"https://codeload.github.com/jwodder/versioningit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253753019,"owners_count":21958829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["available-on-pypi","git","hatch","mercurial","packaging","python","setuptools","vcs","version","versioningit"],"created_at":"2024-10-31T15:08:33.108Z","updated_at":"2025-05-16T13:03:02.499Z","avatar_url":"https://github.com/jwodder.png","language":"Python","readme":"|repostatus| |ci-status| |coverage| |pyversions| |conda| |license|\n\n.. |repostatus| image:: https://www.repostatus.org/badges/latest/active.svg\n    :target: https://www.repostatus.org/#active\n    :alt: Project Status: Active — The project has reached a stable, usable\n          state and is being actively developed.\n\n.. |ci-status| image:: https://github.com/jwodder/versioningit/actions/workflows/test.yml/badge.svg\n    :target: https://github.com/jwodder/versioningit/actions/workflows/test.yml\n    :alt: CI Status\n\n.. |coverage| image:: https://codecov.io/gh/jwodder/versioningit/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/jwodder/versioningit\n\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/versioningit.svg\n    :target: https://pypi.org/project/versioningit/\n\n.. |conda| image:: https://img.shields.io/conda/vn/conda-forge/versioningit.svg\n    :target: https://anaconda.org/conda-forge/versioningit\n    :alt: Conda Version\n\n.. |license| image:: https://img.shields.io/github/license/jwodder/versioningit.svg\n    :target: https://opensource.org/licenses/MIT\n    :alt: MIT License\n\n`GitHub \u003chttps://github.com/jwodder/versioningit\u003e`_\n| `PyPI \u003chttps://pypi.org/project/versioningit/\u003e`_\n| `Documentation \u003chttps://versioningit.readthedocs.io\u003e`_\n| `Issues \u003chttps://github.com/jwodder/versioningit/issues\u003e`_\n| `Changelog \u003chttps://github.com/jwodder/versioningit/blob/master/CHANGELOG.md\u003e`_\n\n``versioningit`` — *Versioning It with your Version In Git*\n\n``versioningit`` is yet another Python packaging plugin for automatically\ndetermining your package's version based on your version control repository's\ntags.  Unlike others, it allows easy customization of the version format and\neven lets you easily override the separate functions used for version\nextraction \u0026 calculation.\n\n**Features:**\n\n- Works with both setuptools and Hatch_\n\n  .. _hatch: https://hatch.pypa.io\n\n- Installed \u0026 configured through :pep:`518`'s ``pyproject.toml``\n\n- Supports Git, modern Git archives, and Mercurial\n\n- Formatting of the final version uses format template strings, with fields for\n  basic VCS information and separate template strings for distanced vs. dirty\n  vs. distanced-and-dirty repository states\n\n- Can optionally write the final version and other details to a file for\n  loading at runtime\n\n- Provides custom hooks for inserting the final version and other details into\n  a source file at build time\n\n- The individual methods for VCS querying, tag-to-version calculation, version\n  bumping, version formatting, and writing the version to a file can all be\n  customized using either functions defined alongside one's project code or via\n  publicly-distributed entry points\n\n- Can alternatively be used as a library for use in ``setup.py`` or the like,\n  in case you don't want to or can't configure it via ``pyproject.toml``\n\n- The only thing it does is calculate your version and optionally write it to a\n  file; there's no overriding of your sdist contents based on what's in your\n  Git repository, especially not without a way to turn it off, because that\n  would just be rude.\n\n\nInstallation \u0026 Setup\n====================\n``versioningit`` requires Python 3.8 or higher.  Just use `pip\n\u003chttps://pip.pypa.io\u003e`_ for Python 3 (You have pip, right?) to install\n``versioningit`` and its dependencies::\n\n    python3 -m pip install versioningit\n\nHowever, usually you won't need to install ``versioningit`` in your environment\ndirectly.  Instead, you specify it in your project's ``pyproject.toml`` file in\nthe ``build-system.requires`` key, like so:\n\n.. code:: toml\n\n    # If using Setuptools:\n    [build-system]\n    requires = [\n        \"setuptools\",\n        \"versioningit\",\n    ]\n    build-backend = \"setuptools.build_meta\"\n\n    # If using Hatch:\n    [build-system]\n    requires = [\n        \"hatchling\",\n        \"versioningit\",\n    ]\n    build-backend = \"hatchling.build\"\n\n    # This setting is also required if you're using Hatch:\n    [tool.hatch.version]\n    source = \"versioningit\"\n\nThen, you configure ``versioningit`` by adding a ``[tool.versioningit]`` table\nto your ``pyproject.toml``.  See `the documentation`__ for details, but you\ncan get up \u0026 running with just the minimal configuration, an empty table:\n\n__ https://versioningit.readthedocs.io/en/stable/configuration.html\n\n.. code:: toml\n\n    [tool.versioningit]\n\n``versioningit`` eliminates the need to list an explicit version in\n``setup.py``, ``setup.cfg``, or ``pyproject.toml`` (and any explicit version\nyou do list will be ignored when using ``versioningit``), so you should remove\nany such settings in order to reduce confusion.\n\n**Note:** If you're specifying your project metadata via a ``[project]`` table\nin ``pyproject.toml``, you need to set ``project.dynamic = [\"version\"]`` in\norder for ``versioningit`` to work.\n\nOnce you have a ``[tool.versioningit]`` table in your ``pyproject.toml`` — and\nonce your repository has at least one tag — building your project with build_\nor similar will result in your project's version automatically being set based\non the latest tag in your Git repository.  You can test your configuration and\nsee what the resulting version will be using the ``versioningit`` command (`see\nthe documentation`__).\n\n.. _build: https://github.com/pypa/build\n\n__ https://versioningit.readthedocs.io/en/stable/command.html\n\n\nExample Configurations\n======================\n\nOne of ``versioningit``'s biggest strengths is its ability to configure the\nversion format using placeholder strings.  The default format configuration\nlooks like this:\n\n.. code:: toml\n\n    [tool.versioningit.format]\n    # Format used when there have been commits since the most recent tag:\n    distance = \"{base_version}.post{distance}+{vcs}{rev}\"\n    # Example formatted version: 1.2.3.post42+ge174a1f\n\n    # Format used when there are uncommitted changes:\n    dirty = \"{base_version}+d{build_date:%Y%m%d}\"\n    # Example formatted version: 1.2.3+d20230922\n\n    # Format used when there are both commits and uncommitted changes:\n    distance-dirty = \"{base_version}.post{distance}+{vcs}{rev}.d{build_date:%Y%m%d}\"\n    # Example formatted version: 1.2.3.post42+ge174a1f.d20230922\n\nOther format configurations of interest include:\n\n- The default format used by setuptools_scm_:\n\n  .. code:: toml\n\n      [tool.versioningit.next-version]\n      method = \"smallest\"\n\n      [tool.versioningit.format]\n      distance = \"{next_version}.dev{distance}+{vcs}{rev}\"\n      # Example formatted version: 1.2.4.dev42+ge174a1f\n\n      dirty = \"{base_version}+d{build_date:%Y%m%d}\"\n      # Example formatted version: 1.2.3+d20230922\n\n      distance-dirty = \"{next_version}.dev{distance}+{vcs}{rev}.d{build_date:%Y%m%d}\"\n      # Example formatted version: 1.2.4.dev42+ge174a1f.d20230922\n\n- The format used by versioneer_:\n\n  .. code:: toml\n\n      [tool.versioningit.format]\n      distance = \"{base_version}+{distance}.{vcs}{rev}\"\n      # Example formatted version: 1.2.3+42.ge174a1f\n\n      dirty = \"{base_version}+{distance}.{vcs}{rev}.dirty\"\n      # Example formatted version: 1.2.3+42.ge174a1f.dirty\n\n      distance-dirty = \"{base_version}+{distance}.{vcs}{rev}.dirty\"\n      # Example formatted version: 1.2.3+42.ge174a1f.dirty\n\n- The format used by vcversioner_:\n\n  .. code:: toml\n\n      [tool.versioningit.format]\n      distance = \"{base_version}.post{distance}\"\n      # Example formatted version: 1.2.3.post42\n\n      dirty = \"{base_version}\"\n      # Example formatted version: 1.2.3\n\n      distance-dirty = \"{base_version}.post{distance}\"\n      # Example formatted version: 1.2.3.post42\n\n.. _setuptools_scm: https://github.com/pypa/setuptools_scm\n.. _versioneer: https://github.com/python-versioneer/python-versioneer\n.. _vcversioner: https://github.com/habnabit/vcversioner\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwodder%2Fversioningit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwodder%2Fversioningit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwodder%2Fversioningit/lists"}