Metadata-Version: 2.5
Name: p4n4-lib
Version: 0.2.0
Summary: Shared library between P4N4 stacks and clients
Project-URL: Homepage, https://github.com/raisga/p4n4-lib
Project-URL: Documentation, https://github.com/raisga/p4n4-docs
Project-URL: Issues, https://github.com/raisga/p4n4-lib/issues
Author-email: RAISGA <jraleman@raisga.com>
License: MIT
License-File: LICENSE
Keywords: docker,edge-ai,iot,library
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Requires-Dist: pyyaml>=6
Provides-Extra: dev
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Description-Content-Type: text/markdown

# p4n4-lib

Shared Python library mediating between P4N4 stacks and clients
(`p4n4-cli`, `p4n4-api`, `p4n4-dashboard`).

Framework-free by design: no CLI/TUI/web dependencies, only `pyyaml`.
Presentation (prompts, tables, colors) stays in the clients.

## Modules

| Module | Purpose |
|--------|---------|
| `p4n4_lib.manifest` | `.p4n4.json` manifest: find (walk-up), load, save, create, and checks for the optional `dashboard` block |
| `p4n4_lib.env` | Dotenv read/write, template-preserving writes |
| `p4n4_lib.layers` | Layer registry: repo URLs, copy paths, required files/env keys per layer (`iot`, `ai`, `edge`, `dashboard`) |
| `p4n4_lib.layout` | Project layout: flat for single-layer projects, per-layer subdirectories for multi-layer |
| `p4n4_lib.scaffold` | Fetch stack sources (local path or shallow clone) and copy into a project |
| `p4n4_lib.validate` | Pure project validation returning (passed, errors) check lists; template projects are checked against their `.env.example` instead of the base stack |
| `p4n4_lib.secrets` | Token generation and the rotatable-key policy |
| `p4n4_lib.compose` | Docker Compose subprocess wrappers (`up`, `down`, `ps`, `logs`) |

Stack repo URLs live in `p4n4_lib/sources.yaml`.

## Install

```bash
pip install p4n4-lib
pip install -e path/to/core/lib           # monorepo development
```

See [CHANGELOG.md](https://github.com/raisga/p4n4-lib/blob/main/CHANGELOG.md) for release notes.

## Development

```bash
pip install -e ".[dev]"
pytest
ruff check .
```

## License

MIT
