Hatchling plugin to read project dependencies from requirements.txt
Project description
Hatchling plugin to read project dependencies from requirements.txt
Tests |
|
---|---|
PyPI |
|
Anaconda |
|
Activity |
|
QA |
|
Other |
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 #.
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
Built Distribution
Hashes for hatch_requirements_txt-0.4.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c686e5758fd05bb55fa7d0c198fdd481f8d3aaa3c693260f5c0d74ce3547d20 |
|
MD5 | bb741f92af054815f851f0d9333dd51b |
|
BLAKE2b-256 | 7c043703d3caa354fd7148a5453724de70577a6010234d1e1f3ff6b98a4d3242 |
Hashes for hatch_requirements_txt-0.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13c6ab7707cbc0aba128b3626dacae4be7065f1dbafc792461c9f547b3c3ffde |
|
MD5 | 60ccd367bf00e9f29c847b8dc9c51732 |
|
BLAKE2b-256 | 98a39a71667d284dff0e5d1c95b99b2383bbfcfc120843209522f8054055c0bb |