Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

hatch-dependency-coversion

PyPI - Version PyPI - Python Version Ruff Checked with mypy


This is a plugin for Hatch that allows you to rewrite the versions in selected dependency specifiers to be exactly the same as the current version of the project configured in pyproject.toml's [project] table, requiring exact coversioning of those dependencies with the project.

This is useful for projects that are developed in lockstep but distributed as independent python packages rather than as subcomponents of the same namespace package. It is the equivalent of the following setup.py:

VERSION = '1.0.0'
setup(name='my-project', version=VERSION, install_requires=[f'my-dependency=={VERSION}'])

Minimal configuration is done in your pyproject.toml like this:

[build-system]
# Since this is a plugin for hatchling, you must be using hatchling as your build backend
requires = ["hatchling", "hatch-dependency-coversion"]
build-backend = "hatchling.build"

[project]
name = "my-project"
version = "0.1.0"
dependencies = [
    # 0.0.0 is chosen at random and will be overwritten
    "my-dependency==0.0.0"
]
# the dynamic entry must be present and the array must not be empty, otherwise hatch
# will not invoke the plugin. however, something in dynamic cannot be in the rest of
# the metadata, and only top-level keys can appear here - so if you did
# dynamic = ['dependencies'], then it (a) would not be true since it's not all the
# dependencies, just the versions of some of them and (b) you couldn't have a 
# dependencies entry in the project table. so put an arbitrary string here, and the
# name of the plugin is as good an arbitrary string as any.
dynamic = ['dependency-coversioning']
[tool.hatch.metadata.hooks.dependency-coversion]
# this list contains the names of dependencies to override
override-versions-of = ["my-dependency"]

Table of Contents

Operation

hatch-dependency-coversion is a metadata hook for hatch, or more specifically for hatchling, the PEP-508 build backend written by the hatch team. Whenever a package that uses hatch-dependency-coversion is built, hatch-dependency-coversion gets the chance to alter the list of dependencies the package will specify as required, and that pip and other installers or environment creators use to determine what dependencies to install.

Only those dependencies identified by name in the tool.hatch.metadata.hooks.dependency-coversion.override-versions-of list will have their versions overridden; nothing else will be touched.

Any PEP-440 version specifiers other than the version are left untouched; you can use hatch-dependency-coversion on dependencies that are optionally installed with markers (i.e. with os_name == 'Windows' or similar) and the markers will be preserved.

Plugin

Ensure hatch-dependency-coversion is listed in the build-system.requires field in your pyproject.toml:

[build-system]
requires = ["hatchling", "hatch-dependency-coversion"]
build-backend = "hatchling.build"

Configuration

hatch-dependency-coversion is configured through pyproject.toml as a metadata hook in a similar way to other hatch plugins. Its plugin name is dependency-coversion:

[tool.hatch.metadata.hooks.dependency-coversion]
override-versions-of = ["dependency1", "dependency2"]

The override-versions-of key is the only configuration that hatch-dependency-coversion takes. It is a list of strings, each of which should be the package name (the same thing you'd pass to pip or list in a dependency specifier) of one of the dependencies. Anything in here that is not in the top level project.dependencies key is ignored.

License

hatch-dependency-coversion is distributed under the terms of the Apache-2.0 license.

Metadata

Release files for hatch-dependency-coversion 0.0.1a4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hatch-dependency-coversion 0.0.1a4
File Size Uploaded
hatch_dependency_coversion-0.0.1a4.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hatch-dependency-coversion 0.0.1a4
File Interpreter ABI Platform
hatch_dependency_coversion-0.0.1a4-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / hatch_dependency_coversion-0.0.1a4.tar.gz

Download URL hatch_dependency_coversion-0.0.1a4.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ec5027805598db46d2717a93d8c1e61112710bce10001e045848acb94379bcc6
BLAKE2b-256 checksum
How to use checksums
ceefe0b3318483cf797cd25c7bc80eb0852802723ee22631e9897433b25a1209
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 16, 2025.

Transparency log

Release files / hatch_dependency_coversion-0.0.1a4-py3-none-any.whl

Download URL hatch_dependency_coversion-0.0.1a4-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a98deef54ee3bc6c8a7493cb21bee29d7edb0301ecb80bc9a9a366d4b30aecef
BLAKE2b-256 checksum
How to use checksums
32e3fce258eadaa02cb47a77ce0cb0166b2d583bc892a746b08686c76551d83b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 16, 2025.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page