Skip to main content

hatch-requirements-txt

Hatchling plugin to read project dependencies from requirements.txt

Tests

Linux Test Status Windows Test Status macOS Test Status Coverage

PyPI

PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel

Anaconda

Conda - Package Version Conda - Platform

Activity

GitHub last commit GitHub commits since tagged version Maintenance PyPI - Downloads

QA

CodeFactor Grade Flake8 Status mypy status

Other

Hatch project License GitHub top language Requirements Status

Usage

In your pyproject.toml make the following changes:

  • Append hatch-requirements-txt to build-system.requires.

  • Append "dependencies" to project.dynamic.

  • Add the following table:

[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]

The resulting pyproject.toml should look something like:

[build-system]
requires = ["hatchling", "hatch-requirements-txt"]
build-backend = "hatchling.build"

[project]
name = "my-project"
version = "1.0.0"
dynamic = ["dependencies"]

[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]

You can also define groups of optional dependencies (also known as “features”) by appending optional-dependencies to project.dynamic and adding a table like:

[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies]
crypto = ["requirements-crypto.txt"]
fastjson = ["requirements-fastjson.txt"]
cli = ["requirements-cli.txt"]

Requirements file format

hatch-requirements-txt only supports a subset of the requirements.txt format supported by pip. The following are supported:

  • requirement specifiers, per PEP 508

  • Comments, prefixed with a #.

  • --<option> options, both on their own line and after a requirement specifier. Note however that the options themselves are ignored.

The following are unsupported within requirements.txt files:

  • Editable install commands with the -e option,

  • References to other requirements or constraints files with the -r or -c options.

  • References to paths on the local filesystem, or URLs.

TL;DR For best compatibility, ensure all lines in your requirements.txt files are valid PEP 508 requirements, or comments starting with a #.

Metadata

Release files for hatch-requirements-txt 0.4.1

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-requirements-txt 0.4.1
File Size Uploaded Provenance Actions
hatch_requirements_txt-0.4.1.tar.gz 6.5 kB Without provenance Details for hatch_requirements_txt-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hatch-requirements-txt 0.4.1
File Interpreter ABI Platform Actions
hatch_requirements_txt-0.4.1-py3-none-any.whl Python 3 none any Details for hatch_requirements_txt-0.4.1-py3-none-any.whl

Total release size: 14.2 kB

Release files / hatch_requirements_txt-0.4.1.tar.gz

Download URL hatch_requirements_txt-0.4.1.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2c686e5758fd05bb55fa7d0c198fdd481f8d3aaa3c693260f5c0d74ce3547d20
BLAKE2b-256 checksum
How to use checksums
7c043703d3caa354fd7148a5453724de70577a6010234d1e1f3ff6b98a4d3242
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / hatch_requirements_txt-0.4.1-py3-none-any.whl

Download URL hatch_requirements_txt-0.4.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13c6ab7707cbc0aba128b3626dacae4be7065f1dbafc792461c9f547b3c3ffde
BLAKE2b-256 checksum
How to use checksums
98a39a71667d284dff0e5d1c95b99b2383bbfcfc120843209522f8054055c0bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for hatch-requirements-txt 0.4.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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