# hatch-semver
A plugin for [hatch][hatch] to support [semantic versioning][semver]. Hatch-semver relies on [python-semver][python-semver] for all the versioning logic.
## Setup
Introduce hatch-semver as a build-dependency to your project (in your `pyproject.toml`):
```toml
[build-system]
requires = [
"hatchling",
"hatch-semver",
]
build-backend = "hatchling.build"
```
Further down in `pyproject.toml`,
where you set up the *hatch version* command,
set version scheme to `semver`:
```toml
[tool.hatch.version]
path = "src/<your_project>/__about__.py"
validate-bump = true
scheme = "semver"
```
### Beware
Hatch-semver plugin will only work with project versions which can be readily parsed by [python-semver][python-semver].
Therefore, if you are introducing hatch-semver into an existing project, you must **make sure that the project's current version is a valid semantic version.**
You can test that [here][semver-regex].
## Quick Start
Many of hatch's [standard versioning][hatch_versioning] commands also work for hatch-semver to bump your project's version in a semver-compliant way.
Such command is written as a single string of comma-separated bump instructions as a positional argument of the `hatch version` subcommand, i.e `hatch version <COMMAND>`.
Starting with `0.1.0` as the original version, here is a series of example commands which illustrate some common ways how to bump the version:
| Old Version | Command | New Version |
| ---------------------- | ------------------- | -------------------- |
| `0.1.0` | `patch` | `0.1.1` |
| `0.1.1` | `minor,patch,patch` | `0.2.2` |
| `0.2.2` | `minor` | `0.3.0` |
| `0.3.0` | `rc` | `0.3.1-rc.1` |
| `0.3.1-rc.1` | `rc` | `0.3.1-rc.2` |
| `0.3.1-rc.2` | `release` | `0.3.1` |
| `0.3.1` | `0.9.5` | `0.9.5` |
| `0.9.5` | `major,rc` | `1.0.0-rc.1` |
| `1.0.0-rc.1` | `release` | `1.0.0` |
See the [command reference][commands] for all the commands in full detail. If you are familiar with hatch's standard versioning scheme, perhaps a [comparison][comparison] of the standard scheme and hatch-semver will be of interest.
[hatch]: https://hatch.pypa.io/
[hatch_versioning]: https://hatch.pypa.io/latest/version/#updating
[python-semver]: https://github.com/python-semver/python-semver/tree/maint/v2
[semver-regex]: https://regex101.com/r/Ly7O1x/3/
[semver]: https://semver.org/
[commands]: https://fleetingbytes.github.io/hatch-semver/user_guide/1-commands/
[comparison]: https://fleetingbytes.github.io/hatch-semver/user_guide/2-migrating-to-semver/
Raw data
{
"_id": null,
"home_page": null,
"name": "hatch-semver",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "development,hatch,plugin,version,versioning",
"author": null,
"author_email": "Sven Siegmund <sven.siegmund@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/6d/e9/ebd2948509aad51fe99419293efc31246b6af3d0c488964f653b2c090ff1/hatch_semver-2.0.2.tar.gz",
"platform": null,
"description": "# hatch-semver\n\nA plugin for [hatch][hatch] to support [semantic versioning][semver]. Hatch-semver relies on [python-semver][python-semver] for all the versioning logic.\n\n## Setup\n\nIntroduce hatch-semver as a build-dependency to your project (in your `pyproject.toml`):\n\n```toml\n[build-system]\nrequires = [\n \"hatchling\",\n \"hatch-semver\",\n]\nbuild-backend = \"hatchling.build\"\n```\n\nFurther down in `pyproject.toml`, \nwhere you set up the *hatch version* command, \nset version scheme to `semver`:\n```toml\n[tool.hatch.version]\npath = \"src/<your_project>/__about__.py\"\nvalidate-bump = true\nscheme = \"semver\"\n```\n\n### Beware\n\nHatch-semver plugin will only work with project versions which can be readily parsed by [python-semver][python-semver].\nTherefore, if you are introducing hatch-semver into an existing project, you must **make sure that the project's current version is a valid semantic version.**\nYou can test that [here][semver-regex].\n\n## Quick Start\n\nMany of hatch's [standard versioning][hatch_versioning] commands also work for hatch-semver to bump your project's version in a semver-compliant way. \nSuch command is written as a single string of comma-separated bump instructions as a positional argument of the `hatch version` subcommand, i.e `hatch version <COMMAND>`.\n\nStarting with `0.1.0` as the original version, here is a series of example commands which illustrate some common ways how to bump the version:\n\n| Old Version | Command | New Version |\n| ---------------------- | ------------------- | -------------------- |\n| `0.1.0` | `patch` | `0.1.1` |\n| `0.1.1` | `minor,patch,patch` | `0.2.2` |\n| `0.2.2` | `minor` | `0.3.0` |\n| `0.3.0` | `rc` | `0.3.1-rc.1` |\n| `0.3.1-rc.1` | `rc` | `0.3.1-rc.2` |\n| `0.3.1-rc.2` | `release` | `0.3.1` |\n| `0.3.1` | `0.9.5` | `0.9.5` |\n| `0.9.5` | `major,rc` | `1.0.0-rc.1` |\n| `1.0.0-rc.1` | `release` | `1.0.0` |\n\nSee the [command reference][commands] for all the commands in full detail. If you are familiar with hatch's standard versioning scheme, perhaps a [comparison][comparison] of the standard scheme and hatch-semver will be of interest.\n\n\n[hatch]: https://hatch.pypa.io/\n[hatch_versioning]: https://hatch.pypa.io/latest/version/#updating\n[python-semver]: https://github.com/python-semver/python-semver/tree/maint/v2\n[semver-regex]: https://regex101.com/r/Ly7O1x/3/\n[semver]: https://semver.org/\n[commands]: https://fleetingbytes.github.io/hatch-semver/user_guide/1-commands/\n[comparison]: https://fleetingbytes.github.io/hatch-semver/user_guide/2-migrating-to-semver/\n",
"bugtrack_url": null,
"license": null,
"summary": "Hatch plugin for semver versioning scheme",
"version": "2.0.2",
"project_urls": {
"Homepage": "https://fleetingbytes.github.io/hatch-semver/",
"Issues": "https://github.com/fleetingbytes/hatch-semver/issues",
"PyPI": "https://pypi.org/project/hatch-semver/",
"Repository": "https://github.com/fleetingbytes/hatch-semver"
},
"split_keywords": [
"development",
"hatch",
"plugin",
"version",
"versioning"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "b3684d1c29a989d3a692cebc4a85f875aac7cd0d6c25adbc760222008509333c",
"md5": "c9d8ebe21244cccd97d9e89a9d3ed9ba",
"sha256": "1ad36f9e0b7148267ed55bf4e5855ad947e700ec4316e54b94cae26fbb89aa81"
},
"downloads": -1,
"filename": "hatch_semver-2.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c9d8ebe21244cccd97d9e89a9d3ed9ba",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8973,
"upload_time": "2024-02-17T02:20:53",
"upload_time_iso_8601": "2024-02-17T02:20:53.140617Z",
"url": "https://files.pythonhosted.org/packages/b3/68/4d1c29a989d3a692cebc4a85f875aac7cd0d6c25adbc760222008509333c/hatch_semver-2.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6de9ebd2948509aad51fe99419293efc31246b6af3d0c488964f653b2c090ff1",
"md5": "fd8444416a4ad9c41ce18872504e2be3",
"sha256": "3c59c8c1eb30de1e961610d33a375746c658607fa49414081a6940f6b8466fae"
},
"downloads": -1,
"filename": "hatch_semver-2.0.2.tar.gz",
"has_sig": false,
"md5_digest": "fd8444416a4ad9c41ce18872504e2be3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 20169,
"upload_time": "2024-02-17T02:20:55",
"upload_time_iso_8601": "2024-02-17T02:20:55.070580Z",
"url": "https://files.pythonhosted.org/packages/6d/e9/ebd2948509aad51fe99419293efc31246b6af3d0c488964f653b2c090ff1/hatch_semver-2.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-17 02:20:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fleetingbytes",
"github_project": "hatch-semver",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "hatch-semver"
}