reqstool-python-decorators 1.0.0__tar.gz → 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/.github/workflows/build-docs.yml +1 -1
- reqstool_python_decorators-1.0.1/.github/workflows/build.yml +70 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/.github/workflows/check-semantic-pr.yml +1 -1
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/.github/workflows/release.yml +12 -9
- reqstool_python_decorators-1.0.1/.python-version +1 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/PKG-INFO +4 -1
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/openspec/specs/decorator-definitions/spec.md +2 -1
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/openspec/specs/decorator-processing/spec.md +2 -1
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/openspec/specs/yaml-export/spec.md +2 -1
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/pyproject.toml +3 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/src/reqstool_python_decorators/processors/decorator_processor.py +6 -4
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/unit/reqstool_decorators/processors/test_processors.py +88 -0
- reqstool_python_decorators-1.0.0/.github/workflows/build.yml +0 -95
- reqstool_python_decorators-1.0.0/.github/workflows/lint.yml +0 -25
- reqstool_python_decorators-1.0.0/.python-version +0 -1
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/.claude/settings.json +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/.gitignore +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/.mcp.json +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/.reqstool-ai.yaml +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/CONTRIBUTING.md +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/LICENSE +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/README.md +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/antora-playbook.yml +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/antora.yml +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/modules/ROOT/nav.adoc +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/modules/ROOT/pages/index.adoc +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/modules/ROOT/pages/installation.adoc +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/modules/ROOT/pages/usage.adoc +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/reqstool/reqstool_config.yml +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/reqstool/requirements.yml +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/reqstool/software_verification_cases.yml +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/openspec/openspecui.hooks.ts +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/renovate.json5 +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/scripts/generate_annotations.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/src/reqstool_python_decorators/__init__.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/src/reqstool_python_decorators/decorators/__init__.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/src/reqstool_python_decorators/decorators/decorators.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/src/reqstool_python_decorators/processors/__init__.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/e2e/__init__.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/e2e/reqstool_decorators/__init__.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/e2e/reqstool_decorators/test_process_e2e.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/integration/__init__.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/integration/reqstool_decorators/__init__.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/resources/test_decorators/requirements_decorators.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/resources/test_decorators/svc_decorators.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/unit/conftest.py +0 -0
- {reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/unit/reqstool_decorators/test_decorators.py +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: Build PyPI
|
|
2
|
+
on:
|
|
3
|
+
workflow_call:
|
|
4
|
+
inputs:
|
|
5
|
+
ref:
|
|
6
|
+
description: "Branch, tag or SHA to build. Empty = the caller's ref."
|
|
7
|
+
required: false
|
|
8
|
+
type: string
|
|
9
|
+
default: ""
|
|
10
|
+
artifact-name:
|
|
11
|
+
description: >
|
|
12
|
+
Name to upload the build output under. The release flow runs this
|
|
13
|
+
workflow twice in one run -- once on the branch, once on the tag -- and
|
|
14
|
+
upload-artifact rejects a duplicate name.
|
|
15
|
+
required: false
|
|
16
|
+
type: string
|
|
17
|
+
default: "dist"
|
|
18
|
+
workflow_dispatch:
|
|
19
|
+
push:
|
|
20
|
+
branches:
|
|
21
|
+
- main
|
|
22
|
+
pull_request:
|
|
23
|
+
types:
|
|
24
|
+
- opened
|
|
25
|
+
- reopened
|
|
26
|
+
- synchronize
|
|
27
|
+
|
|
28
|
+
permissions:
|
|
29
|
+
contents: read
|
|
30
|
+
|
|
31
|
+
jobs:
|
|
32
|
+
lint:
|
|
33
|
+
uses: reqstool/.github/.github/workflows/python-lint.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
34
|
+
|
|
35
|
+
build:
|
|
36
|
+
needs: lint
|
|
37
|
+
uses: reqstool/.github/.github/workflows/python-build-hatch.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
38
|
+
with:
|
|
39
|
+
coverage-source: reqstool_python_decorators
|
|
40
|
+
ref: ${{ inputs.ref }}
|
|
41
|
+
artifact-name: ${{ inputs.artifact-name || 'dist' }}
|
|
42
|
+
post-test-command: hatch run dev:python scripts/generate_annotations.py
|
|
43
|
+
|
|
44
|
+
reqstool:
|
|
45
|
+
needs: build
|
|
46
|
+
uses: reqstool/.github/.github/workflows/common-reqstool-verify.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
47
|
+
with:
|
|
48
|
+
build-artifact: ${{ inputs.artifact-name || 'dist' }}-build
|
|
49
|
+
|
|
50
|
+
smoke:
|
|
51
|
+
needs: build
|
|
52
|
+
uses: reqstool/.github/.github/workflows/python-smoke.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
53
|
+
with:
|
|
54
|
+
dist-artifact: ${{ inputs.artifact-name || 'dist' }}
|
|
55
|
+
requirements: pytest==8.4.1
|
|
56
|
+
command: pytest tests/unit tests/e2e
|
|
57
|
+
|
|
58
|
+
validate-openspec:
|
|
59
|
+
uses: reqstool/.github/.github/workflows/common-validate-openspec.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
60
|
+
|
|
61
|
+
ci:
|
|
62
|
+
if: ${{ always() }}
|
|
63
|
+
needs: [lint, build, reqstool, smoke, validate-openspec]
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
steps:
|
|
66
|
+
- name: Fail unless every needed job succeeded
|
|
67
|
+
env:
|
|
68
|
+
NEEDS: ${{ toJSON(needs) }}
|
|
69
|
+
run: |
|
|
70
|
+
echo "$NEEDS" | python3 -c 'import json,sys; r={k:v["result"] for k,v in json.load(sys.stdin).items()}; print(r); sys.exit(0 if all(v=="success" for v in r.values()) else 1)'
|
|
@@ -10,4 +10,4 @@ permissions:
|
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
12
|
check:
|
|
13
|
-
uses: reqstool/.github/.github/workflows/common-check-semantic-pr.yml@
|
|
13
|
+
uses: reqstool/.github/.github/workflows/common-check-semantic-pr.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
{reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/.github/workflows/release.yml
RENAMED
|
@@ -12,7 +12,7 @@ on:
|
|
|
12
12
|
required: false
|
|
13
13
|
type: string
|
|
14
14
|
prerelease:
|
|
15
|
-
description: "Publish as a release candidate instead of a release: verified like any release, but never
|
|
15
|
+
description: "Publish as a release candidate instead of a release: verified like any release, but never marked as latest. The number is chosen for you (0.2.0 -> 0.2.0rc1, then the next)."
|
|
16
16
|
required: false
|
|
17
17
|
type: choice
|
|
18
18
|
options: [none, rc, b, a]
|
|
@@ -41,7 +41,7 @@ permissions:
|
|
|
41
41
|
|
|
42
42
|
jobs:
|
|
43
43
|
prepare:
|
|
44
|
-
uses: reqstool/.github/.github/workflows/common-release-prepare.yml@
|
|
44
|
+
uses: reqstool/.github/.github/workflows/common-release-prepare.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
45
45
|
permissions:
|
|
46
46
|
contents: read
|
|
47
47
|
with:
|
|
@@ -67,7 +67,7 @@ jobs:
|
|
|
67
67
|
tag:
|
|
68
68
|
needs: [prepare, checks]
|
|
69
69
|
if: ${{ !inputs.dry-run }}
|
|
70
|
-
uses: reqstool/.github/.github/workflows/common-release-tag.yml@
|
|
70
|
+
uses: reqstool/.github/.github/workflows/common-release-tag.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
71
71
|
permissions:
|
|
72
72
|
contents: write
|
|
73
73
|
with:
|
|
@@ -88,7 +88,7 @@ jobs:
|
|
|
88
88
|
|
|
89
89
|
assets:
|
|
90
90
|
needs: [prepare, build-tagged]
|
|
91
|
-
uses: reqstool/.github/.github/workflows/common-release-assets.yml@
|
|
91
|
+
uses: reqstool/.github/.github/workflows/common-release-assets.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
92
92
|
permissions:
|
|
93
93
|
contents: write
|
|
94
94
|
with:
|
|
@@ -109,7 +109,7 @@ jobs:
|
|
|
109
109
|
permissions:
|
|
110
110
|
id-token: write
|
|
111
111
|
steps:
|
|
112
|
-
- uses: reqstool/.github/.github/actions/download-dists@
|
|
112
|
+
- uses: reqstool/.github/.github/actions/download-dists@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
113
113
|
with:
|
|
114
114
|
artifact: dist-tagged
|
|
115
115
|
# Inline, not inside download-dists: nesting this Docker action in a
|
|
@@ -121,17 +121,20 @@ jobs:
|
|
|
121
121
|
|
|
122
122
|
# Last, deliberately. Everything above can fail, and until this runs nothing
|
|
123
123
|
# resolving "the latest release" can see what was built -- the release is still
|
|
124
|
-
# a prerelease.
|
|
124
|
+
# a prerelease. Marking it latest is one API call against a release that already
|
|
125
125
|
# has its artifacts.
|
|
126
126
|
#
|
|
127
127
|
# The guard is `no job failed`, not the default `every job succeeded`: on a dry
|
|
128
128
|
# run every job above is skipped, which would make plain success() false too --
|
|
129
129
|
# `!inputs.dry-run` is what actually gates this job then, and `no job failed`
|
|
130
130
|
# is what confirms nothing above it errored on a real run.
|
|
131
|
-
|
|
131
|
+
#
|
|
132
|
+
# `publish-to-pypi` must also have succeeded: a failure upstream leaves it skipped,
|
|
133
|
+
# not failed, and a skip alone does not trip `no job failed`.
|
|
134
|
+
finalize:
|
|
132
135
|
needs: [prepare, assets, publish-to-pypi]
|
|
133
|
-
if: ${{ !inputs.dry-run && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
|
|
134
|
-
uses: reqstool/.github/.github/workflows/common-release-
|
|
136
|
+
if: ${{ !inputs.dry-run && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') && needs.publish-to-pypi.result == 'success' }}
|
|
137
|
+
uses: reqstool/.github/.github/workflows/common-release-finalize.yml@ea3dbab0d008dc916896835d211f9238d0a4b113 # 1.3.2
|
|
135
138
|
permissions:
|
|
136
139
|
contents: write
|
|
137
140
|
with:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.15
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: reqstool-python-decorators
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Reqstool Python Decorators
|
|
5
5
|
Project-URL: Homepage, https://reqstool.github.io
|
|
6
6
|
Project-URL: Source, https://github.com/reqstool/reqstool-python-decorators.git
|
|
@@ -11,6 +11,9 @@ Classifier: Development Status :: 4 - Beta
|
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
14
17
|
Requires-Python: >=3.13
|
|
15
18
|
Requires-Dist: ruamel-yaml==0.19.1
|
|
16
19
|
Description-Content-Type: text/markdown
|
|
@@ -12,4 +12,5 @@ reqstool requirement and SVC IDs only; titles and descriptions are injected at r
|
|
|
12
12
|
The system SHALL implement DECORATORS_001.
|
|
13
13
|
|
|
14
14
|
#### Scenario: SVC_DECORATORS_001
|
|
15
|
-
|
|
15
|
+
- **WHEN** SVC_DECORATORS_001 is run
|
|
16
|
+
- **THEN** it passes
|
|
@@ -12,4 +12,5 @@ reqstool requirement and SVC IDs only; titles and descriptions are injected at r
|
|
|
12
12
|
The system SHALL implement DECORATORS_002.
|
|
13
13
|
|
|
14
14
|
#### Scenario: SVC_DECORATORS_002
|
|
15
|
-
|
|
15
|
+
- **WHEN** SVC_DECORATORS_002 is run
|
|
16
|
+
- **THEN** it passes
|
|
@@ -12,4 +12,5 @@ reqstool requirement and SVC IDs only; titles and descriptions are injected at r
|
|
|
12
12
|
The system SHALL implement DECORATORS_003.
|
|
13
13
|
|
|
14
14
|
#### Scenario: SVC_DECORATORS_003
|
|
15
|
-
|
|
15
|
+
- **WHEN** SVC_DECORATORS_003 is run
|
|
16
|
+
- **THEN** it passes
|
|
@@ -26,6 +26,9 @@ requires-python = ">=3.13"
|
|
|
26
26
|
classifiers = [
|
|
27
27
|
"License :: OSI Approved :: MIT License",
|
|
28
28
|
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Programming Language :: Python :: 3.14",
|
|
31
|
+
"Programming Language :: Python :: 3.15",
|
|
29
32
|
"Operating System :: OS Independent",
|
|
30
33
|
"Development Status :: 4 - Beta",
|
|
31
34
|
]
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from enum import Enum, unique
|
|
4
4
|
import os
|
|
5
|
+
from pathlib import Path, PurePath
|
|
5
6
|
from typing import ReadOnly, TypedDict
|
|
6
7
|
from ruamel.yaml import YAML
|
|
7
8
|
import ast
|
|
@@ -115,8 +116,9 @@ class DecoratorProcessor:
|
|
|
115
116
|
- `name` (str): The name of the function or class.
|
|
116
117
|
- `decorators` (list): List of dictionaries with decorator info including name and arguments e.g. "REQ_001".
|
|
117
118
|
"""
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
# Hand ast.parse the raw bytes so it decodes per PEP 263 (UTF-8 unless the file declares otherwise),
|
|
120
|
+
# instead of the platform locale encoding (cp1252 on Windows), which rejects valid UTF-8 sources.
|
|
121
|
+
tree = ast.parse(Path(file_path).read_bytes(), filename=str(file_path))
|
|
120
122
|
|
|
121
123
|
for node in ast.walk(tree):
|
|
122
124
|
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)):
|
|
@@ -130,7 +132,7 @@ class DecoratorProcessor:
|
|
|
130
132
|
if any(decorator_info["name"] in decorator_names for decorator_info in decorators_info):
|
|
131
133
|
self.req_svc_results.append(
|
|
132
134
|
{
|
|
133
|
-
"fullyQualifiedName":
|
|
135
|
+
"fullyQualifiedName": PurePath(file_path).as_posix().replace("/", "."),
|
|
134
136
|
"elementKind": node.__class__.__name__.removesuffix("Def").upper(),
|
|
135
137
|
"name": node.name,
|
|
136
138
|
"decorators": decorators_info,
|
|
@@ -157,7 +159,7 @@ class DecoratorProcessor:
|
|
|
157
159
|
instance.write_to_yaml("output_file.yml", data)
|
|
158
160
|
```
|
|
159
161
|
"""
|
|
160
|
-
with open(output_file, "w") as yaml_file:
|
|
162
|
+
with open(output_file, "w", encoding="utf-8") as yaml_file:
|
|
161
163
|
yaml = YAML()
|
|
162
164
|
yaml.default_flow_style = False
|
|
163
165
|
yaml_file.write(self.yaml_language_server)
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import subprocess
|
|
3
|
+
import sys
|
|
4
|
+
from pathlib import PureWindowsPath
|
|
5
|
+
|
|
1
6
|
import pytest
|
|
2
7
|
from reqstool_python_decorators.decorators.decorators import SVCs
|
|
3
8
|
from reqstool_python_decorators.processors.decorator_processor import DecoratorProcessor
|
|
@@ -325,3 +330,86 @@ def test_process_decorated_data_no_state_accumulation(process_decorator_instance
|
|
|
325
330
|
# Should have exactly 1 entry, not 2 due to state accumulation
|
|
326
331
|
entries = data["requirement_annotations"]["implementations"]["REQ_001"]
|
|
327
332
|
assert len(entries) == 1
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
# ---------------------------------------------------------------------------
|
|
336
|
+
# non-ASCII sources / platform locale encoding
|
|
337
|
+
# ---------------------------------------------------------------------------
|
|
338
|
+
|
|
339
|
+
# "Đ" is C4 90 in UTF-8; 0x90 is undefined in cp1252, so a locale-decoded read fails on Windows,
|
|
340
|
+
# and any non-ASCII byte fails under an ASCII locale on Linux and macOS.
|
|
341
|
+
_NON_ASCII_SOURCE = '# Đ non-ASCII comment\n@Requirements("REQ_001")\ndef my_func():\n """Đ"""\n'
|
|
342
|
+
|
|
343
|
+
_RUN_PROCESSOR = (
|
|
344
|
+
"import sys\n"
|
|
345
|
+
"from reqstool_python_decorators.processors.decorator_processor import DecoratorProcessor\n"
|
|
346
|
+
"DecoratorProcessor().process_decorated_data([sys.argv[1]], output_file=sys.argv[2])\n"
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
@SVCs("SVC_DECORATORS_002", "SVC_DECORATORS_003")
|
|
351
|
+
def test_process_decorated_data_non_ascii_source_with_non_utf8_locale(tmp_path):
|
|
352
|
+
src_dir = tmp_path / "src"
|
|
353
|
+
src_dir.mkdir()
|
|
354
|
+
(src_dir / "mod.py").write_bytes(_NON_ASCII_SOURCE.encode("utf-8"))
|
|
355
|
+
output_file = tmp_path / "out" / "annotations.yml"
|
|
356
|
+
|
|
357
|
+
# Run in a child process with UTF-8 mode off and a legacy locale to mimic a default Windows setup.
|
|
358
|
+
env = {
|
|
359
|
+
**os.environ,
|
|
360
|
+
"PYTHONUTF8": "0",
|
|
361
|
+
"PYTHONCOERCECLOCALE": "0",
|
|
362
|
+
"PYTHONIOENCODING": "utf-8",
|
|
363
|
+
"LC_ALL": "C",
|
|
364
|
+
"LANG": "C",
|
|
365
|
+
}
|
|
366
|
+
result = subprocess.run(
|
|
367
|
+
[sys.executable, "-c", _RUN_PROCESSOR, str(src_dir), str(output_file)],
|
|
368
|
+
capture_output=True,
|
|
369
|
+
text=True,
|
|
370
|
+
env=env,
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
assert result.returncode == 0, result.stderr
|
|
374
|
+
data = YAML().load(output_file.read_text(encoding="utf-8"))
|
|
375
|
+
assert [
|
|
376
|
+
e["fullyQualifiedName"].rsplit(".", 1)[-1]
|
|
377
|
+
for e in data["requirement_annotations"]["implementations"]["REQ_001"]
|
|
378
|
+
] == ["my_func"]
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
@SVCs("SVC_DECORATORS_002")
|
|
382
|
+
def test_get_functions_and_classes_honours_pep263_encoding_declaration(
|
|
383
|
+
process_decorator_instance: DecoratorProcessor, tmp_path
|
|
384
|
+
):
|
|
385
|
+
src_file = tmp_path / "latin1_mod.py"
|
|
386
|
+
src_file.write_bytes(
|
|
387
|
+
'# -*- coding: latin-1 -*-\n# é\n@Requirements("REQ_001")\ndef my_func():\n pass\n'.encode("latin-1")
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
process_decorator_instance.get_functions_and_classes(src_file, ["Requirements"])
|
|
391
|
+
|
|
392
|
+
assert [r["name"] for r in process_decorator_instance.req_svc_results] == ["my_func"]
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
# ---------------------------------------------------------------------------
|
|
396
|
+
# Windows-style paths in fullyQualifiedName
|
|
397
|
+
# ---------------------------------------------------------------------------
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
@SVCs("SVC_DECORATORS_002")
|
|
401
|
+
def test_fully_qualified_name_uses_dots_for_windows_path_separators(
|
|
402
|
+
process_decorator_instance: DecoratorProcessor, tmp_path, monkeypatch
|
|
403
|
+
):
|
|
404
|
+
# os.walk/os.path.join yield "src\\pkg\\mod.py" on Windows; backslashes used to survive into the name.
|
|
405
|
+
package = tmp_path / "src" / "pkg"
|
|
406
|
+
package.mkdir(parents=True)
|
|
407
|
+
(package / "mod.py").write_text('@Requirements("REQ_001")\ndef my_func():\n pass\n', encoding="utf-8")
|
|
408
|
+
monkeypatch.chdir(tmp_path)
|
|
409
|
+
|
|
410
|
+
process_decorator_instance.get_functions_and_classes(PureWindowsPath("src\\pkg\\mod.py"), ["Requirements"])
|
|
411
|
+
formatted = process_decorator_instance.format_results(process_decorator_instance.req_svc_results)
|
|
412
|
+
|
|
413
|
+
assert formatted["requirement_annotations"]["implementations"]["REQ_001"] == [
|
|
414
|
+
{"elementKind": "METHOD", "fullyQualifiedName": "src.pkg.mod.my_func"}
|
|
415
|
+
]
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
name: Build PyPI
|
|
2
|
-
on:
|
|
3
|
-
workflow_call:
|
|
4
|
-
inputs:
|
|
5
|
-
ref:
|
|
6
|
-
description: "Branch, tag or SHA to build. Empty = the caller's ref."
|
|
7
|
-
required: false
|
|
8
|
-
type: string
|
|
9
|
-
default: ""
|
|
10
|
-
artifact-name:
|
|
11
|
-
description: >
|
|
12
|
-
Name to upload the build output under. The release flow runs this
|
|
13
|
-
workflow twice in one run -- once on the branch, once on the tag -- and
|
|
14
|
-
upload-artifact rejects a duplicate name.
|
|
15
|
-
required: false
|
|
16
|
-
type: string
|
|
17
|
-
default: "dist"
|
|
18
|
-
workflow_dispatch:
|
|
19
|
-
push:
|
|
20
|
-
branches:
|
|
21
|
-
- main
|
|
22
|
-
pull_request:
|
|
23
|
-
types:
|
|
24
|
-
- opened
|
|
25
|
-
- reopened
|
|
26
|
-
- synchronize
|
|
27
|
-
|
|
28
|
-
permissions:
|
|
29
|
-
contents: read
|
|
30
|
-
|
|
31
|
-
jobs:
|
|
32
|
-
linting:
|
|
33
|
-
name: Reuse linting job
|
|
34
|
-
uses: ./.github/workflows/lint.yml
|
|
35
|
-
|
|
36
|
-
build:
|
|
37
|
-
needs: linting
|
|
38
|
-
runs-on: ubuntu-latest
|
|
39
|
-
strategy:
|
|
40
|
-
fail-fast: false
|
|
41
|
-
matrix:
|
|
42
|
-
reqstool-source: [pypi, main]
|
|
43
|
-
steps:
|
|
44
|
-
# Full history and tags: hatch-vcs derives the version from git state, so a
|
|
45
|
-
# shallow clone would build the wrong number rather than fail.
|
|
46
|
-
- name: Check out source repository
|
|
47
|
-
uses: actions/checkout@v7.0.1
|
|
48
|
-
with:
|
|
49
|
-
persist-credentials: false
|
|
50
|
-
fetch-depth: 0
|
|
51
|
-
fetch-tags: true
|
|
52
|
-
ref: ${{ inputs.ref || github.ref }}
|
|
53
|
-
- name: Set up Python
|
|
54
|
-
uses: actions/setup-python@v7.1.0
|
|
55
|
-
with:
|
|
56
|
-
python-version: "3.13.17"
|
|
57
|
-
- name: Install dependencies
|
|
58
|
-
# renovate: datasource=pypi depName=hatch
|
|
59
|
-
run: pip install hatch==1.18.1
|
|
60
|
-
- name: Run tests
|
|
61
|
-
run: hatch run dev:pytest --junitxml=build/junit.xml --cov=reqstool_python_decorators --cov-report=xml:build/coverage.xml
|
|
62
|
-
- name: Build project
|
|
63
|
-
run: hatch build
|
|
64
|
-
- name: Self-apply own decorator processor to own src/tests
|
|
65
|
-
# Relies on `hatch build` (above) not cleaning build/ -- annotations.yml lands
|
|
66
|
-
# alongside the junit/coverage output from the "Run tests" step, and
|
|
67
|
-
# reqstool_config.yml expects to find both there. If hatch build ever starts
|
|
68
|
-
# cleaning build/, move the pytest output dir outside of it.
|
|
69
|
-
run: hatch run dev:python scripts/generate_annotations.py
|
|
70
|
-
- name: Install reqstool
|
|
71
|
-
uses: reqstool/.github/.github/actions/install-reqstool@a4203a58cec87861655512b6b277a859db385796 # 1.1.0
|
|
72
|
-
with:
|
|
73
|
-
reqstool-source: ${{ matrix.reqstool-source }}
|
|
74
|
-
- name: Validate reqstool spec completeness
|
|
75
|
-
# not yet available in the latest PyPI release; supplementary to (not a
|
|
76
|
-
# replacement for) the `reqstool status --fail-if-incomplete` gate below, which
|
|
77
|
-
# is the actual required check on the pypi leg
|
|
78
|
-
if: matrix.reqstool-source == 'main'
|
|
79
|
-
uses: reqstool/.github/.github/actions/validate-reqstool@a4203a58cec87861655512b6b277a859db385796 # 1.1.0
|
|
80
|
-
- name: Run reqstool status
|
|
81
|
-
# Required gate on both matrix legs -- fails the build unless every
|
|
82
|
-
# requirement is implemented and verified.
|
|
83
|
-
uses: reqstool/.github/.github/actions/reqstool-status@a4203a58cec87861655512b6b277a859db385796 # 1.1.0
|
|
84
|
-
with:
|
|
85
|
-
fail-if-incomplete: "true"
|
|
86
|
-
# Upload artifacts for later use
|
|
87
|
-
- name: Upload Artifacts
|
|
88
|
-
if: matrix.reqstool-source == 'pypi'
|
|
89
|
-
uses: actions/upload-artifact@v7.0.2
|
|
90
|
-
with:
|
|
91
|
-
name: ${{ inputs.artifact-name || 'dist' }}
|
|
92
|
-
path: dist/
|
|
93
|
-
|
|
94
|
-
validate-openspec:
|
|
95
|
-
uses: reqstool/.github/.github/workflows/common-validate-openspec.yml@a4203a58cec87861655512b6b277a859db385796 # 1.1.0
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
name: Lint (black and flake8)
|
|
2
|
-
on:
|
|
3
|
-
workflow_dispatch:
|
|
4
|
-
workflow_call:
|
|
5
|
-
|
|
6
|
-
permissions:
|
|
7
|
-
contents: read
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
linting:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- name: Check out source repository
|
|
14
|
-
uses: actions/checkout@v7.0.1
|
|
15
|
-
- name: Set up Python
|
|
16
|
-
uses: actions/setup-python@v7.1.0
|
|
17
|
-
with:
|
|
18
|
-
python-version: "3.13.17"
|
|
19
|
-
- name: Install pip package(s)
|
|
20
|
-
# renovate: datasource=pypi depName=hatch
|
|
21
|
-
run: pip install hatch==1.18.1
|
|
22
|
-
- name: Run black formatter check
|
|
23
|
-
run: hatch run dev:black --check --verbose src tests
|
|
24
|
-
- name: Run flake8 linter
|
|
25
|
-
run: hatch run dev:flake8
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.13
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/antora-playbook.yml
RENAMED
|
File without changes
|
|
File without changes
|
{reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/modules/ROOT/nav.adoc
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/docs/reqstool/requirements.yml
RENAMED
|
File without changes
|
|
File without changes
|
{reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/openspec/openspecui.hooks.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/integration/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{reqstool_python_decorators-1.0.0 → reqstool_python_decorators-1.0.1}/tests/unit/conftest.py
RENAMED
|
File without changes
|