Hatch Requirements.txt Plugin

0.4.1 · active · verified Fri Apr 10

hatch-requirements-txt is a Hatchling plugin that enables Hatch-managed Python projects to declare their runtime dependencies directly within a 'requirements.txt' file. This allows projects to maintain a familiar dependency declaration style while leveraging Hatch for modern packaging. The current version is 0.4.1, with relatively infrequent but stable releases.

Warnings

Install

Quickstart

To use `hatch-requirements-txt`, install the plugin and configure your `pyproject.toml` to declare 'dependencies' as dynamic. Then, create a `requirements.txt` file in your project root with your desired runtime dependencies. The Hatchling build backend will automatically parse this file when building your package. After setting up these files, you can use the `hatch` CLI (e.g., `hatch build`) to see the plugin in action.

mkdir my_project
cd my_project

# Create pyproject.toml
cat <<EOF > pyproject.toml
[build-system]
requires = ["hatchling>=1.8.0", "hatch-requirements-txt"]
build-backend = "hatchling.build"

[project]
name = "my-hatch-app"
version = "0.1.0"
dynamic = ["dependencies"]

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

# Create requirements.txt
cat <<EOF > requirements.txt
requests>=2.28.0
beautifulsoup4
EOF

# Your project is now configured to use requirements.txt for dependencies.
# To see it in action, you would typically run 'hatch build' (assuming 'hatch' CLI is installed).

view raw JSON →