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
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ This provides decorators and collecting of decorated code, formatting it and wri

## Installation

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

* Using pip install:

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

## Using
## Usage

### pyproject.toml

* Hatch

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

* Poetry

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

### Decorators
Expand All @@ -51,12 +51,12 @@ from reqstool-decorators.decorators.decorators import Requirements, SVCs
Example usage of the decorators:

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

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

Expand All @@ -65,20 +65,19 @@ def test_somefunction():
Import processor:

```
from reqstool.processors.decorator_processor import ProcessDecorator
from reqstool.processors.decorator_processor import DecoratorProcessor
```

Main function to collect decorators data and generate yaml file:

```
process_decorated_data(path_to_python_files)
process_decorated_data(path_to_python_files, output_file)
```

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

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

Yaml file is saved into the `/dist` folder, make sure the folder exists before running the `process_decorated_data` function.

## License

Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ from reqstool_python_decorators.decorators.decorators import Requirements, SVCs
Example usage of the decorators:

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

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

Expand All @@ -53,5 +53,5 @@ process_decorated_data(path_to_python_files, output_file)

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_functions_and_classes(self, file_path, decorator_names):
if any(decorator_info["name"] in decorator_names for decorator_info in decorators_info):
self.req_svc_results.append(
{
"fullyQualifiedName": file_path,
"fullyQualifiedName": str(file_path).replace("/", "."),
"elementKind": str(type(node)).split(".")[-1][:-5].upper(),
"name": node.name,
"decorators": decorators_info,
Expand Down