plesty-sdk 0.0.2.dev10__tar.gz → 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.
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/.gitignore +1 -0
- plesty_sdk-0.1.0/.gitlab-ci.yml +40 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/PKG-INFO +7 -3
- plesty_sdk-0.1.0/docs/commands/check.md +56 -0
- plesty_sdk-0.1.0/docs/commands/docs.md +71 -0
- plesty_sdk-0.1.0/docs/commands/init.md +103 -0
- plesty_sdk-0.1.0/docs/commands/license.md +42 -0
- plesty_sdk-0.1.0/docs/commands/manual.md +77 -0
- plesty_sdk-0.1.0/docs/commands/update.md +58 -0
- plesty_sdk-0.1.0/docs/getting-started.md +90 -0
- plesty_sdk-0.1.0/docs/index.md +37 -0
- plesty_sdk-0.1.0/docs/toc.yaml +4 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/gitlab-ci.yml +41 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/copier.yml +32 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/extras/device/base_device.py +67 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/extras/device/device.py +21 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/.gitignore +51 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/COPYING +674 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/LICENSE +184 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/LICENSES/GPL-3.0-or-later.txt +674 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/LICENSES/LGPL-3.0-or-later.txt +165 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/README.md.jinja +22 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/docs/index.md +1 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/plesty/{{module_name}}/__init__.py.jinja +16 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/plesty/{{module_name}}/__main__.py.jinja +35 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/pyproject.toml.jinja +60 -0
- plesty_sdk-0.1.0/plesty_sdk/assets/templates/template/spdx.tmpl.jinja +4 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/cache.py +43 -26
- plesty_sdk-0.1.0/plesty_sdk/cli.py +52 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/commands/check.py +34 -14
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/commands/docs/__init__.py +3 -5
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/commands/docs/deploy.py +74 -48
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/commands/docs/serve.py +15 -12
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/commands/docs/sphinx_builder.py +56 -52
- plesty_sdk-0.1.0/plesty_sdk/commands/init.py +245 -0
- plesty_sdk-0.1.0/plesty_sdk/commands/license.py +179 -0
- plesty_sdk-0.0.2.dev10/plesty_sdk/commands/docs/generate.py → plesty_sdk-0.1.0/plesty_sdk/commands/manual.py +115 -88
- plesty_sdk-0.1.0/plesty_sdk/commands/update.py +159 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/context.py +62 -26
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/pyproject.toml +15 -16
- plesty_sdk-0.1.0/tests/__init__.py +1 -0
- plesty_sdk-0.1.0/tests/test_cache.py +107 -0
- plesty_sdk-0.1.0/tests/test_cli.py +51 -0
- plesty_sdk-0.1.0/tests/test_context.py +158 -0
- plesty_sdk-0.1.0/tests/test_init.py +291 -0
- plesty_sdk-0.1.0/tests/test_license.py +135 -0
- plesty_sdk-0.1.0/tests/test_manual.py +262 -0
- plesty_sdk-0.1.0/tests/test_update.py +224 -0
- plesty_sdk-0.0.2.dev10/.gitlab-ci.yml +0 -4
- plesty_sdk-0.0.2.dev10/docs/index.md +0 -0
- plesty_sdk-0.0.2.dev10/docs/toc.yaml +0 -3
- plesty_sdk-0.0.2.dev10/docs/usage/index.md +0 -1
- plesty_sdk-0.0.2.dev10/plesty_sdk/assets/docs-build-gitlab-ci.yml +0 -11
- plesty_sdk-0.0.2.dev10/plesty_sdk/cli.py +0 -26
- plesty_sdk-0.0.2.dev10/plesty_sdk/commands/build.py +0 -243
- plesty_sdk-0.0.2.dev10/plesty_sdk/commands/license.py +0 -191
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/COPYING +0 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/COPYING.LESSER +0 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/LICENSE +0 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/README.md +0 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/__init__.py +0 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/assets/logos/plesty_icon.png +0 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/assets/logos/plesty_logo.png +0 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/assets/ruff.toml +0 -0
- {plesty_sdk-0.0.2.dev10 → plesty_sdk-0.1.0}/plesty_sdk/commands/__init__.py +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- check
|
|
3
|
+
- test
|
|
4
|
+
- build
|
|
5
|
+
- release
|
|
6
|
+
- deploy
|
|
7
|
+
|
|
8
|
+
variables:
|
|
9
|
+
# Required for versioningit: the runner must fetch full Git history and tags.
|
|
10
|
+
GIT_DEPTH: "0"
|
|
11
|
+
|
|
12
|
+
include:
|
|
13
|
+
# Check compliance with Plesty standard
|
|
14
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/check-compliance@main
|
|
15
|
+
inputs:
|
|
16
|
+
stage: check
|
|
17
|
+
|
|
18
|
+
# Run tests
|
|
19
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/run-tests@main
|
|
20
|
+
inputs:
|
|
21
|
+
stage: test
|
|
22
|
+
|
|
23
|
+
# Build Python package and expose dist/ as an artifact
|
|
24
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/build-pkg@main
|
|
25
|
+
inputs:
|
|
26
|
+
stage: build
|
|
27
|
+
job_name: build-pkg
|
|
28
|
+
|
|
29
|
+
# Publish package to PyPI on release tags
|
|
30
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/publish-pypi@main
|
|
31
|
+
inputs:
|
|
32
|
+
stage: release
|
|
33
|
+
pypi_token: $PYPI_TOKEN
|
|
34
|
+
build_job_name: build-pkg
|
|
35
|
+
|
|
36
|
+
# Deploy documentation to dedicated documentation branch
|
|
37
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/deploy-docs@main
|
|
38
|
+
inputs:
|
|
39
|
+
stage: deploy
|
|
40
|
+
access_token: $CI_BOT_TOKEN
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plesty-sdk
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: Command-line application for developing Python modules compliant with the Plesty standard.
|
|
5
5
|
Author: Plesty Development Team
|
|
6
6
|
License-File: COPYING
|
|
7
7
|
License-File: COPYING.LESSER
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Python: >=3.12
|
|
10
|
+
Requires-Dist: bluesky>=1.14.6
|
|
10
11
|
Requires-Dist: click>=3.8
|
|
12
|
+
Requires-Dist: copier>=9.15.1
|
|
13
|
+
Requires-Dist: licenseheaders>=0.8.8
|
|
11
14
|
Requires-Dist: livereload>=2.7.1
|
|
12
15
|
Requires-Dist: md2pdf>=3.1.1
|
|
13
16
|
Requires-Dist: myst-parser>=5.0.0
|
|
14
17
|
Requires-Dist: pydata-sphinx-theme==0.17.1
|
|
18
|
+
Requires-Dist: pytest>=9.0.0
|
|
15
19
|
Requires-Dist: ruff>=0.14
|
|
16
20
|
Requires-Dist: sphinx-autoapi>=3.6.1
|
|
17
21
|
Requires-Dist: sphinx-copybutton>=0.5.2
|
|
@@ -20,8 +24,8 @@ Requires-Dist: sphinx-external-toc>=1.1.0
|
|
|
20
24
|
Requires-Dist: sphinx>=9.1.0
|
|
21
25
|
Requires-Dist: sphinxcontrib-mermaid>=2.0.0
|
|
22
26
|
Requires-Dist: watchfiles>=1.1.1
|
|
23
|
-
Provides-Extra:
|
|
24
|
-
Requires-Dist:
|
|
27
|
+
Provides-Extra: gui
|
|
28
|
+
Requires-Dist: pyside6-essentials>=6.11.0; extra == 'gui'
|
|
25
29
|
Description-Content-Type: text/markdown
|
|
26
30
|
|
|
27
31
|
# plesty-sdk - Setting the Coding Standard
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# plesty check
|
|
2
|
+
|
|
3
|
+
Validates a project against a Plesty compliance standard. Runs the `ruff` linter and checks
|
|
4
|
+
GUI and device-specific requirements depending on the chosen level.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
plesty check [--standard LEVEL] [--device]
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Options
|
|
11
|
+
|
|
12
|
+
| Option | Default | Description |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| `--standard` | `pixel` | Compliance level: `pixel`, `nebula`, or `quantum` |
|
|
15
|
+
| `--device` | off | Also run device-specific compliance checks |
|
|
16
|
+
|
|
17
|
+
## Compliance levels
|
|
18
|
+
|
|
19
|
+
### Pixel
|
|
20
|
+
|
|
21
|
+
The entry-level standard. Covers the essentials every Plesty module must have:
|
|
22
|
+
|
|
23
|
+
- Code hygiene: the project must pass `ruff` linting rules.
|
|
24
|
+
- Repository structure: required files and directories are present.
|
|
25
|
+
- Documented example: at least one usage example exists.
|
|
26
|
+
|
|
27
|
+
### Nebula
|
|
28
|
+
|
|
29
|
+
Everything in Pixel, plus:
|
|
30
|
+
|
|
31
|
+
- Extended documentation requirements.
|
|
32
|
+
- Data standard compliance.
|
|
33
|
+
- Basic interface checks (if applicable).
|
|
34
|
+
- Partial testing coverage.
|
|
35
|
+
- GUI structure is validated if a GUI is present.
|
|
36
|
+
|
|
37
|
+
### Quantum
|
|
38
|
+
|
|
39
|
+
The highest standard, intended for actively maintained production modules:
|
|
40
|
+
|
|
41
|
+
- Full check of all standardisation goals.
|
|
42
|
+
- Complete interface and version management requirements.
|
|
43
|
+
- Dependency management and maintenance indicators.
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Default Pixel check in the current directory
|
|
49
|
+
plesty check
|
|
50
|
+
|
|
51
|
+
# Nebula check including device-specific rules
|
|
52
|
+
plesty check --standard nebula --device
|
|
53
|
+
|
|
54
|
+
# Quantum check on a project in another directory
|
|
55
|
+
plesty --project-dir ../plesty-power-meter-device check --standard quantum --device
|
|
56
|
+
```
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# plesty docs
|
|
2
|
+
|
|
3
|
+
Build, preview, and deploy the Sphinx documentation for a Plesty project.
|
|
4
|
+
|
|
5
|
+
## Subcommands
|
|
6
|
+
|
|
7
|
+
- `plesty docs serve` — local preview with live reload
|
|
8
|
+
- `plesty docs deploy` — publish to a remote pages branch
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## serve
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
plesty docs serve [--dev-addr IP:PORT]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Starts a local web server that renders the project documentation and automatically reloads
|
|
19
|
+
whenever a `.md` or `.rst` file changes. Useful during active documentation writing.
|
|
20
|
+
|
|
21
|
+
### Options
|
|
22
|
+
|
|
23
|
+
| Option | Default | Description |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `--dev-addr` | `127.0.0.1:8000` | Host and port for the preview server |
|
|
26
|
+
|
|
27
|
+
### Example
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Default address
|
|
31
|
+
plesty docs serve
|
|
32
|
+
|
|
33
|
+
# Listen on all interfaces at a custom port
|
|
34
|
+
plesty docs serve --dev-addr 0.0.0.0:9000
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Press **Ctrl+C** to stop the server.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## deploy
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
plesty docs deploy --remote-url URL --target-branch BRANCH [--release]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Builds the Sphinx documentation and pushes it to the specified branch on a remote repository,
|
|
48
|
+
suitable for GitLab Pages or GitHub Pages.
|
|
49
|
+
|
|
50
|
+
### Options
|
|
51
|
+
|
|
52
|
+
| Option | Default | Description |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `--remote-url` | required | Git remote URL to push the built docs to |
|
|
55
|
+
| `--target-branch` | required | Branch that serves the documentation pages |
|
|
56
|
+
| `--release` | off | Build as a versioned release; without this flag the docs are published as the latest development snapshot |
|
|
57
|
+
|
|
58
|
+
### Example
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Deploy development snapshot
|
|
62
|
+
plesty docs deploy \
|
|
63
|
+
--remote-url git@gitlab.com:plesty/my-device.git \
|
|
64
|
+
--target-branch pages
|
|
65
|
+
|
|
66
|
+
# Deploy a versioned release
|
|
67
|
+
plesty docs deploy \
|
|
68
|
+
--remote-url git@gitlab.com:plesty/my-device.git \
|
|
69
|
+
--target-branch pages \
|
|
70
|
+
--release
|
|
71
|
+
```
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# plesty init
|
|
2
|
+
|
|
3
|
+
Initialize a new Plesty project from the official template. The project is created in the
|
|
4
|
+
directory specified by the global `--project-dir` option (defaults to the current working
|
|
5
|
+
directory), making the standard workflow as simple as:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
mkdir plesty-my-device && cd plesty-my-device
|
|
9
|
+
plesty init device
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
plesty init [PROJECT_TYPE] [OPTIONS]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`PROJECT_TYPE` is one of `device` or `experiment` (default: `default`, not yet available).
|
|
17
|
+
|
|
18
|
+
## Naming conventions
|
|
19
|
+
|
|
20
|
+
All Plesty projects follow a consistent naming scheme derived from the module name
|
|
21
|
+
(e.g. `foo_bar`):
|
|
22
|
+
|
|
23
|
+
| Artifact | Convention | Example |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| Project folder | `plesty-<kebab-name>` | `plesty-foo-bar` |
|
|
26
|
+
| Source folder | `<module_name>` | `foo_bar` |
|
|
27
|
+
| PyPI distribution | `plesty-<kebab-name>` | `plesty-foo-bar` |
|
|
28
|
+
| Python import | `plesty.<module_name>` | `plesty.foo_bar` |
|
|
29
|
+
|
|
30
|
+
The `plesty-` prefix in the folder name is automatically stripped when inferring the module
|
|
31
|
+
name, so `plesty-foo-bar` → `foo_bar` without needing `--name`.
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
| Option | Default | Description |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `--name` | inferred | Python module name — lowercase letters, digits, and `_` only (e.g. `foo_bar`). Inferred from the directory name by stripping the `plesty-` prefix and converting hyphens to underscores. |
|
|
38
|
+
| `--author` | `John Doe` | Author name written into `pyproject.toml` and `spdx.tmpl` |
|
|
39
|
+
| `--email` | `john.doe@example.com` | Author email written into `pyproject.toml` and `spdx.tmpl` |
|
|
40
|
+
| `--ci-stages` | all stages | Comma-separated pipeline stages to include in `.gitlab-ci.yml`. Pass `""` to omit the CI file. |
|
|
41
|
+
|
|
42
|
+
### Available CI stages
|
|
43
|
+
|
|
44
|
+
`check`, `test`, `build`, `release`, `deploy`
|
|
45
|
+
|
|
46
|
+
## Directory rules
|
|
47
|
+
|
|
48
|
+
- If `--project-dir` does not exist it is created automatically.
|
|
49
|
+
- If it already exists it must be empty (hidden entries such as `.git` are ignored).
|
|
50
|
+
|
|
51
|
+
## Examples
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Minimal: module name inferred from directory, all CI stages, default author
|
|
55
|
+
mkdir plesty-power-meter && cd plesty-power-meter
|
|
56
|
+
plesty init device
|
|
57
|
+
|
|
58
|
+
# Explicit name and author
|
|
59
|
+
plesty --project-dir ~/projects/plesty-power-meter init device \
|
|
60
|
+
--name power_meter \
|
|
61
|
+
--author "Jane Doe" \
|
|
62
|
+
--email jane@example.com
|
|
63
|
+
|
|
64
|
+
# Only include check and build stages in CI
|
|
65
|
+
plesty --project-dir ~/projects/plesty-scan-exp init experiment \
|
|
66
|
+
--name scan_exp \
|
|
67
|
+
--ci-stages "check,build"
|
|
68
|
+
|
|
69
|
+
# Skip CI file entirely
|
|
70
|
+
plesty --project-dir ~/projects/plesty-internal-tool init device \
|
|
71
|
+
--name internal_tool \
|
|
72
|
+
--ci-stages ""
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Generated project layout
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
plesty-foo-bar/
|
|
79
|
+
├── foo_bar/
|
|
80
|
+
│ ├── __init__.py
|
|
81
|
+
│ └── __main__.py
|
|
82
|
+
│ └── base_device.py # device only
|
|
83
|
+
│ └── device.py # device only
|
|
84
|
+
├── docs/
|
|
85
|
+
│ └── index.md
|
|
86
|
+
├── .gitlab-ci.yml # omitted when --ci-stages ""
|
|
87
|
+
├── .gitignore
|
|
88
|
+
├── COPYING
|
|
89
|
+
├── LICENSE
|
|
90
|
+
├── LICENSES/
|
|
91
|
+
├── pyproject.toml
|
|
92
|
+
├── README.md
|
|
93
|
+
└── spdx.tmpl
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The `pyproject.toml` is pre-configured with:
|
|
97
|
+
- The PyPI distribution name `plesty-foo-bar` (kebab-case, no project-type suffix)
|
|
98
|
+
- A hatchling sources mapping so the package installs under the `plesty` namespace (`import plesty.foo_bar`)
|
|
99
|
+
- Dynamic versioning via `versioningit`
|
|
100
|
+
- `plesty-lib` as a dependency
|
|
101
|
+
- Sphinx docs settings under `[tool.plesty.docs]`
|
|
102
|
+
|
|
103
|
+
Use `plesty update` to change author info, the PyPI name, or CI stages after initialisation.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# plesty license
|
|
2
|
+
|
|
3
|
+
Manage SPDX license headers across a project's Python source files.
|
|
4
|
+
|
|
5
|
+
## update
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
plesty license update
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Reads author and maintainer metadata from the project's `pyproject.toml`, updates the
|
|
12
|
+
`spdx.tmpl` template in the project root, and applies LGPL-3.0 license headers to every
|
|
13
|
+
`.py` file using [licenseheaders](https://github.com/johann-petrak/licenseheaders).
|
|
14
|
+
|
|
15
|
+
The following directories are excluded automatically: `.venv`, `build`, `dist`, `.git`.
|
|
16
|
+
|
|
17
|
+
### Prerequisites
|
|
18
|
+
|
|
19
|
+
A `spdx.tmpl` file must exist in the project root. It is generated automatically by
|
|
20
|
+
`plesty init`, but you can also create one manually.
|
|
21
|
+
|
|
22
|
+
The `pyproject.toml` must contain at least one entry in `[project].authors` (with `name`
|
|
23
|
+
and `email`) and one entry in `[project].maintainers` (with `name`).
|
|
24
|
+
|
|
25
|
+
### Example
|
|
26
|
+
|
|
27
|
+
```toml
|
|
28
|
+
# pyproject.toml
|
|
29
|
+
[project]
|
|
30
|
+
authors = [{ name = "Jane Doe", email = "jane@example.com" }]
|
|
31
|
+
maintainers = [{ name = "Jane Doe" }]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
plesty license update
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
To update headers in a project outside the current directory:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
plesty --project-dir ../my-device license update
|
|
42
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# plesty manual
|
|
2
|
+
|
|
3
|
+
Generate reference manuals from an external device package's `DocDevice` class.
|
|
4
|
+
|
|
5
|
+
## generate
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
plesty manual generate [--module-name MODULE] [--output-dir PATH] [--with-pdf]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Imports the device package from the project directory set via `--project-dir` (defaults to
|
|
12
|
+
the current working directory), instantiates its `DocDevice` (or `Device` as a fallback),
|
|
13
|
+
and calls `.summary()` to produce Markdown reference files. Optionally renders PDF versions
|
|
14
|
+
using [md2pdf](https://github.com/jmaupetit/md2pdf).
|
|
15
|
+
|
|
16
|
+
```{note}
|
|
17
|
+
PDF generation requires the `libpango` system library (a dependency of `weasyprint`/`md2pdf`).
|
|
18
|
+
Install it via your system package manager before using `--with-pdf`:
|
|
19
|
+
`brew install pango` on macOS, `apt install libpango-1.0-0` on Debian/Ubuntu.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Options
|
|
23
|
+
|
|
24
|
+
| Option | Default | Description |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `--module-name` | inferred | Python module that exposes `DocDevice`. Defaults to the folder name with `-` replaced by `_` |
|
|
27
|
+
| `--output-dir` | `<project-dir>/manual` | Directory where generated files are written |
|
|
28
|
+
| `--with-pdf` | off | Also render PDF files from the generated Markdown |
|
|
29
|
+
|
|
30
|
+
### Output files
|
|
31
|
+
|
|
32
|
+
| File | Layout |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `short.md` / `short.pdf` | Compact parameter list — portrait A4 |
|
|
35
|
+
| `table.md` / `table.pdf` | Full parameter table — landscape A4 |
|
|
36
|
+
|
|
37
|
+
### Module resolution
|
|
38
|
+
|
|
39
|
+
The command attempts to import the module in this order:
|
|
40
|
+
|
|
41
|
+
1. The value of `--module-name` if provided.
|
|
42
|
+
2. The folder name of the project directory with `-` replaced by `_`.
|
|
43
|
+
3. Any module discovered via `__init__.py` files under the project directory.
|
|
44
|
+
|
|
45
|
+
If the module exposes `DocDevice`, that is used. If only `Device` is found, it is used with
|
|
46
|
+
a warning. The class is instantiated automatically if needed.
|
|
47
|
+
|
|
48
|
+
### Examples
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Generate Markdown manuals (run from inside the device project)
|
|
52
|
+
cd ../ape-pulse-slicer
|
|
53
|
+
plesty manual generate
|
|
54
|
+
|
|
55
|
+
# Or point directly at the project directory
|
|
56
|
+
plesty --project-dir ../ape-pulse-slicer manual generate
|
|
57
|
+
|
|
58
|
+
# Generate with PDF output
|
|
59
|
+
plesty --project-dir ../ape-pulse-slicer manual generate --with-pdf
|
|
60
|
+
|
|
61
|
+
# Override the inferred module name and output directory
|
|
62
|
+
plesty --project-dir ../ape-pulse-slicer manual generate \
|
|
63
|
+
--module-name ape_pulse_slicer.doc \
|
|
64
|
+
--output-dir ./manuals
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### DocDevice interface
|
|
68
|
+
|
|
69
|
+
The device class must expose a `summary` method with the following signature:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
def summary(self, *, style: str, filename: str) -> None:
|
|
73
|
+
...
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`style` is either `"short"` or `"md"`. The method should write the generated Markdown to
|
|
77
|
+
`filename`.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# plesty update
|
|
2
|
+
|
|
3
|
+
Update metadata in an existing Plesty project. Only the options you provide are changed;
|
|
4
|
+
everything else is left as-is.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
plesty update [OPTIONS]
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Operates on the directory set by the global `--project-dir` option (defaults to the current
|
|
11
|
+
working directory).
|
|
12
|
+
|
|
13
|
+
## Options
|
|
14
|
+
|
|
15
|
+
| Option | Description |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `--author TEXT` | New author name — updates `[project].authors[0].name` in `pyproject.toml` and `Author:` in `spdx.tmpl` |
|
|
18
|
+
| `--email TEXT` | New author email — updates `[project].authors[0].email` in `pyproject.toml` and `Email:` in `spdx.tmpl` |
|
|
19
|
+
| `--name NAME` | New PyPI distribution name — updates `[project].name` in `pyproject.toml` |
|
|
20
|
+
| `--ci-stages STAGES` | Comma-separated pipeline stages — regenerates `.gitlab-ci.yml`. Pass `""` to remove the CI file. |
|
|
21
|
+
|
|
22
|
+
At least one option must be provided.
|
|
23
|
+
|
|
24
|
+
### Available CI stages
|
|
25
|
+
|
|
26
|
+
`check`, `test`, `build`, `release`, `deploy`
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Change author and email
|
|
32
|
+
plesty update --author "Jane Doe" --email jane@example.com
|
|
33
|
+
|
|
34
|
+
# Rename the PyPI distribution
|
|
35
|
+
plesty update --name plesty-pm100d-device
|
|
36
|
+
|
|
37
|
+
# Narrow the CI pipeline to check + build only
|
|
38
|
+
plesty update --ci-stages "check,build"
|
|
39
|
+
|
|
40
|
+
# Remove the CI file
|
|
41
|
+
plesty update --ci-stages ""
|
|
42
|
+
|
|
43
|
+
# Combine multiple updates in one call
|
|
44
|
+
plesty update --author "Jane Doe" --email jane@example.com --ci-stages "check,build,release"
|
|
45
|
+
|
|
46
|
+
# Update a project in another directory
|
|
47
|
+
plesty --project-dir ../plesty-power_meter-device update --author "Jane Doe"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Notes
|
|
51
|
+
|
|
52
|
+
- `--author` / `--email` update `pyproject.toml` and `spdx.tmpl` but do **not** re-apply
|
|
53
|
+
SPDX headers to source files. Run `plesty license update` afterwards to propagate the new
|
|
54
|
+
identity into all `.py` file headers.
|
|
55
|
+
- `--name` changes only `[project].name`. The Python package directory name and all import
|
|
56
|
+
paths in source files are left unchanged.
|
|
57
|
+
- `--ci-stages` fully regenerates `.gitlab-ci.yml` from scratch; any manual edits to that
|
|
58
|
+
file will be lost.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Getting started
|
|
2
|
+
|
|
3
|
+
This guide walks through the typical workflow for creating and developing a Plesty-compliant
|
|
4
|
+
device project.
|
|
5
|
+
|
|
6
|
+
## 1. Scaffold a new project
|
|
7
|
+
|
|
8
|
+
Name the project directory `plesty-<name>`, navigate into it, and run `plesty init`.
|
|
9
|
+
The module name is automatically inferred by stripping the `plesty-` prefix:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
mkdir plesty-power-meter && cd plesty-power-meter
|
|
13
|
+
plesty init device
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
This produces a `power_meter/` source folder, a PyPI distribution named `plesty-power-meter`,
|
|
17
|
+
and a package importable as `plesty.power_meter`. Alternatively, specify everything explicitly:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
plesty --project-dir ~/projects/plesty-power-meter init device \
|
|
21
|
+
--name power_meter \
|
|
22
|
+
--author "Jane Doe" \
|
|
23
|
+
--email jane@example.com
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This generates a project pre-configured with the expected repository structure,
|
|
27
|
+
`pyproject.toml`, example source files, CI pipeline (`.gitlab-ci.yml`), and documentation
|
|
28
|
+
stubs. Use `--ci-stages` to select which pipeline stages to include, or `--ci-stages ""`
|
|
29
|
+
to omit the CI file entirely.
|
|
30
|
+
|
|
31
|
+
## 2. Check compliance
|
|
32
|
+
|
|
33
|
+
Navigate into the project and run the compliance checker:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd plesty-power-meter
|
|
37
|
+
plesty check
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
By default this checks against the **Pixel** level. Add `--standard nebula` or
|
|
41
|
+
`--standard quantum` to raise the bar. Fix any reported issues and re-run until the check
|
|
42
|
+
passes.
|
|
43
|
+
|
|
44
|
+
## 3. Preview the documentation
|
|
45
|
+
|
|
46
|
+
Start a local documentation server with live reload:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
plesty docs serve
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Open [http://127.0.0.1:8000](http://127.0.0.1:8000) in your browser. Any changes to `.md`
|
|
53
|
+
or `.rst` files in the `docs/` directory are reflected immediately.
|
|
54
|
+
|
|
55
|
+
## 4. Apply license headers
|
|
56
|
+
|
|
57
|
+
Keep all Python files covered by the SPDX license header:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
plesty license update
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This reads author and maintainer information from `pyproject.toml` and writes the correct
|
|
64
|
+
header to every `.py` file in the project.
|
|
65
|
+
|
|
66
|
+
## 5. Update project metadata
|
|
67
|
+
|
|
68
|
+
Use `plesty update` to change author info, the PyPI distribution name, or the CI pipeline
|
|
69
|
+
at any time without re-scaffolding the project:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Change the author
|
|
73
|
+
plesty update --author "Jane Doe" --email jane@example.com
|
|
74
|
+
|
|
75
|
+
# Rename the PyPI distribution
|
|
76
|
+
plesty update --name plesty-pm100d
|
|
77
|
+
|
|
78
|
+
# Trim the CI pipeline
|
|
79
|
+
plesty update --ci-stages "check,build,release"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 6. Deploy documentation
|
|
83
|
+
|
|
84
|
+
When ready to publish, push the built documentation to your remote pages branch:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
plesty docs deploy --remote-url git@gitlab.com:org/my-device.git --target-branch pages
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Use `--release` to tag it as a versioned release instead of the development snapshot.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# plesty-sdk
|
|
2
|
+
|
|
3
|
+
**plesty-sdk** is the official command-line tool for developing Python modules that comply with
|
|
4
|
+
the Plesty standard. It provides tools for enforcing code hygiene, managing documentation,
|
|
5
|
+
applying license headers, scaffolding new projects, and generating device manuals.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install plesty-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After installation, the `plesty` command is available in your environment.
|
|
14
|
+
|
|
15
|
+
## The `--project-dir` option
|
|
16
|
+
|
|
17
|
+
All `plesty` commands operate on a Python project directory. By default this is the current
|
|
18
|
+
working directory, but you can point to any directory using the global `--project-dir` (`-d`)
|
|
19
|
+
option:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
plesty --project-dir /path/to/my-project check
|
|
23
|
+
plesty -d ../my-device docs serve
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Every command reads `pyproject.toml`, the `.plesty` cache, and all source paths relative to
|
|
27
|
+
this directory.
|
|
28
|
+
|
|
29
|
+
## Commands at a glance
|
|
30
|
+
|
|
31
|
+
| Command | Description |
|
|
32
|
+
|---|---|
|
|
33
|
+
| [`plesty check`](commands/check.md) | Validate a project against a Plesty compliance level |
|
|
34
|
+
| [`plesty build`](commands/build.md) | Scaffold new device or experiment projects from templates |
|
|
35
|
+
| [`plesty docs`](commands/docs.md) | Serve or deploy the project documentation |
|
|
36
|
+
| [`plesty license`](commands/license.md) | Apply and sync SPDX license headers |
|
|
37
|
+
| [`plesty manual`](commands/manual.md) | Generate Markdown/PDF manuals from a device's `DocDevice` |
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- check
|
|
3
|
+
- test
|
|
4
|
+
- build
|
|
5
|
+
- release
|
|
6
|
+
- deploy
|
|
7
|
+
|
|
8
|
+
variables:
|
|
9
|
+
# Required for versioningit: the runner must fetch full Git history and tags.
|
|
10
|
+
GIT_DEPTH: "0"
|
|
11
|
+
|
|
12
|
+
include:
|
|
13
|
+
# Check compliance with Plesty standard
|
|
14
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/check-compliance@main
|
|
15
|
+
inputs:
|
|
16
|
+
stage: check
|
|
17
|
+
|
|
18
|
+
# Run pytest with coverage reporting
|
|
19
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/run-tests@main
|
|
20
|
+
inputs:
|
|
21
|
+
stage: test
|
|
22
|
+
job_name: run-tests
|
|
23
|
+
|
|
24
|
+
# Build Python package and expose dist/ as an artifact
|
|
25
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/build-pkg@main
|
|
26
|
+
inputs:
|
|
27
|
+
stage: build
|
|
28
|
+
job_name: build-pkg
|
|
29
|
+
|
|
30
|
+
# Publish package to PyPI on release tags
|
|
31
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/publish-pypi@main
|
|
32
|
+
inputs:
|
|
33
|
+
stage: release
|
|
34
|
+
pypi_token: $PYPI_TOKEN
|
|
35
|
+
build_job_name: build-pkg
|
|
36
|
+
|
|
37
|
+
# Deploy documentation to dedicated documentation branch
|
|
38
|
+
- component: $CI_SERVER_FQDN/plesty/plesty-ci/deploy-docs@main
|
|
39
|
+
inputs:
|
|
40
|
+
stage: deploy
|
|
41
|
+
access_token: $CI_BOT_TOKEN
|