uboa 0.1.0__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.
- uboa-0.1.0/AUTHORS +6 -0
- uboa-0.1.0/LICENSE +21 -0
- uboa-0.1.0/MANIFEST.in +8 -0
- uboa-0.1.0/PKG-INFO +208 -0
- uboa-0.1.0/README.md +177 -0
- uboa-0.1.0/doc/fig/uboa_configuration_ingestion_flow.svg +108 -0
- uboa-0.1.0/doc/fig/uboa_database_initialization_flow.svg +494 -0
- uboa-0.1.0/doc/fig/uboa_operations_overview_flow.svg +469 -0
- uboa-0.1.0/doc/fig/uboa_users_roles_flow.svg +108 -0
- uboa-0.1.0/doc/fig/uboadb.png +0 -0
- uboa-0.1.0/doc/publishing.md +71 -0
- uboa-0.1.0/pyproject.toml +73 -0
- uboa-0.1.0/setup.cfg +4 -0
- uboa-0.1.0/src/uboa/__init__.py +0 -0
- uboa-0.1.0/src/uboa/common/__init__.py +1 -0
- uboa-0.1.0/src/uboa/common/commands.py +19 -0
- uboa-0.1.0/src/uboa/config/engine.json +7 -0
- uboa-0.1.0/src/uboa/config/uboa_datamodel.json +12 -0
- uboa-0.1.0/src/uboa/config/users.json +57 -0
- uboa-0.1.0/src/uboa/datamodel/__init__.py +0 -0
- uboa-0.1.0/src/uboa/datamodel/base.py +28 -0
- uboa-0.1.0/src/uboa/datamodel/errors.py +20 -0
- uboa-0.1.0/src/uboa/datamodel/functions.py +41 -0
- uboa-0.1.0/src/uboa/datamodel/uboa_data_model.dbm +277 -0
- uboa-0.1.0/src/uboa/datamodel/uboa_data_model.sql +185 -0
- uboa-0.1.0/src/uboa/datamodel/users.py +175 -0
- uboa-0.1.0/src/uboa/debugging.py +62 -0
- uboa-0.1.0/src/uboa/engine/__init__.py +0 -0
- uboa-0.1.0/src/uboa/engine/engine.py +637 -0
- uboa-0.1.0/src/uboa/engine/errors.py +98 -0
- uboa-0.1.0/src/uboa/engine/functions.py +97 -0
- uboa-0.1.0/src/uboa/engine/operators.py +36 -0
- uboa-0.1.0/src/uboa/engine/parsing.py +159 -0
- uboa-0.1.0/src/uboa/engine/printing.py +45 -0
- uboa-0.1.0/src/uboa/engine/query.py +457 -0
- uboa-0.1.0/src/uboa/logging.py +118 -0
- uboa-0.1.0/src/uboa/scripts/__init__.py +0 -0
- uboa-0.1.0/src/uboa/scripts/initialize_uboa_ddbb.sh +4 -0
- uboa-0.1.0/src/uboa/scripts/start_uboa.sh +3 -0
- uboa-0.1.0/src/uboa/scripts/uboa_init.py +110 -0
- uboa-0.1.0/src/uboa/scripts/uboa_init_ddbb.sh +79 -0
- uboa-0.1.0/src/uboa.egg-info/PKG-INFO +208 -0
- uboa-0.1.0/src/uboa.egg-info/SOURCES.txt +46 -0
- uboa-0.1.0/src/uboa.egg-info/dependency_links.txt +1 -0
- uboa-0.1.0/src/uboa.egg-info/requires.txt +11 -0
- uboa-0.1.0/src/uboa.egg-info/top_level.txt +1 -0
- uboa-0.1.0/tools/check_distribution.py +129 -0
- uboa-0.1.0/tools/check_installed_resources.py +66 -0
uboa-0.1.0/AUTHORS
ADDED
uboa-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Brosnan Blázquez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
uboa-0.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
include README.md LICENSE AUTHORS
|
|
2
|
+
include doc/publishing.md tools/check_distribution.py tools/check_installed_resources.py
|
|
3
|
+
recursive-include doc/fig *.svg *.png
|
|
4
|
+
recursive-include src/uboa/config *.json
|
|
5
|
+
recursive-include src/uboa/datamodel *.sql *.dbm
|
|
6
|
+
recursive-include src/uboa/scripts *.sh
|
|
7
|
+
prune src/tests
|
|
8
|
+
global-exclude __pycache__ *.py[cod] .*.swp
|
uboa-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: uboa
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Users management for Business Operation Analysis
|
|
5
|
+
Author-email: Daniel Brosnan <d.brosnan.b@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/danielbrosnan/uboa
|
|
8
|
+
Project-URL: Repository, https://github.com/danielbrosnan/uboa
|
|
9
|
+
Project-URL: Issues, https://github.com/danielbrosnan/uboa/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Topic :: Database
|
|
16
|
+
Requires-Python: <3.12,>=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
License-File: AUTHORS
|
|
20
|
+
Requires-Dist: sqlalchemy==1.3.22
|
|
21
|
+
Requires-Dist: psycopg2-binary==2.9.11
|
|
22
|
+
Requires-Dist: flask-security-too==4.1.6
|
|
23
|
+
Requires-Dist: setuptools<81,>=77.0.3
|
|
24
|
+
Requires-Dist: Flask==2.2.5
|
|
25
|
+
Requires-Dist: Werkzeug==3.0.6
|
|
26
|
+
Provides-Extra: tests
|
|
27
|
+
Requires-Dist: pytest<9,>=7; extra == "tests"
|
|
28
|
+
Requires-Dist: before_after==1.0.1; extra == "tests"
|
|
29
|
+
Requires-Dist: pytest-cov==7.0.0; extra == "tests"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# UBOA: Users management for Business Operation Analysis
|
|
33
|
+
|
|
34
|
+
UBOA is the user-management component of the BOA suite. It loads users and roles
|
|
35
|
+
from JSON configuration and stores them in PostgreSQL. Its SQLAlchemy models
|
|
36
|
+
integrate with Flask-Security.
|
|
37
|
+
|
|
38
|
+
## Operation Flow Schematics
|
|
39
|
+
|
|
40
|
+
### Operations Overview
|
|
41
|
+
|
|
42
|
+
UBOA initializes the users database, loads users and roles from JSON, and
|
|
43
|
+
exposes filtered queries through its SQLAlchemy models. Applications use
|
|
44
|
+
the persisted users and roles with Flask-Security.
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+
### Database Initialization
|
|
49
|
+
|
|
50
|
+
`uboa_init.py` confirms the reset, resolves the database settings and SQL model,
|
|
51
|
+
and invokes `uboa_init_ddbb.sh`. Active database sessions prevent the reset.
|
|
52
|
+
After loading the schema, it optionally loads the users configuration; `-n`
|
|
53
|
+
skips this step. A user-loading failure leaves the database reset in place.
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
### Configuration Ingestion
|
|
58
|
+
|
|
59
|
+
`Engine.insert_configuration()` reads and validates the JSON structure, then
|
|
60
|
+
processes operations in input order. `erase_and_insert` clears mapped tables
|
|
61
|
+
before insertion, so a later rollback does not restore those rows. Selecting
|
|
62
|
+
`force_insert` keeps forced updates enabled on that Engine instance. Handled
|
|
63
|
+
insertion errors produce operation statuses and processing continues.
|
|
64
|
+
|
|
65
|
+

|
|
66
|
+
|
|
67
|
+
### Role and User Insertion
|
|
68
|
+
|
|
69
|
+
Each operation resolves declared and referenced roles before processing users
|
|
70
|
+
and their role assignments. Forced user updates require matching email and
|
|
71
|
+
username, preserve the stored password, and replace role assignments. Handled
|
|
72
|
+
insertion errors roll back the insertion transaction and return an error status.
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+
## Database model
|
|
77
|
+
|
|
78
|
+

|
|
79
|
+
|
|
80
|
+
## Repository structure
|
|
81
|
+
|
|
82
|
+
The layout follows SBOA and the conventions of the BOA suite:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
src/
|
|
86
|
+
uboa/
|
|
87
|
+
common/ # Standalone command execution helpers
|
|
88
|
+
config/ # Logging, database and users configuration templates
|
|
89
|
+
datamodel/ # SQLAlchemy models and PostgreSQL SQL model
|
|
90
|
+
engine/ # Users configuration, validation and query API
|
|
91
|
+
scripts/ # Database initialization and development startup
|
|
92
|
+
tests/
|
|
93
|
+
unit/ # Database-free model, validation, CLI and runtime tests
|
|
94
|
+
integration/ # PostgreSQL query and update regression tests
|
|
95
|
+
json_inputs/ # Users configuration test fixtures
|
|
96
|
+
doc/
|
|
97
|
+
fig/ # Database schema and SVG operation flow diagrams
|
|
98
|
+
publishing.md
|
|
99
|
+
tools/ # Distribution and installed-resource checks
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Package metadata and the release version live in `pyproject.toml`. Runtime
|
|
103
|
+
assets are bundled inside `uboa`; tests stay in `src/tests` and are excluded
|
|
104
|
+
from both the wheel and source distribution.
|
|
105
|
+
|
|
106
|
+
## Install
|
|
107
|
+
|
|
108
|
+
Install UBOA and its test dependencies from this checkout:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
python -m pip install -e '.[tests]'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The distribution provides `uboa_init.py`, `uboa_init_ddbb.sh` and the development
|
|
115
|
+
helpers `initialize_uboa_ddbb.sh` and `start_uboa.sh`. SQL models and configuration
|
|
116
|
+
templates can be located with `importlib.resources.files("uboa")`.
|
|
117
|
+
|
|
118
|
+
## Configuration
|
|
119
|
+
|
|
120
|
+
Configure a UBOA resource directory with your database and users settings:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
export UBOA_DATA_PATH="$(python -c 'from importlib.resources import files; print(files("uboa"))')"
|
|
124
|
+
export UBOA_RESOURCES_PATH="$PWD/uboa-state"
|
|
125
|
+
export UBOA_LOG_PATH="$PWD/uboa-log"
|
|
126
|
+
mkdir -p "$UBOA_RESOURCES_PATH" "$UBOA_LOG_PATH"
|
|
127
|
+
cp "$UBOA_DATA_PATH"/config/* "$UBOA_RESOURCES_PATH/"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
`UBOA_RESOURCES_PATH` contains `engine.json`, `uboa_datamodel.json` and
|
|
131
|
+
`users.json`. It defaults to the bundled `uboa/config` directory. An explicitly
|
|
132
|
+
configured directory must exist. Put customized UBOA configuration files in
|
|
133
|
+
`UBOA_RESOURCES_PATH`.
|
|
134
|
+
|
|
135
|
+
Logging uses `engine.json` in `UBOA_RESOURCES_PATH`. Set `UBOA_LOG_PATH` to the
|
|
136
|
+
log directory (default `/tmp/uboa_log`); UBOA creates it when needed.
|
|
137
|
+
`UBOA_LOG_LEVEL`, `UBOA_LOG_MAX_BYTES` and `UBOA_LOG_MAX_BACKUP` override the
|
|
138
|
+
JSON logging settings. Set `UBOA_STREAM_LOG` to also log to the console.
|
|
139
|
+
|
|
140
|
+
Set `UBOA_DDBB_HOST` for the users database host. Initialize it with
|
|
141
|
+
`uboa_init.py`; use `-n` to omit loading the bundled users template or
|
|
142
|
+
`-u /path/to/users.json` to load a custom configuration. Review `users.json`
|
|
143
|
+
before using it outside development.
|
|
144
|
+
|
|
145
|
+
Database initializers require the PostgreSQL client (`psql`). They use the
|
|
146
|
+
bundled SQL model by default and accept `-f /path/to/model.sql` to override it.
|
|
147
|
+
`uboa_init.py` requests confirmation before resetting a database.
|
|
148
|
+
`initialize_uboa_ddbb.sh` accepts the reset automatically for development tests.
|
|
149
|
+
|
|
150
|
+
## Development and tests
|
|
151
|
+
|
|
152
|
+
Run the database-free tests and generate a coverage report from the repository
|
|
153
|
+
root after installing the test dependencies:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
python -m pytest -m 'not integration' --cov=uboa --cov-report=term-missing --cov-report=html
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Open `src/tests/tmp/code_coverage_analysis/index.html` for the detailed report.
|
|
160
|
+
Tests that require PostgreSQL carry the `integration` marker. They use the
|
|
161
|
+
dedicated `uboadb` database and clear user-management tables between tests.
|
|
162
|
+
The full suite covers every statement and branch in `uboa`. The integration
|
|
163
|
+
workflow enforces 100% coverage; the database-free subset reports its own
|
|
164
|
+
coverage without this threshold.
|
|
165
|
+
|
|
166
|
+
Start the local development environment and run the complete suite:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
UID_HOST_USER=$(id -u) GID_HOST_USER=$(id -g) docker compose -f compose_dev.yml up --build -d --wait
|
|
170
|
+
docker compose -f compose_dev.yml exec -T uboa bash -ec 'initialize_uboa_ddbb.sh; cd /uboa; python -m pytest -v src/tests --cov=uboa --cov-report=term-missing --cov-report=html --cov-fail-under=100'
|
|
171
|
+
docker compose -f compose_dev.yml down -v
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`Dockerfile.dev` builds the current checkout and installs UBOA in editable mode.
|
|
175
|
+
Compose mounts the checkout at `/uboa`, so source and test edits are visible
|
|
176
|
+
immediately. Rebuild after changing dependencies. The container runs as the
|
|
177
|
+
`boa` user with the selected host user and group IDs. Configuration in
|
|
178
|
+
`/resources_path` links to the checkout's UBOA templates. The database has no
|
|
179
|
+
published host ports and joins `boa_network`.
|
|
180
|
+
|
|
181
|
+
For the GitHub development environment:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
REPOSITORY_URI=https://github.com/danielbrosnan/uboa.git GITHUB_BRANCH=develop \
|
|
185
|
+
docker compose -f compose_github_dev.yml up --build -d --wait
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`Dockerfile.github.dev` clones the selected repository and branch. Keep
|
|
189
|
+
`REPOSITORY_URI` and `GITHUB_BRANCH` set for subsequent Compose commands.
|
|
190
|
+
The `uboa-testing.yml` workflow uses this environment. Neither environment
|
|
191
|
+
requires a sibling EBOA checkout.
|
|
192
|
+
|
|
193
|
+
With dependencies and configuration available locally, run `python -m pytest`
|
|
194
|
+
from the repository root, or `cd src && python -m pytest tests/`.
|
|
195
|
+
|
|
196
|
+
## Build and publish
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
python -m pip install build twine
|
|
200
|
+
python -m build
|
|
201
|
+
python -m twine check --strict dist/*
|
|
202
|
+
python tools/check_distribution.py dist
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Start with an empty `dist` directory for each build. The packaging workflow
|
|
206
|
+
checks installed wheels and source distributions on Python 3.9 and 3.11 and
|
|
207
|
+
runs the database-free tests. See [Publishing UBOA](doc/publishing.md) for
|
|
208
|
+
release instructions and installed-resource checks.
|
uboa-0.1.0/README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# UBOA: Users management for Business Operation Analysis
|
|
2
|
+
|
|
3
|
+
UBOA is the user-management component of the BOA suite. It loads users and roles
|
|
4
|
+
from JSON configuration and stores them in PostgreSQL. Its SQLAlchemy models
|
|
5
|
+
integrate with Flask-Security.
|
|
6
|
+
|
|
7
|
+
## Operation Flow Schematics
|
|
8
|
+
|
|
9
|
+
### Operations Overview
|
|
10
|
+
|
|
11
|
+
UBOA initializes the users database, loads users and roles from JSON, and
|
|
12
|
+
exposes filtered queries through its SQLAlchemy models. Applications use
|
|
13
|
+
the persisted users and roles with Flask-Security.
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
### Database Initialization
|
|
18
|
+
|
|
19
|
+
`uboa_init.py` confirms the reset, resolves the database settings and SQL model,
|
|
20
|
+
and invokes `uboa_init_ddbb.sh`. Active database sessions prevent the reset.
|
|
21
|
+
After loading the schema, it optionally loads the users configuration; `-n`
|
|
22
|
+
skips this step. A user-loading failure leaves the database reset in place.
|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
### Configuration Ingestion
|
|
27
|
+
|
|
28
|
+
`Engine.insert_configuration()` reads and validates the JSON structure, then
|
|
29
|
+
processes operations in input order. `erase_and_insert` clears mapped tables
|
|
30
|
+
before insertion, so a later rollback does not restore those rows. Selecting
|
|
31
|
+
`force_insert` keeps forced updates enabled on that Engine instance. Handled
|
|
32
|
+
insertion errors produce operation statuses and processing continues.
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
### Role and User Insertion
|
|
37
|
+
|
|
38
|
+
Each operation resolves declared and referenced roles before processing users
|
|
39
|
+
and their role assignments. Forced user updates require matching email and
|
|
40
|
+
username, preserve the stored password, and replace role assignments. Handled
|
|
41
|
+
insertion errors roll back the insertion transaction and return an error status.
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
## Database model
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
## Repository structure
|
|
50
|
+
|
|
51
|
+
The layout follows SBOA and the conventions of the BOA suite:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
src/
|
|
55
|
+
uboa/
|
|
56
|
+
common/ # Standalone command execution helpers
|
|
57
|
+
config/ # Logging, database and users configuration templates
|
|
58
|
+
datamodel/ # SQLAlchemy models and PostgreSQL SQL model
|
|
59
|
+
engine/ # Users configuration, validation and query API
|
|
60
|
+
scripts/ # Database initialization and development startup
|
|
61
|
+
tests/
|
|
62
|
+
unit/ # Database-free model, validation, CLI and runtime tests
|
|
63
|
+
integration/ # PostgreSQL query and update regression tests
|
|
64
|
+
json_inputs/ # Users configuration test fixtures
|
|
65
|
+
doc/
|
|
66
|
+
fig/ # Database schema and SVG operation flow diagrams
|
|
67
|
+
publishing.md
|
|
68
|
+
tools/ # Distribution and installed-resource checks
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Package metadata and the release version live in `pyproject.toml`. Runtime
|
|
72
|
+
assets are bundled inside `uboa`; tests stay in `src/tests` and are excluded
|
|
73
|
+
from both the wheel and source distribution.
|
|
74
|
+
|
|
75
|
+
## Install
|
|
76
|
+
|
|
77
|
+
Install UBOA and its test dependencies from this checkout:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python -m pip install -e '.[tests]'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The distribution provides `uboa_init.py`, `uboa_init_ddbb.sh` and the development
|
|
84
|
+
helpers `initialize_uboa_ddbb.sh` and `start_uboa.sh`. SQL models and configuration
|
|
85
|
+
templates can be located with `importlib.resources.files("uboa")`.
|
|
86
|
+
|
|
87
|
+
## Configuration
|
|
88
|
+
|
|
89
|
+
Configure a UBOA resource directory with your database and users settings:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
export UBOA_DATA_PATH="$(python -c 'from importlib.resources import files; print(files("uboa"))')"
|
|
93
|
+
export UBOA_RESOURCES_PATH="$PWD/uboa-state"
|
|
94
|
+
export UBOA_LOG_PATH="$PWD/uboa-log"
|
|
95
|
+
mkdir -p "$UBOA_RESOURCES_PATH" "$UBOA_LOG_PATH"
|
|
96
|
+
cp "$UBOA_DATA_PATH"/config/* "$UBOA_RESOURCES_PATH/"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`UBOA_RESOURCES_PATH` contains `engine.json`, `uboa_datamodel.json` and
|
|
100
|
+
`users.json`. It defaults to the bundled `uboa/config` directory. An explicitly
|
|
101
|
+
configured directory must exist. Put customized UBOA configuration files in
|
|
102
|
+
`UBOA_RESOURCES_PATH`.
|
|
103
|
+
|
|
104
|
+
Logging uses `engine.json` in `UBOA_RESOURCES_PATH`. Set `UBOA_LOG_PATH` to the
|
|
105
|
+
log directory (default `/tmp/uboa_log`); UBOA creates it when needed.
|
|
106
|
+
`UBOA_LOG_LEVEL`, `UBOA_LOG_MAX_BYTES` and `UBOA_LOG_MAX_BACKUP` override the
|
|
107
|
+
JSON logging settings. Set `UBOA_STREAM_LOG` to also log to the console.
|
|
108
|
+
|
|
109
|
+
Set `UBOA_DDBB_HOST` for the users database host. Initialize it with
|
|
110
|
+
`uboa_init.py`; use `-n` to omit loading the bundled users template or
|
|
111
|
+
`-u /path/to/users.json` to load a custom configuration. Review `users.json`
|
|
112
|
+
before using it outside development.
|
|
113
|
+
|
|
114
|
+
Database initializers require the PostgreSQL client (`psql`). They use the
|
|
115
|
+
bundled SQL model by default and accept `-f /path/to/model.sql` to override it.
|
|
116
|
+
`uboa_init.py` requests confirmation before resetting a database.
|
|
117
|
+
`initialize_uboa_ddbb.sh` accepts the reset automatically for development tests.
|
|
118
|
+
|
|
119
|
+
## Development and tests
|
|
120
|
+
|
|
121
|
+
Run the database-free tests and generate a coverage report from the repository
|
|
122
|
+
root after installing the test dependencies:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
python -m pytest -m 'not integration' --cov=uboa --cov-report=term-missing --cov-report=html
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Open `src/tests/tmp/code_coverage_analysis/index.html` for the detailed report.
|
|
129
|
+
Tests that require PostgreSQL carry the `integration` marker. They use the
|
|
130
|
+
dedicated `uboadb` database and clear user-management tables between tests.
|
|
131
|
+
The full suite covers every statement and branch in `uboa`. The integration
|
|
132
|
+
workflow enforces 100% coverage; the database-free subset reports its own
|
|
133
|
+
coverage without this threshold.
|
|
134
|
+
|
|
135
|
+
Start the local development environment and run the complete suite:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
UID_HOST_USER=$(id -u) GID_HOST_USER=$(id -g) docker compose -f compose_dev.yml up --build -d --wait
|
|
139
|
+
docker compose -f compose_dev.yml exec -T uboa bash -ec 'initialize_uboa_ddbb.sh; cd /uboa; python -m pytest -v src/tests --cov=uboa --cov-report=term-missing --cov-report=html --cov-fail-under=100'
|
|
140
|
+
docker compose -f compose_dev.yml down -v
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`Dockerfile.dev` builds the current checkout and installs UBOA in editable mode.
|
|
144
|
+
Compose mounts the checkout at `/uboa`, so source and test edits are visible
|
|
145
|
+
immediately. Rebuild after changing dependencies. The container runs as the
|
|
146
|
+
`boa` user with the selected host user and group IDs. Configuration in
|
|
147
|
+
`/resources_path` links to the checkout's UBOA templates. The database has no
|
|
148
|
+
published host ports and joins `boa_network`.
|
|
149
|
+
|
|
150
|
+
For the GitHub development environment:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
REPOSITORY_URI=https://github.com/danielbrosnan/uboa.git GITHUB_BRANCH=develop \
|
|
154
|
+
docker compose -f compose_github_dev.yml up --build -d --wait
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`Dockerfile.github.dev` clones the selected repository and branch. Keep
|
|
158
|
+
`REPOSITORY_URI` and `GITHUB_BRANCH` set for subsequent Compose commands.
|
|
159
|
+
The `uboa-testing.yml` workflow uses this environment. Neither environment
|
|
160
|
+
requires a sibling EBOA checkout.
|
|
161
|
+
|
|
162
|
+
With dependencies and configuration available locally, run `python -m pytest`
|
|
163
|
+
from the repository root, or `cd src && python -m pytest tests/`.
|
|
164
|
+
|
|
165
|
+
## Build and publish
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
python -m pip install build twine
|
|
169
|
+
python -m build
|
|
170
|
+
python -m twine check --strict dist/*
|
|
171
|
+
python tools/check_distribution.py dist
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Start with an empty `dist` directory for each build. The packaging workflow
|
|
175
|
+
checks installed wheels and source distributions on Python 3.9 and 3.11 and
|
|
176
|
+
runs the database-free tests. See [Publishing UBOA](doc/publishing.md) for
|
|
177
|
+
release instructions and installed-resource checks.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1420" height="1560" viewBox="0 0 1420 1560" role="img" aria-labelledby="title desc">
|
|
3
|
+
<title id="title">UBOA Configuration Ingestion Flow</title>
|
|
4
|
+
<desc id="desc">Engine.insert_configuration reads and validates users JSON, then treat_data processes supported operations in order and returns a list of operation statuses. Clearing precedes insertion and force_insert persists on the Engine instance.</desc>
|
|
5
|
+
<defs>
|
|
6
|
+
<style>
|
|
7
|
+
.bg { fill: #f8fafc; }
|
|
8
|
+
.lane { fill: #ffffff; stroke: #dbe4ec; stroke-width: 1.5; }
|
|
9
|
+
.box { fill: #ffffff; stroke: #304c62; stroke-width: 2; }
|
|
10
|
+
.blue { fill: #e8f2ff; stroke: #2c6aa0; }
|
|
11
|
+
.green { fill: #e8f7ef; stroke: #2f7d55; }
|
|
12
|
+
.amber { fill: #fff6df; stroke: #a56a13; }
|
|
13
|
+
.gray { fill: #eef2f5; stroke: #596b7a; }
|
|
14
|
+
.red { fill: #fff0ef; stroke: #a33b32; }
|
|
15
|
+
text { font-family: Arial, Helvetica, sans-serif; fill: #1f2d38; }
|
|
16
|
+
.title { font-size: 34px; font-weight: 700; fill: #1d2c38; }
|
|
17
|
+
.subtitle { font-size: 18px; fill: #435363; }
|
|
18
|
+
.section { font-size: 18px; font-weight: 700; fill: #435363; }
|
|
19
|
+
.node-title { font-size: 21px; font-weight: 600; text-anchor: middle; }
|
|
20
|
+
.small { font-size: 18px; fill: #435363; text-anchor: middle; }
|
|
21
|
+
.label { font-size: 17px; font-weight: 700; text-anchor: middle; paint-order: stroke; stroke: #f8fafc; stroke-width: 6; stroke-linejoin: round; }
|
|
22
|
+
.arrow { stroke: #304c62; stroke-width: 2.5; fill: none; marker-end: url(#arrowhead); }
|
|
23
|
+
.arrow-red { stroke: #a33b32; stroke-width: 2.5; fill: none; marker-end: url(#arrowhead-red); }
|
|
24
|
+
.arrow-soft { stroke: #7b8a98; stroke-width: 2.5; fill: none; stroke-dasharray: 8 6; marker-end: url(#arrowhead-soft); }
|
|
25
|
+
</style>
|
|
26
|
+
<marker id="arrowhead" viewBox="0 0 12 10" refX="11" refY="5" markerWidth="12" markerHeight="10" markerUnits="userSpaceOnUse" orient="auto">
|
|
27
|
+
<path d="M0 0 L12 5 L0 10 Z" fill="#304c62"/>
|
|
28
|
+
</marker>
|
|
29
|
+
<marker id="arrowhead-red" viewBox="0 0 12 10" refX="11" refY="5" markerWidth="12" markerHeight="10" markerUnits="userSpaceOnUse" orient="auto">
|
|
30
|
+
<path d="M0 0 L12 5 L0 10 Z" fill="#a33b32"/>
|
|
31
|
+
</marker>
|
|
32
|
+
<marker id="arrowhead-soft" viewBox="0 0 12 10" refX="11" refY="5" markerWidth="12" markerHeight="10" markerUnits="userSpaceOnUse" orient="auto">
|
|
33
|
+
<path d="M0 0 L12 5 L0 10 Z" fill="#7b8a98"/>
|
|
34
|
+
</marker>
|
|
35
|
+
</defs>
|
|
36
|
+
<rect class="bg" width="1420" height="1560"/>
|
|
37
|
+
<text class="title" x="60" y="64" text-anchor="start">Configuration Ingestion Flow</text>
|
|
38
|
+
<text class="subtitle" x="60" y="100" text-anchor="start">Validate the JSON structure before processing its list of user and role operations.</text>
|
|
39
|
+
<rect class="box blue" x="500" y="145" width="420" height="110" rx="12"/>
|
|
40
|
+
<text class="node-title" x="710.0" y="181.0">Load a users configuration</text>
|
|
41
|
+
<text class="small" x="710.0" y="207.0">Engine.insert_configuration(path)</text>
|
|
42
|
+
<text class="small" x="710.0" y="233.0">default: config_path("users.json")</text>
|
|
43
|
+
<rect class="box blue" x="500" y="310" width="420" height="100" rx="12"/>
|
|
44
|
+
<text class="node-title" x="710.0" y="354.0">Read and parse the JSON file</text>
|
|
45
|
+
<text class="small" x="710.0" y="380.0">parse_data_from_json()</text>
|
|
46
|
+
<polygon class="box amber" points="710,440.0 910.0,510 710,580.0 510.0,510"/>
|
|
47
|
+
<text class="node-title" x="710" y="504">Configuration</text>
|
|
48
|
+
<text class="node-title" x="710" y="530">structure valid?</text>
|
|
49
|
+
<rect class="box red" x="1010" y="450" width="350" height="130" rx="12"/>
|
|
50
|
+
<text class="node-title" x="1185.0" y="483.0">Return a file error status</text>
|
|
51
|
+
<text class="small" x="1185.0" y="509.0">missing or malformed JSON</text>
|
|
52
|
+
<text class="small" x="1185.0" y="535.0">or an invalid input structure</text>
|
|
53
|
+
<text class="small" x="1185.0" y="561.0">no operations are applied</text>
|
|
54
|
+
<rect class="box gray" x="60" y="405" width="350" height="190" rx="12"/>
|
|
55
|
+
<text class="node-title" x="235.0" y="455.0">Structure checks</text>
|
|
56
|
+
<text class="small" x="235.0" y="481.0">operations is a list of dictionaries</text>
|
|
57
|
+
<text class="small" x="235.0" y="507.0">each operation has a valid mode</text>
|
|
58
|
+
<text class="small" x="235.0" y="533.0">user fields and role declarations</text>
|
|
59
|
+
<text class="small" x="235.0" y="559.0">must have the expected types</text>
|
|
60
|
+
<rect class="box blue" x="500" y="640" width="420" height="100" rx="12"/>
|
|
61
|
+
<text class="node-title" x="710.0" y="684.0">Process the next operation</text>
|
|
62
|
+
<text class="small" x="710.0" y="710.0">treat_data(); preserve input order</text>
|
|
63
|
+
<polygon class="box amber" points="710,780.0 910.0,850 710,920.0 510.0,850"/>
|
|
64
|
+
<text class="node-title" x="710" y="857">Operation mode?</text>
|
|
65
|
+
<rect class="box amber" x="60" y="790" width="350" height="120" rx="12"/>
|
|
66
|
+
<text class="node-title" x="235.0" y="831.0">erase_and_insert</text>
|
|
67
|
+
<text class="small" x="235.0" y="857.0">clear all mapped tables</text>
|
|
68
|
+
<text class="small" x="235.0" y="883.0">before starting the insertion</text>
|
|
69
|
+
<rect class="box amber" x="1010" y="790" width="350" height="120" rx="12"/>
|
|
70
|
+
<text class="node-title" x="1185.0" y="831.0">force_insert</text>
|
|
71
|
+
<text class="small" x="1185.0" y="857.0">enable updates of existing records</text>
|
|
72
|
+
<text class="small" x="1185.0" y="883.0">on this Engine instance</text>
|
|
73
|
+
<rect class="box blue" x="500" y="1040" width="420" height="110" rx="12"/>
|
|
74
|
+
<text class="node-title" x="710.0" y="1076.0">Insert roles, then users</text>
|
|
75
|
+
<text class="small" x="710.0" y="1102.0">_insert_data()</text>
|
|
76
|
+
<text class="small" x="710.0" y="1128.0">create or update role associations</text>
|
|
77
|
+
<rect class="box gray" x="500" y="1200" width="420" height="100" rx="12"/>
|
|
78
|
+
<text class="node-title" x="710.0" y="1244.0">Append the operation status</text>
|
|
79
|
+
<text class="small" x="710.0" y="1270.0">OK or a handled insertion error</text>
|
|
80
|
+
<polygon class="box amber" points="710,1325.0 910.0,1395 710,1465.0 510.0,1395"/>
|
|
81
|
+
<text class="node-title" x="710" y="1402">More operations?</text>
|
|
82
|
+
<rect class="box green" x="1010" y="1345" width="350" height="100" rx="12"/>
|
|
83
|
+
<text class="node-title" x="1185.0" y="1389.0">Return the status list</text>
|
|
84
|
+
<text class="small" x="1185.0" y="1415.0">one entry per processed operation</text>
|
|
85
|
+
<path class="arrow" d="M710 255 V310"/>
|
|
86
|
+
<path class="arrow-red" d="M920 360 H970 V480 H1010"/>
|
|
87
|
+
<text class="label" x="970" y="339">read error</text>
|
|
88
|
+
<path class="arrow" d="M710 410 V440"/>
|
|
89
|
+
<path class="arrow-red" d="M910 510 H1010"/>
|
|
90
|
+
<text class="label" x="960" y="490">no</text>
|
|
91
|
+
<path class="arrow" d="M710 580 V640"/>
|
|
92
|
+
<text class="label" x="740" y="612">yes</text>
|
|
93
|
+
<path class="arrow" d="M710 740 V780"/>
|
|
94
|
+
<path class="arrow" d="M510 850 H410"/>
|
|
95
|
+
<path class="arrow" d="M910 850 H1010"/>
|
|
96
|
+
<path class="arrow" d="M710 920 V1040"/>
|
|
97
|
+
<text class="label" x="750" y="983">insert</text>
|
|
98
|
+
<path class="arrow" d="M235 910 V1095 H500"/>
|
|
99
|
+
<path class="arrow" d="M1185 910 V1095 H920"/>
|
|
100
|
+
<path class="arrow" d="M710 1150 V1200"/>
|
|
101
|
+
<path class="arrow" d="M710 1300 V1325"/>
|
|
102
|
+
<path class="arrow" d="M510 1395 H30 V690 H500"/>
|
|
103
|
+
<text class="label" x="475" y="1375">yes</text>
|
|
104
|
+
<path class="arrow" d="M910 1395 H1010"/>
|
|
105
|
+
<text class="label" x="960" y="1375">no</text>
|
|
106
|
+
<text class="small" x="710" y="1500">Cleared rows are not restored by a later insertion rollback; the file is not one atomic transaction.</text>
|
|
107
|
+
<text class="small" x="710" y="1530">Once force_insert is selected, forced updates stay enabled on that Engine instance.</text>
|
|
108
|
+
</svg>
|