Skip to main content

Hatchling plugin to read project dependencies from requirements.txt

Project description

Hatchling plugin to read project dependencies from requirements.txt


Linux Test Status Windows Test Status macOS Test Status Coverage


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


Conda - Package Version Conda - Platform


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


CodeFactor Grade Flake8 Status mypy status


Hatch project License GitHub top language Requirements Status


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:

files = ["requirements.txt"]

The resulting pyproject.toml should look something like:

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

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

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:

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 #.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hatch_requirements_txt-0.4.1.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

hatch_requirements_txt-0.4.1-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page