Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions .github/workflows/publish_gh_pages.yml

This file was deleted.

25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributing to reqstool-python-hatch-plugin

Thank you for your interest in contributing!

For DCO sign-off, commit conventions, and code review process, see the organization-wide [CONTRIBUTING.md](https://github.com/reqstool/.github/blob/main/CONTRIBUTING.md).

## Prerequisites

- Python 3.13+
- [Hatch](https://hatch.pypa.io/) (`pip install hatch`)

## Setup

```bash
git clone https://github.com/reqstool/reqstool-python-hatch-plugin.git
cd reqstool-python-hatch-plugin
hatch env create
```

## Build & Test

```bash
hatch build
hatch run test
```
47 changes: 19 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@

[![Commit Activity](https://img.shields.io/github/commit-activity/m/reqstool/reqstool-python-hatch-plugin?label=commits&style=for-the-badge)](https://github.com/reqstool/reqstool-python-hatch-plugin/pulse)
[![GitHub Issues](https://img.shields.io/github/issues/reqstool/reqstool-python-hatch-plugin?style=for-the-badge&logo=github)](https://github.com/reqstool/reqstool-python-hatch-plugin/issues)
[![License](https://img.shields.io/github/license/reqstool/reqstool-python-hatch-plugin?style=for-the-badge&logo=opensourceinitiative)](https://opensource.org/license/mit/)
[![Build](https://img.shields.io/github/actions/workflow/status/reqstool/reqstool-python-hatch-plugin/build.yml?style=for-the-badge&logo=github)](https://github.com/reqstool/reqstool-python-hatch-plugin/actions/workflows/build.yml)
[![Static Badge](https://img.shields.io/badge/Documentation-blue?style=for-the-badge&link=docs)](https://reqstool.github.io/reqstool-python-hatch-plugin/reqstool-python-hatch-plugin/0.0.2/index.html)


[![Documentation](https://img.shields.io/badge/Documentation-blue?style=for-the-badge&link=docs)](https://reqstool.github.io)

## Description
# Reqstool Python Hatch Plugin

This documentation provides information on how to use the Reqstool Hatch Plugin. The plugin is designed to be used with the Hatch build tool and facilitates the integration of the Reqstool Decorators in your project.
Hatch build hook plugin for [reqstool](https://github.com/reqstool/reqstool-client) that collects decorated code and generates `annotations.yml` during `hatch build`.

## Installation

To use the Reqstool Hatch Plugin, follow these steps:

- Update your project dependencies in the `pyproject.toml` file and
ensure that the Reqstool Decorators' dependency is listed as follows;
Add to your `pyproject.toml`:

```toml
dependencies = ["reqstool-python-decorators==<version>"]
[build-system]
requires = [
"hatchling",
"reqstool-python-hatch-plugin==<version>",
]
```

When you declare this in the pyproject.toml file, you are specifying the required versions for the dependency of the Reqstool Decorators. This ensures that the correct version of the dependencies are used when installing and running your project.



## Usage

### Configuration

The plugin can be configured through the `pyproject.toml` file. Configure plugin in `pyproject.toml`as follows;
Configure the plugin in `pyproject.toml`:

```toml
[tool.hatch.build.hooks.reqstool]
Expand All @@ -40,17 +32,16 @@ dataset_directory = "docs/reqstool"
output_directory = "build/reqstool"
```

And under `requires` in `[build-system]` you need to add the plugin with the version, see example;
The plugin uses [reqstool-python-decorators](https://github.com/reqstool/reqstool-python-decorators) for processing.

```toml
[build-system]
requires = [
"hatchling",
"reqstool-python-hatch-plugin==<version>",
]
```
## Documentation

Full documentation can be found [here](https://reqstool.github.io).

## Contributing

See the organization-wide [CONTRIBUTING.md](https://github.com/reqstool/.github/blob/main/CONTRIBUTING.md).

It specifies that the reqstool-python-hatch-plugin is a dependency for the build process, and it should be of a specific version.
## License

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.
MIT License.
1 change: 1 addition & 0 deletions docs/antora-playbook.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/asciidoctor/asciidoctor-intellij-plugin/main/src/main/resources/jsonSchemas/antoraPlaybookSchema.json
# For local development only. Published site: https://reqstool.github.io

site:
title: Reqstool Hatch Plugin Documentation
Expand Down
5 changes: 3 additions & 2 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* xref:index.adoc[Start]
* xref:usage.adoc[Usage]
* xref:index.adoc[Overview]
* xref:configuration.adoc[Configuration]
* xref:usage.adoc[Usage]
70 changes: 70 additions & 0 deletions docs/modules/ROOT/pages/configuration.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
== Configuration

The plugin is configured in your `pyproject.toml` file under `[tool.hatch.build.hooks.reqstool]`.

=== Complete Configuration Example

[source,toml]
----
[tool.hatch.build.hooks.reqstool]
# Build hook dependency
dependencies = ["reqstool-python-hatch-plugin"]

# Directories to scan for decorators
# Default: ["src", "tests"]
sources = ["src", "tests"]

# Test result file pattern(s)
# Default: "build/junit.xml"
test_results = "build/junit.xml"

# Directory containing requirements.yml and optional files
# Default: "docs/reqstool"
dataset_directory = "docs/reqstool"

# Output directory for generated annotations
# Default: "build/reqstool"
output_directory = "build/reqstool"
----

=== Configuration Parameters

==== sources

Directories to scan for `@Requirements` and `@SVCs` decorators.
Defaults to `["src", "tests"]`.

[source,toml]
----
sources = ["src", "tests"]
----

==== test_results

Path or pattern for test result files (JUnit XML).
Defaults to `"build/junit.xml"`.

[source,toml]
----
test_results = "build/junit.xml"
----

==== dataset_directory

Directory containing `requirements.yml` and optional reqstool files (`software_verification_cases.yml`, `manual_verification_results.yml`).
Defaults to `"docs/reqstool"`.

[source,toml]
----
dataset_directory = "docs/reqstool"
----

==== output_directory

Output directory for the generated `annotations.yml`.
Defaults to `"build/reqstool"`.

[source,toml]
----
output_directory = "build/reqstool"
----
3 changes: 0 additions & 3 deletions docs/modules/ROOT/pages/description.adoc

This file was deleted.

58 changes: 54 additions & 4 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,57 @@
= Reqstool Python Hatch Plugin
= reqstool Python Hatch Plugin

include::description.adoc[]
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.

include::installation.adoc[]
== Features

include::license.adoc[]
* *Hatch integration*: Runs automatically as a build hook during `hatch build`
* *Combines annotations*: Collects `@Requirements` and `@SVCs` decorators from source and test code
* *Assembles package data*: Includes requirements, test results, and annotations in the built package
* *Generates config*: Creates a `reqstool_config.yml` with correct paths for the package structure

== Quick Start

== Add the Plugin

Add the build hook dependency to your `pyproject.toml`:

[source,toml]
----
[tool.hatch.build.hooks.reqstool]
dependencies = ["reqstool-python-hatch-plugin"]
----

== Default Behavior

The plugin automatically:

1. Runs during `hatch build`
2. Scans source and test directories for `@Requirements` and `@SVCs` decorators
3. Generates an `annotations.yml` file in `build/reqstool/`
4. Creates a `reqstool_config.yml` with paths for the package structure
5. Includes reqstool data in the built package (sdist/wheel)

== Minimal Setup

[source]
----
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+
* https://hatch.pypa.io/[Hatch]
* https://github.com/reqstool/reqstool-python-decorators[reqstool-python-decorators] as a project dependency

== License

MIT License.
20 changes: 0 additions & 20 deletions docs/modules/ROOT/pages/installation.adoc

This file was deleted.

3 changes: 0 additions & 3 deletions docs/modules/ROOT/pages/license.adoc

This file was deleted.

42 changes: 34 additions & 8 deletions docs/modules/ROOT/pages/usage.adoc
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
== Usage

=== Basic Usage

=== Configuration
Add the build hook to your `pyproject.toml`:

The plugin can be configured through the `pyproject.toml` file. Configure plugin in `pyproject.toml`as follows;

```toml
[source,toml]
----
[tool.hatch.build.hooks.reqstool]
dependencies = ["reqstool-python-hatch-plugin == <version>"]
dependencies = ["reqstool-python-hatch-plugin"]
sources = ["src", "tests"]
test_results = "build/junit.xml"
dataset_directory = "docs/reqstool"
output_directory = "build/reqstool"
```
It specifies that the reqstool-python-hatch-plugin is a dependency for the build process, and it should be of a specific version.
----

=== Decorator Dependency

To use `@Requirements` and `@SVCs` decorators in your code, add the decorators package as a dependency:

[source,toml]
----
[project]
dependencies = ["reqstool-python-decorators"]
----

See https://github.com/reqstool/reqstool-python-decorators[reqstool-python-decorators] for decorator usage.

=== Running the Build

[source,bash]
----
hatch build
----

=== Default Lifecycle

The plugin integrates into the Hatch build process:

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.
1. `hatch build` is invoked
2. The build hook scans `sources` directories for decorated code
3. An `annotations.yml` is generated in the `output_directory`
4. A `reqstool_config.yml` is created with paths for the package structure
5. reqstool data is included in the built sdist/wheel package