pyminleon 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.
Files changed (46) hide show
  1. pyminleon-0.1.0/.editorconfig +12 -0
  2. pyminleon-0.1.0/.gitattributes +2 -0
  3. pyminleon-0.1.0/.github/CODEOWNERS +3 -0
  4. pyminleon-0.1.0/.github/dependabot.yml +25 -0
  5. pyminleon-0.1.0/.github/workflows/checks.yml +63 -0
  6. pyminleon-0.1.0/.github/workflows/docs.yml +30 -0
  7. pyminleon-0.1.0/.github/workflows/release.yml +71 -0
  8. pyminleon-0.1.0/.gitignore +31 -0
  9. pyminleon-0.1.0/AGENTS.md +61 -0
  10. pyminleon-0.1.0/CLAUDE.md +61 -0
  11. pyminleon-0.1.0/LICENSE +201 -0
  12. pyminleon-0.1.0/PKG-INFO +108 -0
  13. pyminleon-0.1.0/README.md +73 -0
  14. pyminleon-0.1.0/docs/assets/favicon.svg +8 -0
  15. pyminleon-0.1.0/docs/assets/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  16. pyminleon-0.1.0/docs/assets/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  17. pyminleon-0.1.0/docs/assets/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
  18. pyminleon-0.1.0/docs/assets/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
  19. pyminleon-0.1.0/docs/assets/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
  20. pyminleon-0.1.0/docs/assets/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
  21. pyminleon-0.1.0/docs/assets/fonts/ibm-plex-sans-latin-700-normal.woff2 +0 -0
  22. pyminleon-0.1.0/docs/assets/logo.svg +8 -0
  23. pyminleon-0.1.0/docs/guide/safety.md +17 -0
  24. pyminleon-0.1.0/docs/index.md +67 -0
  25. pyminleon-0.1.0/docs/stylesheets/extra.css +173 -0
  26. pyminleon-0.1.0/pyproject.toml +75 -0
  27. pyminleon-0.1.0/requirements-docs.txt +3 -0
  28. pyminleon-0.1.0/ruff.toml +9 -0
  29. pyminleon-0.1.0/scripts/docs_versioning.py +377 -0
  30. pyminleon-0.1.0/scripts/publish_versioned_docs.py +179 -0
  31. pyminleon-0.1.0/src/pyminleon/__init__.py +15 -0
  32. pyminleon-0.1.0/src/pyminleon/_http.py +169 -0
  33. pyminleon-0.1.0/src/pyminleon/exceptions.py +13 -0
  34. pyminleon-0.1.0/src/pyminleon/ndb.py +228 -0
  35. pyminleon-0.1.0/src/pyminleon/py.typed +0 -0
  36. pyminleon-0.1.0/tests/__init__.py +0 -0
  37. pyminleon-0.1.0/tests/conftest.py +152 -0
  38. pyminleon-0.1.0/tests/docs/test_publish_versioned_docs.py +284 -0
  39. pyminleon-0.1.0/tests/fixtures/ndbpro/api_config.json +1 -0
  40. pyminleon-0.1.0/tests/fixtures/ndbpro/api_status.json +1 -0
  41. pyminleon-0.1.0/tests/fixtures/ndbpro/pcolors.html +24 -0
  42. pyminleon-0.1.0/tests/fixtures/ndbpro/pfx2.html +59 -0
  43. pyminleon-0.1.0/tests/fixtures/ndbpro/pshows.html +10 -0
  44. pyminleon-0.1.0/tests/test_http.py +109 -0
  45. pyminleon-0.1.0/tests/test_ndb.py +336 -0
  46. pyminleon-0.1.0/zensical.toml +105 -0
@@ -0,0 +1,12 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+ indent_style = space
9
+ indent_size = 2
10
+
11
+ [*.py]
12
+ indent_size = 4
@@ -0,0 +1,2 @@
1
+ *.bin binary
2
+ tests/fixtures/** -text
@@ -0,0 +1,3 @@
1
+ # Default reviewers for everything in this repository (review routing).
2
+ # Seed-once: refine per-path ownership as the project grows.
3
+ * @amattas
@@ -0,0 +1,25 @@
1
+ # Standard Dependabot config (mattas-net security standard): monthly, 7-day cooldown,
2
+ # one grouped PR per ecosystem. Security updates are separate and stay immediate.
3
+ version: 2
4
+ updates:
5
+ - package-ecosystem: pip
6
+ directory: /
7
+ schedule:
8
+ interval: monthly
9
+ cooldown:
10
+ default-days: 7
11
+ groups:
12
+ pip:
13
+ patterns:
14
+ - '*'
15
+
16
+ - package-ecosystem: github-actions
17
+ directory: /
18
+ schedule:
19
+ interval: monthly
20
+ cooldown:
21
+ default-days: 7
22
+ groups:
23
+ github-actions:
24
+ patterns:
25
+ - '*'
@@ -0,0 +1,63 @@
1
+ # Checks — automatic on push to main; on pull requests the run waits at the
2
+ # `approve` job until a reviewer approves it in the `approval` environment. The
3
+ # Release workflow requires a successful run of this workflow on main HEAD.
4
+ #
5
+ # Required checks (default-branch ruleset): "checks" and "security" (alias jobs below).
6
+ # Until the ruleset flips (WP-1 pass 2) it still requires "python / checks (<python>)" and
7
+ # "python / security", which the `python` job keeps producing. See mattas-net/.github STANDARD.md.
8
+ name: Checks
9
+
10
+ on:
11
+ push:
12
+ branches: [main]
13
+ pull_request:
14
+ workflow_dispatch:
15
+
16
+ concurrency:
17
+ group: checks-${{ github.ref }}
18
+ cancel-in-progress: true
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ approve:
25
+ if: github.event_name == 'pull_request'
26
+ runs-on: ubuntu-24.04
27
+ timeout-minutes: 5
28
+ environment: approval
29
+ steps:
30
+ - run: echo "Checks approved by ${GITHUB_TRIGGERING_ACTOR}"
31
+
32
+ python:
33
+ needs: approve
34
+ if: always() && needs.approve.result != 'failure' && needs.approve.result != 'cancelled'
35
+ uses: mattas-net/.github/.github/workflows/python-ci.yml@main
36
+ permissions:
37
+ contents: read
38
+ with:
39
+ python-versions: '["3.12", "3.13", "3.14"]'
40
+ extra-lint: bandit -q -r src
41
+ audit: strict
42
+
43
+ checks:
44
+ needs: python
45
+ if: always() # a skipped required check counts as passing, so always run and assert
46
+ runs-on: ubuntu-24.04
47
+ timeout-minutes: 5
48
+ steps:
49
+ - name: Require the shared checks job
50
+ env:
51
+ RESULT: ${{ needs.python.outputs.checks-result }}
52
+ run: test "$RESULT" = success
53
+
54
+ security:
55
+ needs: python
56
+ if: always()
57
+ runs-on: ubuntu-24.04
58
+ timeout-minutes: 5
59
+ steps:
60
+ - name: Require the shared security job
61
+ env:
62
+ RESULT: ${{ needs.python.outputs.security-result }}
63
+ run: test "$RESULT" = success
@@ -0,0 +1,30 @@
1
+ name: Docs
2
+
3
+ # Docs: build every documented version with Zensical and publish the versioned site (mike) to the
4
+ # gh-pages branch with the shared mattas-net/.github docs.yml (scripts/publish_versioned_docs.py):
5
+ # dev = main, X.Y = newest patch tag of each documented minor line, latest = highest stable release.
6
+ # Public repos serve gh-pages with Pages; private repos build gh-pages and keep Pages disabled.
7
+ # Triggers: push to main, manual dispatch, and workflow_call (release.yml calls it after tagging).
8
+ on:
9
+ push:
10
+ branches: [main]
11
+ workflow_dispatch:
12
+ workflow_call:
13
+ inputs:
14
+ version:
15
+ description: Release version that triggered the publish (informational)
16
+ type: string
17
+ default: ""
18
+
19
+ permissions:
20
+ contents: read
21
+
22
+ jobs:
23
+ docs:
24
+ uses: mattas-net/.github/.github/workflows/docs.yml@main
25
+ permissions:
26
+ contents: write # the publish script pushes the gh-pages branch
27
+ with:
28
+ version: ${{ inputs.version }}
29
+ python-version: "3.13"
30
+ install: python -m pip install --disable-pip-version-check -e ".[docs]" -r requirements-docs.txt
@@ -0,0 +1,71 @@
1
+ # Release procedure and the create-release checks: see mattas-net/.github STANDARD.md (Release).
2
+ # Release: bump [project].version in pyproject.toml, merge to main, then
3
+ # Actions -> Release -> Run workflow -> enter that version (bare semver, e.g. 0.2.0
4
+ # or 0.2.0-beta1). create-release.yml verifies the manifest and the passing Checks
5
+ # run on main HEAD, then tags main and creates the GitHub release; python-build.yml
6
+ # builds the tag and verifies the wheel version. Publishing runs in the `pypi`
7
+ # environment (required reviewer gate); PyPI trusted publishing must be registered
8
+ # for workflow `release.yml` + environment `pypi`. The built files are attached to
9
+ # the release after a successful publish; the final `docs` job then rebuilds the
10
+ # versioned docs.
11
+ name: Release
12
+
13
+ on:
14
+ workflow_dispatch:
15
+ inputs:
16
+ version:
17
+ description: Version to release (bare semver, e.g. 1.4.2)
18
+ required: true
19
+ type: string
20
+
21
+ permissions:
22
+ contents: read
23
+
24
+ jobs:
25
+ release:
26
+ uses: mattas-net/.github/.github/workflows/create-release.yml@main
27
+ permissions:
28
+ contents: write
29
+ actions: read
30
+ with:
31
+ version: ${{ inputs.version }}
32
+ manifest: pyproject.toml
33
+ require-workflow: Checks
34
+
35
+ build:
36
+ needs: release
37
+ uses: mattas-net/.github/.github/workflows/python-build.yml@main
38
+ permissions:
39
+ contents: read
40
+ with:
41
+ ref: ${{ inputs.version }}
42
+
43
+ publish:
44
+ needs: build
45
+ runs-on: ubuntu-24.04
46
+ environment: pypi # must match the PyPI trusted publisher
47
+ permissions:
48
+ contents: write # attach the files to the release
49
+ id-token: write # trusted publishing
50
+ attestations: write
51
+ steps:
52
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
53
+ with:
54
+ name: dist
55
+ path: dist/
56
+ - uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
57
+ with:
58
+ subject-path: dist/*
59
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
60
+ - env:
61
+ GH_TOKEN: ${{ github.token }}
62
+ TAG: ${{ inputs.version }}
63
+ run: gh release upload "$TAG" dist/* --repo "$GITHUB_REPOSITORY"
64
+
65
+ docs:
66
+ needs: publish
67
+ permissions:
68
+ contents: write # docs.yml: the publish script pushes the gh-pages branch
69
+ uses: ./.github/workflows/docs.yml
70
+ with:
71
+ version: ${{ inputs.version }}
@@ -0,0 +1,31 @@
1
+ # OS / editor
2
+ .DS_Store
3
+ *.swp
4
+ .idea/
5
+ .vscode/
6
+
7
+ # Build / dependency output
8
+ dist/
9
+ build/
10
+ *.egg-info/
11
+ .venv/
12
+ __pycache__/
13
+ .mypy_cache/
14
+ .ruff_cache/
15
+ .pytest_cache/
16
+ coverage/
17
+ .coverage
18
+ .build/
19
+
20
+ htmlcov/
21
+ coverage.xml
22
+ *.py[cod]
23
+ .env
24
+
25
+
26
+ coverage.json
27
+
28
+ # Zensical docs: built site, cache, and generated API reference
29
+ /site
30
+ .cache/
31
+ docs/api/reference.md
@@ -0,0 +1,61 @@
1
+ # pyminleon - Python Library for Minleon NDB-Pro Control
2
+
3
+ ## Project Overview
4
+
5
+ **Purpose**: Standalone asyncio Python library that controls Minleon NDB-Pro LED controllers' built-in effects over the
6
+ HTTP endpoints the controller's web UI uses. Extracted from aioddp so aioddp stays a pure DDP (UDP pixel) library.
7
+
8
+ **Features**: `NDBController` (`state`, `presets`, `set_effect`, `set_intensity`, `recall_preset`, `config`,
9
+ `status`), `identify(host)`, `SUPPORTED_MODELS`. Zero runtime dependencies.
10
+
11
+ ### What This Is NOT
12
+ - Not a DDP sender (aioddp is) and not a Home Assistant integration (hass-ddp is; it imports pyminleon)
13
+ - Not a writer of controller settings: no saved config, no preset saves
14
+
15
+ ## Architecture
16
+
17
+ ```
18
+ src/pyminleon/
19
+ ├── __init__.py # Public exports; consumers import only from `pyminleon`
20
+ ├── ndb.py # NDBController, NDBState, NDBPreset, identify, SUPPORTED_MODELS
21
+ ├── _http.py # Private minimal asyncio HTTP/1.0 client (chunked decoding, size caps, host validation)
22
+ └── exceptions.py # MinleonError > ConfigError, ControllerError
23
+ ```
24
+
25
+ ## Safety invariants (tested; do not weaken)
26
+
27
+ - Never request `?s=N` on `/pshows.html` (saves a preset slot); never send `saveon`
28
+ - Only `POST /api/control`, `GET /pshows.html?r=N`, and read-only pages
29
+ - Unparsable HTML/JSON is a `ControllerError`, never a guess
30
+ - No redirects followed; bodies capped at 64 KiB; one deadline per call
31
+
32
+ ## Development
33
+
34
+ Python env is the conda env `pyminleon` (never base, never venv).
35
+
36
+ ```bash
37
+ conda run -n pyminleon python -m pytest -q
38
+ conda run -n pyminleon ruff check .
39
+ conda run -n pyminleon ruff format --check .
40
+ conda run -n pyminleon mypy
41
+ conda run -n pyminleon bandit -q -r src
42
+ ```
43
+
44
+ Coverage gate: 90% total branch coverage (`fail_under` in pyproject.toml; every pytest run enforces it).
45
+
46
+ ## Testing Approach
47
+
48
+ - pytest + pytest-asyncio (`asyncio_mode = "auto"`). TDD; parametrize variations of one behavior
49
+ - `http_controller` fixture: real asyncio HTTP server on loopback serving pages captured from a real NDB-Pro
50
+ (`tests/fixtures/ndbpro/`), with slow, chunked, unframed, and redirect modes; no mocking of the client
51
+ - `no_leaked_tasks` autouse fixture enforces no orphaned asyncio tasks
52
+
53
+ ## Technical Decisions
54
+
55
+ - `src/pyminleon` layout, hatchling, `requires-python >=3.12`, `dependencies = []`, extra: `dev`
56
+ - ruff (lint + format) line length 120, rules `E, F, I, B, UP, SIM, S`; mypy strict; bandit
57
+ - Standard `logging`; the Checks workflow runs on push to main and on approved pull requests
58
+
59
+ ## License
60
+
61
+ Apache-2.0
@@ -0,0 +1,61 @@
1
+ # pyminleon - Python Library for Minleon NDB-Pro Control
2
+
3
+ ## Project Overview
4
+
5
+ **Purpose**: Standalone asyncio Python library that controls Minleon NDB-Pro LED controllers' built-in effects over the
6
+ HTTP endpoints the controller's web UI uses. Extracted from aioddp so aioddp stays a pure DDP (UDP pixel) library.
7
+
8
+ **Features**: `NDBController` (`state`, `presets`, `set_effect`, `set_intensity`, `recall_preset`, `config`,
9
+ `status`), `identify(host)`, `SUPPORTED_MODELS`. Zero runtime dependencies.
10
+
11
+ ### What This Is NOT
12
+ - Not a DDP sender (aioddp is) and not a Home Assistant integration (hass-ddp is; it imports pyminleon)
13
+ - Not a writer of controller settings: no saved config, no preset saves
14
+
15
+ ## Architecture
16
+
17
+ ```
18
+ src/pyminleon/
19
+ ├── __init__.py # Public exports; consumers import only from `pyminleon`
20
+ ├── ndb.py # NDBController, NDBState, NDBPreset, identify, SUPPORTED_MODELS
21
+ ├── _http.py # Private minimal asyncio HTTP/1.0 client (chunked decoding, size caps, host validation)
22
+ └── exceptions.py # MinleonError > ConfigError, ControllerError
23
+ ```
24
+
25
+ ## Safety invariants (tested; do not weaken)
26
+
27
+ - Never request `?s=N` on `/pshows.html` (saves a preset slot); never send `saveon`
28
+ - Only `POST /api/control`, `GET /pshows.html?r=N`, and read-only pages
29
+ - Unparsable HTML/JSON is a `ControllerError`, never a guess
30
+ - No redirects followed; bodies capped at 64 KiB; one deadline per call
31
+
32
+ ## Development
33
+
34
+ Python env is the conda env `pyminleon` (never base, never venv).
35
+
36
+ ```bash
37
+ conda run -n pyminleon python -m pytest -q
38
+ conda run -n pyminleon ruff check .
39
+ conda run -n pyminleon ruff format --check .
40
+ conda run -n pyminleon mypy
41
+ conda run -n pyminleon bandit -q -r src
42
+ ```
43
+
44
+ Coverage gate: 90% total branch coverage (`fail_under` in pyproject.toml; every pytest run enforces it).
45
+
46
+ ## Testing Approach
47
+
48
+ - pytest + pytest-asyncio (`asyncio_mode = "auto"`). TDD; parametrize variations of one behavior
49
+ - `http_controller` fixture: real asyncio HTTP server on loopback serving pages captured from a real NDB-Pro
50
+ (`tests/fixtures/ndbpro/`), with slow, chunked, unframed, and redirect modes; no mocking of the client
51
+ - `no_leaked_tasks` autouse fixture enforces no orphaned asyncio tasks
52
+
53
+ ## Technical Decisions
54
+
55
+ - `src/pyminleon` layout, hatchling, `requires-python >=3.12`, `dependencies = []`, extra: `dev`
56
+ - ruff (lint + format) line length 120, rules `E, F, I, B, UP, SIM, S`; mypy strict; bandit
57
+ - Standard `logging`; the Checks workflow runs on push to main and on approved pull requests
58
+
59
+ ## License
60
+
61
+ Apache-2.0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 PyDMP Contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.5
2
+ Name: pyminleon
3
+ Version: 0.1.0
4
+ Summary: Asyncio control of Minleon NDB-Pro LED controllers' built-in effects over HTTP
5
+ Project-URL: Documentation, https://amattas.github.io/pyminleon/
6
+ Project-URL: Source, https://github.com/amattas/pyminleon
7
+ Author-email: Anthony Mattas <anthony@mattas.net>
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: home-automation,led,lighting,minleon,ndb-pro
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Framework :: AsyncIO
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Home Automation
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.12
20
+ Provides-Extra: dev
21
+ Requires-Dist: bandit==1.9.4; extra == 'dev'
22
+ Requires-Dist: build==1.6.1; extra == 'dev'
23
+ Requires-Dist: mypy==2.3.0; extra == 'dev'
24
+ Requires-Dist: pre-commit==4.7.0; extra == 'dev'
25
+ Requires-Dist: pytest-asyncio==1.4.0; extra == 'dev'
26
+ Requires-Dist: pytest-cov==7.1.0; extra == 'dev'
27
+ Requires-Dist: pytest==9.1.1; extra == 'dev'
28
+ Requires-Dist: pyyaml==6.0.3; extra == 'dev'
29
+ Requires-Dist: ruff==0.17.2; extra == 'dev'
30
+ Requires-Dist: types-pyyaml==6.0.12.20260906; extra == 'dev'
31
+ Provides-Extra: docs
32
+ Requires-Dist: pydoc-markdown==4.8.2; extra == 'docs'
33
+ Requires-Dist: zensical==0.0.50; extra == 'docs'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # pyminleon
37
+
38
+ Asyncio Python library that controls the built-in effects of Minleon NDB-Pro LED controllers over the HTTP endpoints
39
+ the controller's own web UI uses. Zero runtime dependencies (stdlib only), Python 3.12+.
40
+
41
+ It does not send pixel data. For that, use a DDP sender such as [aioddp](https://github.com/amattas/aioddp). While DDP
42
+ data flows it overrides the built-in effect; about 20 s after DDP stops the controller falls back to it.
43
+
44
+ ## Quick start
45
+
46
+ ```python
47
+ import asyncio
48
+
49
+ from pyminleon import NDBController, identify
50
+
51
+
52
+ async def main() -> None:
53
+ host = "10.0.40.20" # placeholder
54
+ if await identify(host) is None:
55
+ raise SystemExit("not a supported Minleon controller")
56
+
57
+ ndb = NDBController(host)
58
+ state = await ndb.state() # NDBState(effect="Glow", intensity=100, effects=("Off", ..., "Worms"))
59
+ await ndb.set_effect("Color Wave")
60
+ await ndb.set_intensity(60)
61
+ await ndb.recall_preset(3) # slots 0-9 are "Show 1", 10-19 "Show 2"
62
+ layout = await ndb.config() # raw JSON from GET /api/config (DDP-spec layout document)
63
+ print(state, layout["config"]["ports"][0], (await ndb.status())["status"]["mod"])
64
+
65
+
66
+ asyncio.run(main())
67
+ ```
68
+
69
+ ## API
70
+
71
+ - `NDBController(host, *, port=80, timeout=3.0)`
72
+ - `await state() -> NDBState` selected effect, intensity, and every effect the controller offers
73
+ - `await presets() -> tuple[NDBPreset, ...]` stored show slots
74
+ - `await set_effect(name)`, `await set_intensity(percent)`, `await recall_preset(slot)`
75
+ - `await config() -> dict[str, Any]`, `await status() -> dict[str, Any]` raw `/api/config` and `/api/status` documents
76
+ - `await identify(host, *, port=80, timeout=3.0) -> str | None` the model id (e.g. `"NDBPRO"`) if the host reports a
77
+ model in `SUPPORTED_MODELS`; `None` if it answers but is not a supported Minleon, or does not answer in time
78
+ - Errors: `MinleonError` > `ConfigError` (bad host, port, timeout, or argument), `ControllerError` (unreachable,
79
+ timed out, non-200, or an unreadable page or document)
80
+
81
+ ## Safety
82
+
83
+ - Nothing is ever written to the controller's saved settings. The library never requests `/pshows.html?s=N` (which
84
+ overwrites a preset slot) and never sends `saveon`. The only requests it makes are `POST /api/control`,
85
+ `GET /pshows.html?r=N` (recall), and read-only pages (`/pfx2.html`, `/pcolors.html`, `/pshows.html`,
86
+ `/api/config`, `/api/status`).
87
+ - `state()` and `presets()` parse the web UI's HTML with strict patterns written against firmware 2.0 and raise
88
+ `ControllerError` on anything else rather than guessing.
89
+ - HTTP responses are size-capped (64 KiB), redirects are never followed, and each call is bounded by `timeout`.
90
+ - Hosts are validated (hostname, IPv4, or IPv6 literal only) so a value can never steer the path, port, or scheme.
91
+
92
+ ## Documentation
93
+
94
+ https://amattas.github.io/pyminleon/
95
+
96
+ ## Development
97
+
98
+ ```bash
99
+ conda create -n pyminleon -c conda-forge python=3.14
100
+ conda run -n pyminleon python -m pip install -e ".[dev]"
101
+ conda run -n pyminleon python -m pytest -q
102
+ conda run -n pyminleon ruff check . && conda run -n pyminleon ruff format --check . && conda run -n pyminleon mypy
103
+ conda run -n pyminleon bandit -q -r src
104
+ ```
105
+
106
+ ## License
107
+
108
+ Apache-2.0