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-decorators

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-decorators.git
cd reqstool-python-decorators
hatch env create
```

## Build & Test

```bash
hatch build
hatch run test
```
68 changes: 18 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,88 +1,56 @@

[![Commit Activity](https://img.shields.io/github/commit-activity/m/reqstool/reqstool-python-decorators?label=commits&style=for-the-badge)](https://github.com/reqstool/reqstool-python-decorators/pulse)
[![GitHub Issues](https://img.shields.io/github/issues/reqstool/reqstool-python-decorators?style=for-the-badge&logo=github)](https://github.com/reqstool/reqstool-python-decorators/issues)
[![License](https://img.shields.io/github/license/reqstool/reqstool-python-decorators?style=for-the-badge&logo=opensourceinitiative)](https://opensource.org/license/mit/)
[![Build](https://img.shields.io/github/actions/workflow/status/reqstool/reqstool-python-decorators/build.yml?style=for-the-badge&logo=github)](https://github.com/reqstool/reqstool-python-decorators/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-decorators/reqstool-python-decorators/0.0.1/index.html)
[![Documentation](https://img.shields.io/badge/Documentation-blue?style=for-the-badge&link=docs)](https://reqstool.github.io)

# Reqstool Python Decorators

## Description

This provides decorators and collecting of decorated code, formatting it and writing to yaml file.
Python decorators for [reqstool](https://github.com/reqstool/reqstool-client) requirements traceability. Provides `@Requirements` and `@SVCs` decorators for linking Python code to requirements and software verification cases.

## Requirements
## Prerequisites

- Python >= 3.13

## Installation

The package name is `reqstool-python-decorators`.

* Using pip install:

```
$pip install reqstool-python-decorators
```bash
pip install reqstool-python-decorators
```

## Usage

### pyproject.toml

* Hatch

```
dependencies = [
"reqstool-python-decorators == <version>"
]
```

* Poetry

```
[tool.poetry.dependencies]
reqstool-python-decorators = "<version>"
```

### Decorators

Import decorators:

```
```python
from reqstool_python_decorators.decorators.decorators import Requirements, SVCs
```

Example usage of the decorators:

```
@Requirements("REQ_111", "REQ_222")
def somefunction():
```
pass

```
@SVCs("SVC_111", "SVC_222")
def test_somefunction():
pass
```

### Processor

Import processor:

```
```python
from reqstool_python_decorators.processors.decorator_processor import DecoratorProcessor
```

Main function to collect decorators data and generate yaml file:

```
# Collect decorators and generate annotations.yml
process_decorated_data(path_to_python_files, output_file)
```

`path_to_python_files` is the directories to search through to find decorated code.
Used together with the [Hatch Plugin](https://github.com/reqstool/reqstool-python-hatch-plugin) or [Poetry Plugin](https://github.com/reqstool/reqstool-python-poetry-plugin).

## Documentation

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

(Optional) `output_file` is output file(path) the yaml file is stored to. Default is `/build/reqstool/annotations.yml`.
## Contributing

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

## License

This project is licensed under the MIT License - see the LICENSE.md file for details.
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 Python Decorators 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:installation.adoc[Installation]
* xref:usage.adoc[Usage]
3 changes: 0 additions & 3 deletions docs/modules/ROOT/pages/description.adoc

This file was deleted.

13 changes: 9 additions & 4 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
= Reqstool Python Decorators
= reqstool Python Decorators

include::description.adoc[]
This provides decorators and collecting of decorated code, formatting it and writing to yaml file.

include::installation.adoc[]
== Related components

include::licence.adoc[]
* xref:reqstool-python-hatch-plugin::index.adoc[Hatch Plugin] -- packages decorators output into a reqstool artifact during Hatch builds
* xref:reqstool-python-poetry-plugin::index.adoc[Poetry Plugin] -- packages decorators output into a reqstool artifact during Poetry builds

== License

MIT License.
9 changes: 4 additions & 5 deletions docs/modules/ROOT/pages/installation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

The package name is `reqstool-python-decorators`.

* Using pip install:

```
$pip install reqstool-python-decorators
```
[source,bash]
----
pip install reqstool-python-decorators
----
3 changes: 0 additions & 3 deletions docs/modules/ROOT/pages/licence.adoc

This file was deleted.

36 changes: 21 additions & 15 deletions docs/modules/ROOT/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,60 @@

* Hatch

```
[source,toml]
----
dependencies = [
"reqstool-python-decorators == <version>"
]
```
----

* Poetry

```
[source,toml]
----
[tool.poetry.dependencies]
reqstool-python-decorators = "<version>"
```
----

=== Decorators

Import decorators:

```
[source,python]
----
from reqstool_python_decorators.decorators.decorators import Requirements, SVCs
```
----

Example usage of the decorators:

```python
[source,python]
----
@Requirements("REQ_111", "REQ_222")
def somefunction():
```
----

```python
[source,python]
----
@SVCs("SVC_111", "SVC_222")
def test_somefunction():
```
----

=== Processor

Import processor:

```
[source,python]
----
from reqstool_python_decorators.processors.decorator_processor import DecoratorProcessor
```
----

Main function to collect decorators data and generate yaml file:

```
[source,python]
----
process_decorated_data(path_to_python_files, output_file)
```
----

`path_to_python_files` is the directories to search through to find decorated code.

(Optional) `output_file` is output file(path) the yaml file is stored to. Default is `/build/reqstool/annotations.yml`.