reqstool Python Hatch Plugin
This Hatch build hook generates annotations and assembles reqstool data during hatch build. It collects decorated code using reqstool-python-decorators and packages everything for consumption by the reqstool CLI.
Features
-
Hatch integration: Runs automatically as a build hook during
hatch build -
Combines annotations: Collects
@Requirementsand@SVCsdecorators from source and test code -
Assembles package data: Includes requirements, test results, and annotations in the built package
-
Generates config: Creates a
reqstool_config.ymlwith correct paths for the package structure
Add the Plugin
Add the build hook dependency to your pyproject.toml:
[tool.hatch.build.hooks.reqstool]
dependencies = ["reqstool-python-hatch-plugin"]
Default Behavior
The plugin automatically:
-
Runs during
hatch build -
Scans source and test directories for
@Requirementsand@SVCsdecorators -
Generates an
annotations.ymlfile inbuild/reqstool/ -
Creates a
reqstool_config.ymlwith paths for the package structure -
Includes reqstool data in the built package (sdist/wheel)
Minimal Setup
my-project/
├── pyproject.toml
├── docs/
│ └── reqstool/
│ └── requirements.yml (mandatory)
├── src/
└── tests/
Run hatch build and the annotations will be generated automatically.
Prerequisites
-
Python 3.13+
-
reqstool-python-decorators as a project dependency