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.
pip install hatch-requirements-txtNo compatibility data collected yet for this library.
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.
Ensure `dynamic = ['dependencies']` is present in your `pyproject.toml` under the `[project]` table.
Change `files = 'requirements.txt'` to `files = ['requirements.txt']`.
Ensure your project's `name` and `version` are explicitly defined in `pyproject.toml` or sourced from other appropriate Hatch dynamic metadata hooks, not via `hatch-requirements-txt`.
Add `"hatch-requirements-txt"` to the `requires` list under `[build-system]`.
Ensure your `pyproject.toml` includes `hatch-requirements-txt` in `build-system.requires`, adds `"dependencies"` to `project.dynamic`, and defines the `[tool.hatch.requirements-txt]` table. For example: ```toml [build-system] requires = ["hatchling", "hatch-requirements-txt"] build-backend = "hatchling.build" [project] name = "your-project" version = "0.1.0" dynamic = ["dependencies"] [tool.hatch.requirements-txt] files = ["requirements.txt"] ```
Remove editable installs (`-e`) from your `requirements.txt` file. For local or development dependencies, consider using Hatch's environment-specific dependencies or other mechanisms outside of the main `requirements.txt` parsed by this plugin.
Consolidate all direct dependencies into a single `requirements.txt` file that `hatch-requirements-txt` processes, or manage interconnected dependency files using a different approach that doesn't rely on `-r` or `-c` within the plugin's scope.
Ensure all entries in `requirements.txt` strictly adhere to PEP 508 requirement specifier syntax. Avoid local filesystem paths or complex URL forms that are not compliant, or verify correct quoting/escaping for URLs like `git+https://` if they are intended to be PEP 508 compliant.