babyreqs 0.2.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.
- babyreqs-0.2.1/PKG-INFO +175 -0
- babyreqs-0.2.1/README.md +152 -0
- babyreqs-0.2.1/babyreqs.egg-info/PKG-INFO +175 -0
- babyreqs-0.2.1/babyreqs.egg-info/SOURCES.txt +40 -0
- babyreqs-0.2.1/babyreqs.egg-info/dependency_links.txt +1 -0
- babyreqs-0.2.1/babyreqs.egg-info/entry_points.txt +3 -0
- babyreqs-0.2.1/babyreqs.egg-info/requires.txt +19 -0
- babyreqs-0.2.1/babyreqs.egg-info/top_level.txt +4 -0
- babyreqs-0.2.1/babyreqs.py +76 -0
- babyreqs-0.2.1/babyreqs_cli.py +181 -0
- babyreqs-0.2.1/babyreqs_core/__init__.py +157 -0
- babyreqs-0.2.1/babyreqs_core/common.py +972 -0
- babyreqs-0.2.1/babyreqs_core/documentation.py +134 -0
- babyreqs-0.2.1/babyreqs_core/errors.py +25 -0
- babyreqs-0.2.1/babyreqs_core/git.py +126 -0
- babyreqs-0.2.1/babyreqs_core/markdown.py +574 -0
- babyreqs-0.2.1/babyreqs_core/markdown_model.py +187 -0
- babyreqs-0.2.1/babyreqs_core/markdown_renderers.py +254 -0
- babyreqs-0.2.1/babyreqs_core/model.py +325 -0
- babyreqs-0.2.1/babyreqs_core/pdf.py +132 -0
- babyreqs-0.2.1/babyreqs_core/pdf_document.py +689 -0
- babyreqs-0.2.1/babyreqs_core/pdf_image.py +326 -0
- babyreqs-0.2.1/babyreqs_core/pdf_text.py +137 -0
- babyreqs-0.2.1/babyreqs_core/pdf_title.py +286 -0
- babyreqs-0.2.1/babyreqs_core/repository.py +692 -0
- babyreqs-0.2.1/babyreqs_core/version.py +34 -0
- babyreqs-0.2.1/babyreqs_gui/__init__.py +33 -0
- babyreqs-0.2.1/babyreqs_gui/constants.py +5 -0
- babyreqs-0.2.1/babyreqs_gui/dialogs.py +433 -0
- babyreqs-0.2.1/babyreqs_gui/editor.py +27 -0
- babyreqs-0.2.1/babyreqs_gui/editor_base.py +563 -0
- babyreqs-0.2.1/babyreqs_gui/editor_edit.py +225 -0
- babyreqs-0.2.1/babyreqs_gui/editor_grid.py +341 -0
- babyreqs-0.2.1/babyreqs_gui/editor_repo.py +577 -0
- babyreqs-0.2.1/babyreqs_gui/editor_tree.py +227 -0
- babyreqs-0.2.1/babyreqs_gui/grid_view.py +152 -0
- babyreqs-0.2.1/babyreqs_gui/models.py +246 -0
- babyreqs-0.2.1/babyreqs_gui/renderers.py +160 -0
- babyreqs-0.2.1/babyreqs_gui/tree_view.py +67 -0
- babyreqs-0.2.1/pyproject.toml +37 -0
- babyreqs-0.2.1/setup.cfg +4 -0
- babyreqs-0.2.1/tests/test_babyreqs.py +596 -0
babyreqs-0.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: babyreqs
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Git-backed YAML requirements editor with Markdown, math and PlantUML support
|
|
5
|
+
Author: babyreqs contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: PyYAML>=6.0
|
|
10
|
+
Provides-Extra: gui
|
|
11
|
+
Requires-Dist: wxPython>=4.2; extra == "gui"
|
|
12
|
+
Provides-Extra: math
|
|
13
|
+
Requires-Dist: matplotlib>=3.7; extra == "math"
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
16
|
+
Requires-Dist: matplotlib>=3.7; extra == "dev"
|
|
17
|
+
Requires-Dist: pyinstaller>=6.0; extra == "dev"
|
|
18
|
+
Provides-Extra: all
|
|
19
|
+
Requires-Dist: wxPython>=4.2; extra == "all"
|
|
20
|
+
Requires-Dist: matplotlib>=3.7; extra == "all"
|
|
21
|
+
Provides-Extra: cli
|
|
22
|
+
Requires-Dist: PyYAML>=6.0; extra == "cli"
|
|
23
|
+
|
|
24
|
+
# babyreqs
|
|
25
|
+
|
|
26
|
+
A graphical editor for requirements stored as one `REQ-*.yaml` file per
|
|
27
|
+
requirement in a git repository. It also ships a headless CLI for validation
|
|
28
|
+
and export.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- Grid + hierarchy tree with status colours, status visibility and root/leaf
|
|
33
|
+
filter toggles, filtering and custom columns
|
|
34
|
+
- Markdown editing with math (`$...$`, `$$...$$`) and locally rendered
|
|
35
|
+
PlantUML diagrams
|
|
36
|
+
- Atomic saves with a diff preview and custom commit messages
|
|
37
|
+
- Commits restricted to requirement files; unrelated work is left untouched
|
|
38
|
+
- Unreadable requirement files are preserved, never silently deleted
|
|
39
|
+
- Requirement IDs are immutable: they are never renamed or removed
|
|
40
|
+
- CSV import/export and a PDF export with a contents page, links and outline
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Python 3.9+ and git are required.
|
|
45
|
+
|
|
46
|
+
### Prebuilt bundles (easiest for end users)
|
|
47
|
+
|
|
48
|
+
Download the archive for your platform from the repository's **Releases** page,
|
|
49
|
+
extract it, and run `babyreqs`. The bundles include Python, wxPython and
|
|
50
|
+
matplotlib, so no Python installation is needed. `git` is still required at
|
|
51
|
+
runtime because repositories are git-backed.
|
|
52
|
+
|
|
53
|
+
### Install with pip
|
|
54
|
+
|
|
55
|
+
The desktop editor is an optional extra because wxPython is large and may need
|
|
56
|
+
to compile on some Linux configurations:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install "babyreqs[gui]" # desktop editor + CLI
|
|
60
|
+
# or, in an isolated environment:
|
|
61
|
+
pipx install "babyreqs[gui]"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For the headless CLI only (no wxPython download):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install babyreqs
|
|
68
|
+
babyreqs-cli --help
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
From a checkout, install everything for development:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install -e ".[gui,math,dev]"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Optional extras:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install "babyreqs[math]" # rendered math images (matplotlib)
|
|
81
|
+
pip install "babyreqs[all]" # gui + math
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### PlantUML (local rendering only)
|
|
85
|
+
|
|
86
|
+
babyreqs never sends diagram text to a remote server. Use one of:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Option 1: plantuml on PATH
|
|
90
|
+
# Debian/Ubuntu: sudo apt install plantuml
|
|
91
|
+
# macOS: brew install plantuml
|
|
92
|
+
|
|
93
|
+
# Option 2: a plantuml.jar with Java
|
|
94
|
+
export BABYREQS_PLANTUML_JAR=/path/to/plantuml.jar
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Check the setup with `python babyreqs.py` → **Help > PlantUML Renderer Status**,
|
|
98
|
+
or `babyreqs-cli plantuml-status`.
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
### GUI
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
python babyreqs.py [path/to/repository]
|
|
106
|
+
# after pip install -e .:
|
|
107
|
+
babyreqs [path/to/repository]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### CLI
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
babyreqs-cli validate path/to/repository [--strict]
|
|
114
|
+
babyreqs-cli list path/to/repository [--status Active] [--json]
|
|
115
|
+
babyreqs-cli export path/to/repository --csv out.csv --pdf out.pdf --json out.json
|
|
116
|
+
babyreqs-cli init path/to/new-repository
|
|
117
|
+
babyreqs-cli plantuml-status
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The CLI does not import wxPython and is suitable for CI.
|
|
121
|
+
|
|
122
|
+
## File format
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
id: REQ-0001
|
|
126
|
+
title: Bridge shall support VLAN-aware forwarding
|
|
127
|
+
reference: IEEE 802.1Q-2022, Clause 6
|
|
128
|
+
status: Active
|
|
129
|
+
rationale: ''
|
|
130
|
+
parents:
|
|
131
|
+
- REQ-0002
|
|
132
|
+
notes: |
|
|
133
|
+
Notes may contain Markdown.
|
|
134
|
+
owner: Systems
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Only files named `REQ-*.yaml` (legacy `REQ_*.yaml` is also accepted) with an
|
|
138
|
+
`id` are editable. Files that match the name but cannot be parsed are reported as
|
|
139
|
+
warnings and preserved unchanged.
|
|
140
|
+
|
|
141
|
+
New repositories include an example `title.yaml` in the repository root. It
|
|
142
|
+
supplies title-page fields for PDF exports. `title` and `subtitle` are used as
|
|
143
|
+
the heading; other keys (or a nested `fields:` mapping) are printed as labelled
|
|
144
|
+
values. Use **File > Edit Title Page...** in the GUI to edit these fields;
|
|
145
|
+
saving writes and commits `title.yaml`.
|
|
146
|
+
|
|
147
|
+
## Development
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
pip install -e ".[gui,math,dev]"
|
|
151
|
+
python -m unittest discover -s tests -v
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Build a wheel/sdist:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
python -m build
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Build a standalone desktop bundle (run on the target OS):
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pyinstaller --noconfirm babyreqs.spec
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The `Release` GitHub Actions workflow runs the tests, publishes wheels to PyPI
|
|
167
|
+
on a `v*` tag, and attaches Windows/macOS/Linux bundles to the GitHub Release.
|
|
168
|
+
|
|
169
|
+
Code layout:
|
|
170
|
+
|
|
171
|
+
- `babyreqs.py` — entry point, dependency check and GUI/CLI dispatch
|
|
172
|
+
- `babyreqs_gui/` — wxPython GUI split into dialogs, renderers and editor mixins
|
|
173
|
+
- `babyreqs_cli.py` — headless command line interface
|
|
174
|
+
- `babyreqs_core/` — repository/YAML, Markdown, PDF and shared data structures
|
|
175
|
+
- `pdf.py` / `pdf_document.py` / `pdf_image.py` / `pdf_text.py` / `pdf_title.py` — PDF writer split into focused modules
|
babyreqs-0.2.1/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# babyreqs
|
|
2
|
+
|
|
3
|
+
A graphical editor for requirements stored as one `REQ-*.yaml` file per
|
|
4
|
+
requirement in a git repository. It also ships a headless CLI for validation
|
|
5
|
+
and export.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Grid + hierarchy tree with status colours, status visibility and root/leaf
|
|
10
|
+
filter toggles, filtering and custom columns
|
|
11
|
+
- Markdown editing with math (`$...$`, `$$...$$`) and locally rendered
|
|
12
|
+
PlantUML diagrams
|
|
13
|
+
- Atomic saves with a diff preview and custom commit messages
|
|
14
|
+
- Commits restricted to requirement files; unrelated work is left untouched
|
|
15
|
+
- Unreadable requirement files are preserved, never silently deleted
|
|
16
|
+
- Requirement IDs are immutable: they are never renamed or removed
|
|
17
|
+
- CSV import/export and a PDF export with a contents page, links and outline
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Python 3.9+ and git are required.
|
|
22
|
+
|
|
23
|
+
### Prebuilt bundles (easiest for end users)
|
|
24
|
+
|
|
25
|
+
Download the archive for your platform from the repository's **Releases** page,
|
|
26
|
+
extract it, and run `babyreqs`. The bundles include Python, wxPython and
|
|
27
|
+
matplotlib, so no Python installation is needed. `git` is still required at
|
|
28
|
+
runtime because repositories are git-backed.
|
|
29
|
+
|
|
30
|
+
### Install with pip
|
|
31
|
+
|
|
32
|
+
The desktop editor is an optional extra because wxPython is large and may need
|
|
33
|
+
to compile on some Linux configurations:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install "babyreqs[gui]" # desktop editor + CLI
|
|
37
|
+
# or, in an isolated environment:
|
|
38
|
+
pipx install "babyreqs[gui]"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For the headless CLI only (no wxPython download):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install babyreqs
|
|
45
|
+
babyreqs-cli --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
From a checkout, install everything for development:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install -e ".[gui,math,dev]"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Optional extras:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install "babyreqs[math]" # rendered math images (matplotlib)
|
|
58
|
+
pip install "babyreqs[all]" # gui + math
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### PlantUML (local rendering only)
|
|
62
|
+
|
|
63
|
+
babyreqs never sends diagram text to a remote server. Use one of:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Option 1: plantuml on PATH
|
|
67
|
+
# Debian/Ubuntu: sudo apt install plantuml
|
|
68
|
+
# macOS: brew install plantuml
|
|
69
|
+
|
|
70
|
+
# Option 2: a plantuml.jar with Java
|
|
71
|
+
export BABYREQS_PLANTUML_JAR=/path/to/plantuml.jar
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Check the setup with `python babyreqs.py` → **Help > PlantUML Renderer Status**,
|
|
75
|
+
or `babyreqs-cli plantuml-status`.
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
### GUI
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
python babyreqs.py [path/to/repository]
|
|
83
|
+
# after pip install -e .:
|
|
84
|
+
babyreqs [path/to/repository]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### CLI
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
babyreqs-cli validate path/to/repository [--strict]
|
|
91
|
+
babyreqs-cli list path/to/repository [--status Active] [--json]
|
|
92
|
+
babyreqs-cli export path/to/repository --csv out.csv --pdf out.pdf --json out.json
|
|
93
|
+
babyreqs-cli init path/to/new-repository
|
|
94
|
+
babyreqs-cli plantuml-status
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The CLI does not import wxPython and is suitable for CI.
|
|
98
|
+
|
|
99
|
+
## File format
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
id: REQ-0001
|
|
103
|
+
title: Bridge shall support VLAN-aware forwarding
|
|
104
|
+
reference: IEEE 802.1Q-2022, Clause 6
|
|
105
|
+
status: Active
|
|
106
|
+
rationale: ''
|
|
107
|
+
parents:
|
|
108
|
+
- REQ-0002
|
|
109
|
+
notes: |
|
|
110
|
+
Notes may contain Markdown.
|
|
111
|
+
owner: Systems
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Only files named `REQ-*.yaml` (legacy `REQ_*.yaml` is also accepted) with an
|
|
115
|
+
`id` are editable. Files that match the name but cannot be parsed are reported as
|
|
116
|
+
warnings and preserved unchanged.
|
|
117
|
+
|
|
118
|
+
New repositories include an example `title.yaml` in the repository root. It
|
|
119
|
+
supplies title-page fields for PDF exports. `title` and `subtitle` are used as
|
|
120
|
+
the heading; other keys (or a nested `fields:` mapping) are printed as labelled
|
|
121
|
+
values. Use **File > Edit Title Page...** in the GUI to edit these fields;
|
|
122
|
+
saving writes and commits `title.yaml`.
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pip install -e ".[gui,math,dev]"
|
|
128
|
+
python -m unittest discover -s tests -v
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Build a wheel/sdist:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
python -m build
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Build a standalone desktop bundle (run on the target OS):
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pyinstaller --noconfirm babyreqs.spec
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The `Release` GitHub Actions workflow runs the tests, publishes wheels to PyPI
|
|
144
|
+
on a `v*` tag, and attaches Windows/macOS/Linux bundles to the GitHub Release.
|
|
145
|
+
|
|
146
|
+
Code layout:
|
|
147
|
+
|
|
148
|
+
- `babyreqs.py` — entry point, dependency check and GUI/CLI dispatch
|
|
149
|
+
- `babyreqs_gui/` — wxPython GUI split into dialogs, renderers and editor mixins
|
|
150
|
+
- `babyreqs_cli.py` — headless command line interface
|
|
151
|
+
- `babyreqs_core/` — repository/YAML, Markdown, PDF and shared data structures
|
|
152
|
+
- `pdf.py` / `pdf_document.py` / `pdf_image.py` / `pdf_text.py` / `pdf_title.py` — PDF writer split into focused modules
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: babyreqs
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Git-backed YAML requirements editor with Markdown, math and PlantUML support
|
|
5
|
+
Author: babyreqs contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: PyYAML>=6.0
|
|
10
|
+
Provides-Extra: gui
|
|
11
|
+
Requires-Dist: wxPython>=4.2; extra == "gui"
|
|
12
|
+
Provides-Extra: math
|
|
13
|
+
Requires-Dist: matplotlib>=3.7; extra == "math"
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
16
|
+
Requires-Dist: matplotlib>=3.7; extra == "dev"
|
|
17
|
+
Requires-Dist: pyinstaller>=6.0; extra == "dev"
|
|
18
|
+
Provides-Extra: all
|
|
19
|
+
Requires-Dist: wxPython>=4.2; extra == "all"
|
|
20
|
+
Requires-Dist: matplotlib>=3.7; extra == "all"
|
|
21
|
+
Provides-Extra: cli
|
|
22
|
+
Requires-Dist: PyYAML>=6.0; extra == "cli"
|
|
23
|
+
|
|
24
|
+
# babyreqs
|
|
25
|
+
|
|
26
|
+
A graphical editor for requirements stored as one `REQ-*.yaml` file per
|
|
27
|
+
requirement in a git repository. It also ships a headless CLI for validation
|
|
28
|
+
and export.
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- Grid + hierarchy tree with status colours, status visibility and root/leaf
|
|
33
|
+
filter toggles, filtering and custom columns
|
|
34
|
+
- Markdown editing with math (`$...$`, `$$...$$`) and locally rendered
|
|
35
|
+
PlantUML diagrams
|
|
36
|
+
- Atomic saves with a diff preview and custom commit messages
|
|
37
|
+
- Commits restricted to requirement files; unrelated work is left untouched
|
|
38
|
+
- Unreadable requirement files are preserved, never silently deleted
|
|
39
|
+
- Requirement IDs are immutable: they are never renamed or removed
|
|
40
|
+
- CSV import/export and a PDF export with a contents page, links and outline
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Python 3.9+ and git are required.
|
|
45
|
+
|
|
46
|
+
### Prebuilt bundles (easiest for end users)
|
|
47
|
+
|
|
48
|
+
Download the archive for your platform from the repository's **Releases** page,
|
|
49
|
+
extract it, and run `babyreqs`. The bundles include Python, wxPython and
|
|
50
|
+
matplotlib, so no Python installation is needed. `git` is still required at
|
|
51
|
+
runtime because repositories are git-backed.
|
|
52
|
+
|
|
53
|
+
### Install with pip
|
|
54
|
+
|
|
55
|
+
The desktop editor is an optional extra because wxPython is large and may need
|
|
56
|
+
to compile on some Linux configurations:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install "babyreqs[gui]" # desktop editor + CLI
|
|
60
|
+
# or, in an isolated environment:
|
|
61
|
+
pipx install "babyreqs[gui]"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For the headless CLI only (no wxPython download):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install babyreqs
|
|
68
|
+
babyreqs-cli --help
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
From a checkout, install everything for development:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install -e ".[gui,math,dev]"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Optional extras:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install "babyreqs[math]" # rendered math images (matplotlib)
|
|
81
|
+
pip install "babyreqs[all]" # gui + math
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### PlantUML (local rendering only)
|
|
85
|
+
|
|
86
|
+
babyreqs never sends diagram text to a remote server. Use one of:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Option 1: plantuml on PATH
|
|
90
|
+
# Debian/Ubuntu: sudo apt install plantuml
|
|
91
|
+
# macOS: brew install plantuml
|
|
92
|
+
|
|
93
|
+
# Option 2: a plantuml.jar with Java
|
|
94
|
+
export BABYREQS_PLANTUML_JAR=/path/to/plantuml.jar
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Check the setup with `python babyreqs.py` → **Help > PlantUML Renderer Status**,
|
|
98
|
+
or `babyreqs-cli plantuml-status`.
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
### GUI
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
python babyreqs.py [path/to/repository]
|
|
106
|
+
# after pip install -e .:
|
|
107
|
+
babyreqs [path/to/repository]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### CLI
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
babyreqs-cli validate path/to/repository [--strict]
|
|
114
|
+
babyreqs-cli list path/to/repository [--status Active] [--json]
|
|
115
|
+
babyreqs-cli export path/to/repository --csv out.csv --pdf out.pdf --json out.json
|
|
116
|
+
babyreqs-cli init path/to/new-repository
|
|
117
|
+
babyreqs-cli plantuml-status
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The CLI does not import wxPython and is suitable for CI.
|
|
121
|
+
|
|
122
|
+
## File format
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
id: REQ-0001
|
|
126
|
+
title: Bridge shall support VLAN-aware forwarding
|
|
127
|
+
reference: IEEE 802.1Q-2022, Clause 6
|
|
128
|
+
status: Active
|
|
129
|
+
rationale: ''
|
|
130
|
+
parents:
|
|
131
|
+
- REQ-0002
|
|
132
|
+
notes: |
|
|
133
|
+
Notes may contain Markdown.
|
|
134
|
+
owner: Systems
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Only files named `REQ-*.yaml` (legacy `REQ_*.yaml` is also accepted) with an
|
|
138
|
+
`id` are editable. Files that match the name but cannot be parsed are reported as
|
|
139
|
+
warnings and preserved unchanged.
|
|
140
|
+
|
|
141
|
+
New repositories include an example `title.yaml` in the repository root. It
|
|
142
|
+
supplies title-page fields for PDF exports. `title` and `subtitle` are used as
|
|
143
|
+
the heading; other keys (or a nested `fields:` mapping) are printed as labelled
|
|
144
|
+
values. Use **File > Edit Title Page...** in the GUI to edit these fields;
|
|
145
|
+
saving writes and commits `title.yaml`.
|
|
146
|
+
|
|
147
|
+
## Development
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
pip install -e ".[gui,math,dev]"
|
|
151
|
+
python -m unittest discover -s tests -v
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Build a wheel/sdist:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
python -m build
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Build a standalone desktop bundle (run on the target OS):
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pyinstaller --noconfirm babyreqs.spec
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The `Release` GitHub Actions workflow runs the tests, publishes wheels to PyPI
|
|
167
|
+
on a `v*` tag, and attaches Windows/macOS/Linux bundles to the GitHub Release.
|
|
168
|
+
|
|
169
|
+
Code layout:
|
|
170
|
+
|
|
171
|
+
- `babyreqs.py` — entry point, dependency check and GUI/CLI dispatch
|
|
172
|
+
- `babyreqs_gui/` — wxPython GUI split into dialogs, renderers and editor mixins
|
|
173
|
+
- `babyreqs_cli.py` — headless command line interface
|
|
174
|
+
- `babyreqs_core/` — repository/YAML, Markdown, PDF and shared data structures
|
|
175
|
+
- `pdf.py` / `pdf_document.py` / `pdf_image.py` / `pdf_text.py` / `pdf_title.py` — PDF writer split into focused modules
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
babyreqs.py
|
|
3
|
+
babyreqs_cli.py
|
|
4
|
+
pyproject.toml
|
|
5
|
+
babyreqs.egg-info/PKG-INFO
|
|
6
|
+
babyreqs.egg-info/SOURCES.txt
|
|
7
|
+
babyreqs.egg-info/dependency_links.txt
|
|
8
|
+
babyreqs.egg-info/entry_points.txt
|
|
9
|
+
babyreqs.egg-info/requires.txt
|
|
10
|
+
babyreqs.egg-info/top_level.txt
|
|
11
|
+
babyreqs_core/__init__.py
|
|
12
|
+
babyreqs_core/common.py
|
|
13
|
+
babyreqs_core/documentation.py
|
|
14
|
+
babyreqs_core/errors.py
|
|
15
|
+
babyreqs_core/git.py
|
|
16
|
+
babyreqs_core/markdown.py
|
|
17
|
+
babyreqs_core/markdown_model.py
|
|
18
|
+
babyreqs_core/markdown_renderers.py
|
|
19
|
+
babyreqs_core/model.py
|
|
20
|
+
babyreqs_core/pdf.py
|
|
21
|
+
babyreqs_core/pdf_document.py
|
|
22
|
+
babyreqs_core/pdf_image.py
|
|
23
|
+
babyreqs_core/pdf_text.py
|
|
24
|
+
babyreqs_core/pdf_title.py
|
|
25
|
+
babyreqs_core/repository.py
|
|
26
|
+
babyreqs_core/version.py
|
|
27
|
+
babyreqs_gui/__init__.py
|
|
28
|
+
babyreqs_gui/constants.py
|
|
29
|
+
babyreqs_gui/dialogs.py
|
|
30
|
+
babyreqs_gui/editor.py
|
|
31
|
+
babyreqs_gui/editor_base.py
|
|
32
|
+
babyreqs_gui/editor_edit.py
|
|
33
|
+
babyreqs_gui/editor_grid.py
|
|
34
|
+
babyreqs_gui/editor_repo.py
|
|
35
|
+
babyreqs_gui/editor_tree.py
|
|
36
|
+
babyreqs_gui/grid_view.py
|
|
37
|
+
babyreqs_gui/models.py
|
|
38
|
+
babyreqs_gui/renderers.py
|
|
39
|
+
babyreqs_gui/tree_view.py
|
|
40
|
+
tests/test_babyreqs.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""babyreqs graphical requirements editor.
|
|
3
|
+
|
|
4
|
+
The GUI depends on wxPython; headless commands should use ``babyreqs_cli`` and
|
|
5
|
+
the ``babyreqs_core`` package instead.
|
|
6
|
+
|
|
7
|
+
The window implementation lives in the :mod:`babyreqs_gui` package. This module
|
|
8
|
+
keeps the dependency check and the command-line entry point.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
MIN_PYTHON = (3, 9)
|
|
16
|
+
REQUIRED_PYTHON_PACKAGES = {
|
|
17
|
+
"wx": "wxPython",
|
|
18
|
+
"yaml": "PyYAML",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _runtime_check() -> None:
|
|
23
|
+
"""Fail fast with clear messages for unsupported runtime environments."""
|
|
24
|
+
if sys.version_info < MIN_PYTHON:
|
|
25
|
+
current = ".".join(str(part) for part in sys.version_info[:3])
|
|
26
|
+
required = ".".join(str(part) for part in MIN_PYTHON)
|
|
27
|
+
sys.stderr.write(f"babyreqs requires Python {required}+ (found {current}).\n")
|
|
28
|
+
raise SystemExit(1)
|
|
29
|
+
|
|
30
|
+
missing = []
|
|
31
|
+
for module_name, package_name in REQUIRED_PYTHON_PACKAGES.items():
|
|
32
|
+
try:
|
|
33
|
+
__import__(module_name)
|
|
34
|
+
except Exception as exc:
|
|
35
|
+
missing.append(f" - {package_name} (import {module_name!r} failed: {exc})")
|
|
36
|
+
|
|
37
|
+
if missing:
|
|
38
|
+
sys.stderr.write(
|
|
39
|
+
"babyreqs is missing required Python dependencies:\n"
|
|
40
|
+
+ "\n".join(missing)
|
|
41
|
+
+ "\n\nThe graphical editor is an optional extra. Install it with:\n"
|
|
42
|
+
+ " pip install \"babyreqs[gui]\"\n"
|
|
43
|
+
+ "\nFor the headless CLI alone:\n"
|
|
44
|
+
+ " pip install babyreqs\n"
|
|
45
|
+
)
|
|
46
|
+
raise SystemExit(1)
|
|
47
|
+
|
|
48
|
+
import shutil
|
|
49
|
+
|
|
50
|
+
if shutil.which("git") is None:
|
|
51
|
+
sys.stderr.write("babyreqs requires git to be installed and available on PATH.\n")
|
|
52
|
+
raise SystemExit(1)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
_runtime_check()
|
|
56
|
+
|
|
57
|
+
import wx
|
|
58
|
+
|
|
59
|
+
from babyreqs_gui import RequirementsEditor
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def main(argv: list[str] | None = None) -> int:
|
|
63
|
+
args = list(sys.argv[1:] if argv is None else argv)
|
|
64
|
+
app = wx.App(False)
|
|
65
|
+
# wxGTK occasionally emits a harmless debug message when the menu bar gets
|
|
66
|
+
# a spurious focus-out event (e.g. on the first click into the grid). Keep
|
|
67
|
+
# warnings and errors, but hide debug-level noise.
|
|
68
|
+
wx.Log.SetLogLevel(wx.LOG_Warning)
|
|
69
|
+
frame = RequirementsEditor(initial_repo_path=args[0] if args else None)
|
|
70
|
+
frame.Show()
|
|
71
|
+
app.MainLoop()
|
|
72
|
+
return 0
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
raise SystemExit(main())
|