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:
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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 800509946e85d9e56d73242fab223ec36db50372e870a04e2dd1fd9bad98455d |
|
MD5 | bd2d68e092a5a1a20a9e729540112f5a |
|
BLAKE2b-256 | 03a9478750388ddf54be886abb7cdb032e3b5a23c8886a8b1953fb66cd98c908 |
Hashes for hatch_requirements_txt-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb16fd5205d6d9c13641379ae75d63f538a29f05e377656f2f3d0e1931621d74 |
|
MD5 | 20c0cc12a912dd0c7d643b473b783d40 |
|
BLAKE2b-256 | 5c666fafc6e5ad4d4df49662b7696b39c512db13fb3566fc5ff0a394e8a2b133 |