hatch-vcs-tunable


Namehatch-vcs-tunable JSON
Version 0.0.0.dev0 PyPI version JSON
download
home_page
SummaryDefine your package's version from vcs refs, with build-time tuning of which tags to use.
upload_time2024-02-26 18:59:09
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords git hatch mercurial plugin version
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # hatch-vcs-tunable

[![PyPI - Version](https://img.shields.io/pypi/v/hatch-git-version-tunable.svg)](https://pypi.org/project/hatch-vcs-tunable)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-git-version-tunable.svg)](https://pypi.org/project/hatch-vcs-tunable)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)


-----

This is a plugin for [Hatch](https://github.com/pypa/hatch) that extends the plugin [hatch-vcs](https://github.com/ofek/hatch-vcs) to allow for overriding some config elements with environment variables.

The reason you might want to do this is if you have multiple release tracks for your package, or multiple contexts in which it is used, and want to give it different versions in those different contexts.

**Table of Contents**

- [Use as a plugin](#plugin)
- [Configuration](#Configuration)
- [License](#license)

## Plugin

Ensure `hatch-vcs-tunable` is listed in the `build-system.requires` field in your `pyproject.toml`:

```toml
[build-system]
requires = ["hatchling", "hatch-vcs-tunable"]
build-backend = "hatchling.build"
```

## Configuration

`hatch-vcs-tunable` can be configured either through `pyproject.toml`, using exactly the same configuration elements as `hatch-vcs` but with the plugin name `vcs-tunable`, or via environment variable overrides.

### `pyproject.toml`

Use the same configuration elements as `hatch-vcs`, but the plugin name `vcs-tunable`. For instance, to set the version file you would do:

``` toml
[tool.hatch.build.hooks.vcs-tunable]
version-file="_version.py"
```

### Environment

The environment variables should be specified as `ALL_CAPS_UNDERSCORE` versions of the pyproject settings, prefixed with `HATCH_VCS_TUNABLE_`. So for instance,
- `tag-pattern` can be specified as `HATCH_VCS_TUNABLE_TAG_PATTERN`
- `fallback-version` can be specified as `HATCH_VCS_TUNABLE_FALLBACK_VERSION`

#### `raw-options`

The value of the `raw-options` is passed directly to `setuptools_scm`. It may have multiple keyword arguments, which need both a name and a value, and the keywords may not be safe to put in the names of environment variables, so both the names and values are passed in the environment variable value. These should be passed as a string of `key-name=value` separated by `;`. For instance, to specify both `relative_to=..` and `version_file=/some/path`, you would do `HATCH_VCS_TUNABLE_RAW_OPTIONS="relative_to=..;version_file=/some/path"`.

If a setting is specified both in the environment and in `pyproject.toml`, the environment variable will take priority.

Environment variables that are specified as empty still exist, so if you do `HATCH_VCS_TUNABLE_FALLBACK_VERSION=  hatch build`, the fallback version will be the empty string. If you have one of these environment variables defined all the time and need to remove it, use `unset`.


## License

`hatch-git-version-tunable` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "hatch-vcs-tunable",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "git,hatch,mercurial,plugin,version",
    "author": "",
    "author_email": "Opentrons Engineering <engineering@opentrons.com>",
    "download_url": "https://files.pythonhosted.org/packages/2b/1a/01802069d7a5afc1480a6b5536721bb1d92c723e1673e2d7de03261f098e/hatch_vcs_tunable-0.0.0.dev0.tar.gz",
    "platform": null,
    "description": "# hatch-vcs-tunable\n\n[![PyPI - Version](https://img.shields.io/pypi/v/hatch-git-version-tunable.svg)](https://pypi.org/project/hatch-vcs-tunable)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-git-version-tunable.svg)](https://pypi.org/project/hatch-vcs-tunable)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n\n\n-----\n\nThis is a plugin for [Hatch](https://github.com/pypa/hatch) that extends the plugin [hatch-vcs](https://github.com/ofek/hatch-vcs) to allow for overriding some config elements with environment variables.\n\nThe reason you might want to do this is if you have multiple release tracks for your package, or multiple contexts in which it is used, and want to give it different versions in those different contexts.\n\n**Table of Contents**\n\n- [Use as a plugin](#plugin)\n- [Configuration](#Configuration)\n- [License](#license)\n\n## Plugin\n\nEnsure `hatch-vcs-tunable` is listed in the `build-system.requires` field in your `pyproject.toml`:\n\n```toml\n[build-system]\nrequires = [\"hatchling\", \"hatch-vcs-tunable\"]\nbuild-backend = \"hatchling.build\"\n```\n\n## Configuration\n\n`hatch-vcs-tunable` can be configured either through `pyproject.toml`, using exactly the same configuration elements as `hatch-vcs` but with the plugin name `vcs-tunable`, or via environment variable overrides.\n\n### `pyproject.toml`\n\nUse the same configuration elements as `hatch-vcs`, but the plugin name `vcs-tunable`. For instance, to set the version file you would do:\n\n``` toml\n[tool.hatch.build.hooks.vcs-tunable]\nversion-file=\"_version.py\"\n```\n\n### Environment\n\nThe environment variables should be specified as `ALL_CAPS_UNDERSCORE` versions of the pyproject settings, prefixed with `HATCH_VCS_TUNABLE_`. So for instance,\n- `tag-pattern` can be specified as `HATCH_VCS_TUNABLE_TAG_PATTERN`\n- `fallback-version` can be specified as `HATCH_VCS_TUNABLE_FALLBACK_VERSION`\n\n#### `raw-options`\n\nThe value of the `raw-options` is passed directly to `setuptools_scm`. It may have multiple keyword arguments, which need both a name and a value, and the keywords may not be safe to put in the names of environment variables, so both the names and values are passed in the environment variable value. These should be passed as a string of `key-name=value` separated by `;`. For instance, to specify both `relative_to=..` and `version_file=/some/path`, you would do `HATCH_VCS_TUNABLE_RAW_OPTIONS=\"relative_to=..;version_file=/some/path\"`.\n\nIf a setting is specified both in the environment and in `pyproject.toml`, the environment variable will take priority.\n\nEnvironment variables that are specified as empty still exist, so if you do `HATCH_VCS_TUNABLE_FALLBACK_VERSION=  hatch build`, the fallback version will be the empty string. If you have one of these environment variables defined all the time and need to remove it, use `unset`.\n\n\n## License\n\n`hatch-git-version-tunable` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Define your package's version from vcs refs, with build-time tuning of which tags to use.",
    "version": "0.0.0.dev0",
    "project_urls": {
        "Changelog": "https://github.com/Opentrons/hatch-plugins/tree/main/hatch-vcs-tunable/CHANGES.md",
        "Documentation": "https://github.com/Opentrons/hatch-plugins/tree/main/hatch-vcs-tunable#readme",
        "Issues": "https://github.com/Opentrons/hatch-plugins/issues",
        "Source": "https://github.com/Opentrons/hatch-plugins/tree/main/hatch-vcs-tunable"
    },
    "split_keywords": [
        "git",
        "hatch",
        "mercurial",
        "plugin",
        "version"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "01ff2b3be72bebd47366694c5cb10fd8734f762bfb962fb7ef01208deaab2a29",
                "md5": "13960b8ca1e92454ffc070a681a80b51",
                "sha256": "adc64850d8131edf6ac279cd2e4a0baa075b95ce1760e0da23469bec02c2f79d"
            },
            "downloads": -1,
            "filename": "hatch_vcs_tunable-0.0.0.dev0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "13960b8ca1e92454ffc070a681a80b51",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10905,
            "upload_time": "2024-02-26T18:59:08",
            "upload_time_iso_8601": "2024-02-26T18:59:08.811992Z",
            "url": "https://files.pythonhosted.org/packages/01/ff/2b3be72bebd47366694c5cb10fd8734f762bfb962fb7ef01208deaab2a29/hatch_vcs_tunable-0.0.0.dev0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b1a01802069d7a5afc1480a6b5536721bb1d92c723e1673e2d7de03261f098e",
                "md5": "d82cdabfe7b7a0f394fdbb1f9d6b1430",
                "sha256": "736ea8afe06e4ad3ac461419c5d82587f72cb48515c69a7f76aa9c03630b9ca4"
            },
            "downloads": -1,
            "filename": "hatch_vcs_tunable-0.0.0.dev0.tar.gz",
            "has_sig": false,
            "md5_digest": "d82cdabfe7b7a0f394fdbb1f9d6b1430",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11194,
            "upload_time": "2024-02-26T18:59:09",
            "upload_time_iso_8601": "2024-02-26T18:59:09.976551Z",
            "url": "https://files.pythonhosted.org/packages/2b/1a/01802069d7a5afc1480a6b5536721bb1d92c723e1673e2d7de03261f098e/hatch_vcs_tunable-0.0.0.dev0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-26 18:59:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Opentrons",
    "github_project": "hatch-plugins",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hatch-vcs-tunable"
}
        
Elapsed time: 0.19622s