Skip to content

Commit 445b456

Browse files
author
Jimisola Laursen
committed
docs: rewrite Antora docs using unified plugin template
- Add description with features, quick start, minimal setup, prerequisites - Add configuration reference with complete example and individual params - Rewrite usage with basic usage, decorator dependency, lifecycle - Simplify license to uniform format - Remove separate installation.adoc (merged into description) - Simplify nav to single Start entry Signed-off-by: jimisola <jimisola@jimisola.com>
1 parent 1b57d01 commit 445b456

7 files changed

Lines changed: 160 additions & 33 deletions

File tree

docs/modules/ROOT/nav.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
* xref:index.adoc[Start]
2-
* xref:usage.adoc[Usage]
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
== Configuration
2+
3+
The plugin is configured in your `pyproject.toml` file under `[tool.hatch.build.hooks.reqstool]`.
4+
5+
=== Complete Configuration Example
6+
7+
[source,toml]
8+
----
9+
[tool.hatch.build.hooks.reqstool]
10+
# Build hook dependency
11+
dependencies = ["reqstool-python-hatch-plugin"]
12+
13+
# Directories to scan for decorators
14+
# Default: ["src", "tests"]
15+
sources = ["src", "tests"]
16+
17+
# Test result file pattern(s)
18+
# Default: "build/junit.xml"
19+
test_results = "build/junit.xml"
20+
21+
# Directory containing requirements.yml and optional files
22+
# Default: "docs/reqstool"
23+
dataset_directory = "docs/reqstool"
24+
25+
# Output directory for generated annotations
26+
# Default: "build/reqstool"
27+
output_directory = "build/reqstool"
28+
----
29+
30+
=== Configuration Parameters
31+
32+
==== sources
33+
34+
Directories to scan for `@Requirements` and `@SVCs` decorators.
35+
Defaults to `["src", "tests"]`.
36+
37+
[source,toml]
38+
----
39+
sources = ["src", "tests"]
40+
----
41+
42+
==== test_results
43+
44+
Path or pattern for test result files (JUnit XML).
45+
Defaults to `"build/junit.xml"`.
46+
47+
[source,toml]
48+
----
49+
test_results = "build/junit.xml"
50+
----
51+
52+
==== dataset_directory
53+
54+
Directory containing `requirements.yml` and optional reqstool files (`software_verification_cases.yml`, `manual_verification_results.yml`).
55+
Defaults to `"docs/reqstool"`.
56+
57+
[source,toml]
58+
----
59+
dataset_directory = "docs/reqstool"
60+
----
61+
62+
==== output_directory
63+
64+
Output directory for the generated `annotations.yml`.
65+
Defaults to `"build/reqstool"`.
66+
67+
[source,toml]
68+
----
69+
output_directory = "build/reqstool"
70+
----
Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
11
== Description
22

3-
This documentation provides information on how to use the Reqstool Python Hatch Plugin. The plugin is designed to be used with the Hatch build tool and facilitates the integration of the Reqstool Python Decorators in your project.
3+
This Hatch build hook generates annotations and assembles reqstool data during `hatch build`. It collects decorated code using https://github.com/reqstool/reqstool-python-decorators[reqstool-python-decorators] and packages everything for consumption by the reqstool CLI.
4+
5+
=== Features
6+
7+
* *Hatch integration*: Runs automatically as a build hook during `hatch build`
8+
* *Combines annotations*: Collects `@Requirements` and `@SVCs` decorators from source and test code
9+
* *Assembles package data*: Includes requirements, test results, and annotations in the built package
10+
* *Generates config*: Creates a `reqstool_config.yml` with correct paths for the package structure
11+
12+
=== Quick Start
13+
14+
==== Add the Plugin
15+
16+
Add the build hook dependency to your `pyproject.toml`:
17+
18+
[source,toml]
19+
----
20+
[tool.hatch.build.hooks.reqstool]
21+
dependencies = ["reqstool-python-hatch-plugin"]
22+
----
23+
24+
==== Default Behavior
25+
26+
The plugin automatically:
27+
28+
1. Runs during `hatch build`
29+
2. Scans source and test directories for `@Requirements` and `@SVCs` decorators
30+
3. Generates an `annotations.yml` file in `build/reqstool/`
31+
4. Creates a `reqstool_config.yml` with paths for the package structure
32+
5. Includes reqstool data in the built package (sdist/wheel)
33+
34+
==== Minimal Setup
35+
36+
[source]
37+
----
38+
my-project/
39+
├── pyproject.toml
40+
├── docs/
41+
│ └── reqstool/
42+
│ └── requirements.yml (mandatory)
43+
├── src/
44+
└── tests/
45+
----
46+
47+
Run `hatch build` and the annotations will be generated automatically.
48+
49+
=== Prerequisites
50+
51+
* Python 3.10+
52+
* https://hatch.pypa.io/[Hatch]
53+
* https://github.com/reqstool/reqstool-python-decorators[reqstool-python-decorators] as a project dependency

docs/modules/ROOT/pages/index.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
include::description.adoc[]
44

5-
include::installation.adoc[]
5+
include::configuration.adoc[]
66

7-
include::license.adoc[]
7+
include::usage.adoc[]
8+
9+
include::license.adoc[]

docs/modules/ROOT/pages/installation.adoc

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
== License
22

3-
This project is licensed under the MIT License - see the LICENSE.md file for details.
3+
MIT License.

docs/modules/ROOT/pages/usage.adoc

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,44 @@
11
== Usage
22

3+
=== Basic Usage
34

4-
=== Configuration
5+
Add the build hook to your `pyproject.toml`:
56

6-
The plugin can be configured through the `pyproject.toml` file. Configure plugin in `pyproject.toml`as follows;
7-
8-
```toml
7+
[source,toml]
8+
----
99
[tool.hatch.build.hooks.reqstool]
10-
dependencies = ["reqstool-python-hatch-plugin == <version>"]
10+
dependencies = ["reqstool-python-hatch-plugin"]
1111
sources = ["src", "tests"]
1212
test_results = "build/junit.xml"
1313
dataset_directory = "docs/reqstool"
1414
output_directory = "build/reqstool"
15-
```
16-
It specifies that the reqstool-python-hatch-plugin is a dependency for the build process, and it should be of a specific version.
15+
----
16+
17+
=== Decorator Dependency
18+
19+
To use `@Requirements` and `@SVCs` decorators in your code, add the decorators package as a dependency:
20+
21+
[source,toml]
22+
----
23+
[project]
24+
dependencies = ["reqstool-python-decorators"]
25+
----
26+
27+
See https://github.com/reqstool/reqstool-python-decorators[reqstool-python-decorators] for decorator usage.
28+
29+
=== Running the Build
30+
31+
[source,bash]
32+
----
33+
hatch build
34+
----
35+
36+
=== Default Lifecycle
37+
38+
The plugin integrates into the Hatch build process:
1739

18-
Further it defines the paths where the plugin should be applied. In this case, it specifies that the plugin should be applied to files in the src and tests directories.
40+
1. `hatch build` is invoked
41+
2. The build hook scans `sources` directories for decorated code
42+
3. An `annotations.yml` is generated in the `output_directory`
43+
4. A `reqstool_config.yml` is created with paths for the package structure
44+
5. Reqstool data is included in the built sdist/wheel package

0 commit comments

Comments
 (0)