lametric-py 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 (43) hide show
  1. lametric_py-0.1.0/.devcontainer/devcontainer.json +34 -0
  2. lametric_py-0.1.0/.github/CODE_OF_CONDUCT.md +31 -0
  3. lametric_py-0.1.0/.github/FUNDING.yml +3 -0
  4. lametric_py-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +78 -0
  5. lametric_py-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  6. lametric_py-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +41 -0
  7. lametric_py-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +21 -0
  8. lametric_py-0.1.0/.github/SECURITY.md +24 -0
  9. lametric_py-0.1.0/.github/dependabot.yml +38 -0
  10. lametric_py-0.1.0/.github/labeler.yml +37 -0
  11. lametric_py-0.1.0/.github/labels.yml +86 -0
  12. lametric_py-0.1.0/.github/workflows/ci.yml +139 -0
  13. lametric_py-0.1.0/.github/workflows/dependabot-automerge.yml +63 -0
  14. lametric_py-0.1.0/.github/workflows/label-all-prs.yml +112 -0
  15. lametric_py-0.1.0/.github/workflows/labeler.yml +17 -0
  16. lametric_py-0.1.0/.github/workflows/sync-labels.yml +27 -0
  17. lametric_py-0.1.0/.gitignore +207 -0
  18. lametric_py-0.1.0/.pre-commit-config.yaml +42 -0
  19. lametric_py-0.1.0/.yamllint.yml +15 -0
  20. lametric_py-0.1.0/CONTRIBUTING.md +58 -0
  21. lametric_py-0.1.0/LICENSE +21 -0
  22. lametric_py-0.1.0/PKG-INFO +203 -0
  23. lametric_py-0.1.0/README.md +188 -0
  24. lametric_py-0.1.0/docs/development.md +70 -0
  25. lametric_py-0.1.0/docs/index.html +752 -0
  26. lametric_py-0.1.0/docs/streaming.md +102 -0
  27. lametric_py-0.1.0/docs/usage.md +182 -0
  28. lametric_py-0.1.0/pyproject.toml +90 -0
  29. lametric_py-0.1.0/src/lametric/__init__.py +127 -0
  30. lametric_py-0.1.0/src/lametric/cloud.py +168 -0
  31. lametric_py-0.1.0/src/lametric/const.py +159 -0
  32. lametric_py-0.1.0/src/lametric/device.py +387 -0
  33. lametric_py-0.1.0/src/lametric/device_apps.py +48 -0
  34. lametric_py-0.1.0/src/lametric/device_configs.py +79 -0
  35. lametric_py-0.1.0/src/lametric/device_notifications.py +134 -0
  36. lametric_py-0.1.0/src/lametric/device_states.py +192 -0
  37. lametric_py-0.1.0/src/lametric/exceptions.py +17 -0
  38. lametric_py-0.1.0/src/lametric/py.typed +0 -0
  39. lametric_py-0.1.0/tests/runtime_test.py +331 -0
  40. lametric_py-0.1.0/tests/test_notifications.py +42 -0
  41. lametric_py-0.1.0/tests/test_public_api.py +28 -0
  42. lametric_py-0.1.0/tests/test_streaming.py +137 -0
  43. lametric_py-0.1.0/uv.lock +1267 -0
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "lametric-py",
3
+ "image": "mcr.microsoft.com/devcontainers/python:3.14",
4
+ "features": {
5
+ "ghcr.io/devcontainers-extra/features/uv:1": {}
6
+ },
7
+ "customizations": {
8
+ "vscode": {
9
+ "settings": {
10
+ "python.defaultInterpreterPath": "/usr/local/bin/python",
11
+ "python.analysis.typeCheckingMode": "strict",
12
+ "editor.formatOnSave": true,
13
+ "editor.codeActionsOnSave": {
14
+ "source.fixAll.ruff": "always",
15
+ "source.organizeImports.ruff": "always"
16
+ },
17
+ "python.testing.pytestEnabled": true,
18
+ "python.testing.pytestArgs": [
19
+ "tests"
20
+ ]
21
+ },
22
+ "extensions": [
23
+ "cschleiden.vscode-github-actions",
24
+ "vivaxy.vscode-conventional-commits",
25
+ "charliermarsh.ruff",
26
+ "ms-python.python",
27
+ "ms-python.vscode-pylance",
28
+ "ms-python.debugpy"
29
+ ]
30
+ }
31
+ },
32
+ "postCreateCommand": "uv sync --dev && uv run pre-commit install",
33
+ "remoteUser": "vscode"
34
+ }
@@ -0,0 +1,31 @@
1
+ # Code of Conduct
2
+
3
+ ## Our pledge
4
+
5
+ We as contributors and maintainers pledge to make participation in this project a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our standards
8
+
9
+ Examples of behaviour that contributes to a positive environment:
10
+
11
+ - Using welcoming and inclusive language
12
+ - Being respectful of differing viewpoints and experiences
13
+ - Gracefully accepting constructive criticism
14
+ - Focusing on what is best for the community
15
+ - Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behaviour:
18
+
19
+ - The use of sexualised language or imagery and unwelcome sexual attention or advances
20
+ - Trolling, insulting/derogatory comments, and personal or political attacks
21
+ - Public or private harassment
22
+ - Publishing others' private information without explicit permission
23
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Enforcement
26
+
27
+ Instances of abusive, harassing, or otherwise unacceptable behaviour may be reported by opening a private security advisory or contacting the maintainer directly. All complaints will be reviewed and investigated and will result in a response deemed necessary and appropriate to the circumstances.
28
+
29
+ ## Attribution
30
+
31
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
@@ -0,0 +1,3 @@
1
+ ---
2
+
3
+ github: [ElectroAttacks]
@@ -0,0 +1,78 @@
1
+ name: Bug report
2
+ description: Something is not working as documented.
3
+ labels: [bug]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for taking the time to fill out this bug report.
9
+ Please search [existing issues](https://github.com/ElectroAttacks/lametric-py/issues) before submitting.
10
+
11
+ - type: textarea
12
+ id: description
13
+ attributes:
14
+ label: Description
15
+ description: A clear and concise description of what the bug is.
16
+ validations:
17
+ required: true
18
+
19
+ - type: textarea
20
+ id: reproduction
21
+ attributes:
22
+ label: Steps to reproduce
23
+ description: Minimal code or sequence of steps that reliably reproduces the issue.
24
+ placeholder: |
25
+ ```python
26
+ from lametric import LaMetricDevice
27
+ ...
28
+ ```
29
+ validations:
30
+ required: true
31
+
32
+ - type: textarea
33
+ id: expected
34
+ attributes:
35
+ label: Expected behaviour
36
+ description: What did you expect to happen?
37
+ validations:
38
+ required: true
39
+
40
+ - type: textarea
41
+ id: actual
42
+ attributes:
43
+ label: Actual behaviour
44
+ description: What actually happened? Include the full traceback if applicable.
45
+ validations:
46
+ required: true
47
+
48
+ - type: input
49
+ id: version
50
+ attributes:
51
+ label: lametric-py version
52
+ placeholder: "e.g. 1.2.0"
53
+ validations:
54
+ required: true
55
+
56
+ - type: input
57
+ id: python
58
+ attributes:
59
+ label: Python version
60
+ placeholder: "e.g. 3.14.0"
61
+ validations:
62
+ required: true
63
+
64
+ - type: input
65
+ id: firmware
66
+ attributes:
67
+ label: Device firmware version (if applicable)
68
+ placeholder: "e.g. 2.3.9"
69
+ validations:
70
+ required: false
71
+
72
+ - type: textarea
73
+ id: additional
74
+ attributes:
75
+ label: Additional context
76
+ description: Any other information that might be relevant.
77
+ validations:
78
+ required: false
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Security vulnerability
4
+ url: https://github.com/ElectroAttacks/lametric-py/security/advisories/new
5
+ about: Please report security issues privately via GitHub Security Advisories.
@@ -0,0 +1,41 @@
1
+ name: Feature request
2
+ description: Propose a new capability or improvement.
3
+ labels: [enhancement]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for suggesting an improvement!
9
+ Please search [existing issues](https://github.com/ElectroAttacks/lametric-py/issues) before submitting.
10
+
11
+ - type: textarea
12
+ id: problem
13
+ attributes:
14
+ label: Problem or motivation
15
+ description: What problem does this feature solve, or what use case does it enable?
16
+ validations:
17
+ required: true
18
+
19
+ - type: textarea
20
+ id: solution
21
+ attributes:
22
+ label: Proposed solution
23
+ description: Describe what you would like to happen. Pseudocode or API sketches are welcome.
24
+ validations:
25
+ required: true
26
+
27
+ - type: textarea
28
+ id: alternatives
29
+ attributes:
30
+ label: Alternatives considered
31
+ description: Any alternative approaches you have thought about.
32
+ validations:
33
+ required: false
34
+
35
+ - type: textarea
36
+ id: additional
37
+ attributes:
38
+ label: Additional context
39
+ description: Screenshots, links to docs, related issues, etc.
40
+ validations:
41
+ required: false
@@ -0,0 +1,21 @@
1
+ ## Description
2
+
3
+ <!-- What does this PR change and why? Link any related issues with "Closes #123". -->
4
+
5
+ ## Type of change
6
+
7
+ - [ ] Bug fix (`fix:`)
8
+ - [ ] New feature (`feat:`)
9
+ - [ ] Performance improvement (`perf:`)
10
+ - [ ] Refactor (`refactor:`)
11
+ - [ ] Documentation (`docs:`)
12
+ - [ ] CI / tooling (`ci:`)
13
+ - [ ] Breaking change (add `BREAKING CHANGE:` to the commit footer)
14
+
15
+ ## Checklist
16
+
17
+ - [ ] `uv run ruff check . && uv run ruff format --check .` passes
18
+ - [ ] `uv run mypy .` passes
19
+ - [ ] `uv run pytest --cov=src` passes
20
+ - [ ] New or changed public API is documented
21
+ - [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
@@ -0,0 +1,24 @@
1
+ # Security Policy
2
+
3
+ ## Supported versions
4
+
5
+ Only the latest release of this integration is actively supported with security fixes.
6
+
7
+ | Version | Supported |
8
+ | ------- | --------- |
9
+ | Latest | ✅ |
10
+ | Older | ❌ |
11
+
12
+ ## Reporting a vulnerability
13
+
14
+ Please **do not** open a public GitHub issue for security vulnerabilities.
15
+
16
+ Instead, report them privately via [GitHub Security Advisories](https://github.com/ElectroAttacks/lametric-hass-local/security/advisories/new).
17
+
18
+ Include as much detail as possible:
19
+
20
+ - A description of the vulnerability and its potential impact
21
+ - Steps to reproduce
22
+ - Any suggested mitigations or fixes
23
+
24
+ I aim to acknowledge reports within **72 hours** and provide a resolution or workaround as quickly as possible.
@@ -0,0 +1,38 @@
1
+ ---
2
+
3
+ version: 2
4
+ updates:
5
+ # Python dependencies (pip / uv)
6
+ - package-ecosystem: pip
7
+ directory: "/"
8
+ schedule:
9
+ interval: daily
10
+ labels:
11
+ - "dependencies"
12
+ commit-message:
13
+ prefix: "chore"
14
+ open-pull-requests-limit: 5
15
+ groups:
16
+ dev-dependencies:
17
+ patterns:
18
+ - "pytest*"
19
+ - "mypy"
20
+ - "ruff"
21
+ - "pre-commit"
22
+ - "commitizen"
23
+ - "python-semantic-release"
24
+
25
+ # GitHub Actions
26
+ - package-ecosystem: github-actions
27
+ directory: "/"
28
+ schedule:
29
+ interval: daily
30
+ labels:
31
+ - "dependencies"
32
+ - "ci"
33
+ commit-message:
34
+ prefix: "chore"
35
+ groups:
36
+ github-actions:
37
+ patterns:
38
+ - "*"
@@ -0,0 +1,37 @@
1
+ ---
2
+
3
+ ci:
4
+ - changed-files:
5
+ - any-glob-to-any-file:
6
+ - ".github/workflows/**"
7
+ - ".github/dependabot.yml"
8
+ - ".pre-commit-config.yaml"
9
+ - ".yamllint.yml"
10
+ - "pyproject.toml"
11
+
12
+ dependencies:
13
+ - changed-files:
14
+ - any-glob-to-any-file:
15
+ - ".github/dependabot.yml"
16
+ - "pyproject.toml"
17
+
18
+ documentation:
19
+ - changed-files:
20
+ - any-glob-to-any-file:
21
+ - "README.md"
22
+ - "wiki/**"
23
+ - "CONTRIBUTING.md"
24
+ - "SECURITY.md"
25
+ - "CODE_OF_CONDUCT.md"
26
+ - ".github/ISSUE_TEMPLATE/**"
27
+ - ".github/PULL_REQUEST_TEMPLATE.md"
28
+
29
+ new-feature:
30
+ - changed-files:
31
+ - any-glob-to-any-file:
32
+ - "custom_components/**"
33
+
34
+ bugfix:
35
+ - changed-files:
36
+ - any-glob-to-any-file:
37
+ - "custom_components/**"
@@ -0,0 +1,86 @@
1
+ ---
2
+
3
+ - name: "breaking-change"
4
+ color: ee0701
5
+ description: "A breaking change for existing users."
6
+ - name: "bugfix"
7
+ color: ee0701
8
+ description: "Inconsistencies or issues which will cause a problem for users or implementers."
9
+ - name: "documentation"
10
+ color: 0052cc
11
+ description: "Solely about the documentation of the project."
12
+ - name: "enhancement"
13
+ color: 1d76db
14
+ description: "Enhancement of the code, not introducing new features."
15
+ - name: "refactor"
16
+ color: 1d76db
17
+ description: "Improvement of existing code, not introducing new features."
18
+ - name: "performance"
19
+ color: 1d76db
20
+ description: "Improving performance, not introducing new features."
21
+ - name: "new-feature"
22
+ color: 0e8a16
23
+ description: "New features or options."
24
+ - name: "maintenance"
25
+ color: 2af79e
26
+ description: "Generic maintenance tasks."
27
+ - name: "ci"
28
+ color: 1d76db
29
+ description: "Work that improves the continue integration."
30
+ - name: "dependencies"
31
+ color: 1d76db
32
+ description: "Upgrade or downgrade of project dependencies."
33
+
34
+ - name: "in-progress"
35
+ color: fbca04
36
+ description: "Issue is currently being resolved by a developer."
37
+ - name: "stale"
38
+ color: fef2c0
39
+ description: "There has not been activity on this issue or PR for quite some time."
40
+ - name: "no-stale"
41
+ color: fef2c0
42
+ description: "This issue or PR is exempted from the stable bot."
43
+
44
+ - name: "security"
45
+ color: ee0701
46
+ description: "Marks a security issue that needs to be resolved asap."
47
+ - name: "incomplete"
48
+ color: fef2c0
49
+ description: "Marks a PR or issue that is missing information."
50
+ - name: "invalid"
51
+ color: fef2c0
52
+ description: "Marks a PR or issue that is missing information."
53
+
54
+ - name: "beginner-friendly"
55
+ color: 0e8a16
56
+ description: "Good first issue for people wanting to contribute to the project."
57
+ - name: "help-wanted"
58
+ color: 0e8a16
59
+ description: "We need some extra helping hands or expertise in order to resolve this."
60
+
61
+ - name: "hacktoberfest"
62
+ description: "Issues/PRs are participating in the Hacktoberfest."
63
+ color: fbca04
64
+ - name: "hacktoberfest-accepted"
65
+ description: "Issues/PRs are participating in the Hacktoberfest."
66
+ color: fbca04
67
+
68
+ - name: "priority-critical"
69
+ color: ee0701
70
+ description: "This should be dealt with ASAP. Not fixing this issue would be a serious error."
71
+ - name: "priority-high"
72
+ color: b60205
73
+ description: "After critical issues are fixed, these should be dealt with before any further issues."
74
+ - name: "priority-medium"
75
+ color: 0e8a16
76
+ description: "This issue may be useful, and needs some attention."
77
+ - name: "priority-low"
78
+ color: e4ea8a
79
+ description: "Nice addition, maybe... someday..."
80
+
81
+ - name: "major"
82
+ color: b60205
83
+ description: "This PR causes a major version bump in the version number."
84
+ - name: "minor"
85
+ color: 0e8a16
86
+ description: "This PR causes a minor version bump in the version number."
@@ -0,0 +1,139 @@
1
+ ---
2
+
3
+ name: CI & Release
4
+
5
+ on:
6
+ push:
7
+ branches: [main, master]
8
+ pull_request:
9
+ branches: [main]
10
+ schedule:
11
+ - cron: "0 0 * * *"
12
+
13
+ # ─── Stage 1: pre-commit ─────────────────────────────────────────────────────
14
+ # JSON/YAML parsing+linting, Ruff, Mypy, Pytest.
15
+ # ─── Stage 2: release ────────────────────────────────────────────────────────
16
+ # Semantic release. Only runs on push to main after all validators pass.
17
+
18
+ jobs:
19
+ # ── Stage 1 ─────────────────────────────────────────────────────────────────
20
+ pre-commit:
21
+ name: "Stage 1 · JSON+YAML / Ruff / Mypy / Pytest"
22
+ runs-on: ubuntu-latest
23
+ permissions:
24
+ contents: read
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+
28
+ - name: Install uv
29
+ uses: astral-sh/setup-uv@v7
30
+ with:
31
+ enable-cache: true
32
+
33
+ - name: Set up Python 3.14
34
+ run: uv python install 3.14
35
+
36
+ - name: Install dependencies
37
+ run: uv sync --locked --dev
38
+
39
+ - name: Validate JSON files
40
+ run: |
41
+ find . -name "*.json" \
42
+ -not -path "./.venv/*" \
43
+ -not -path "./node_modules/*" \
44
+ | sort | while read -r f; do
45
+ python -m json.tool "$f" > /dev/null && echo "✓ $f" || exit 1
46
+ done
47
+
48
+ - name: Lint YAML files
49
+ run: uvx yamllint --config-file .yamllint.yml .github/
50
+
51
+ - name: Lint & Format Check (Ruff)
52
+ run: uv run ruff check . && uv run ruff format --check .
53
+
54
+ - name: Type Check (Mypy)
55
+ run: uv run mypy .
56
+
57
+ - name: Run Tests (Pytest)
58
+ run: uv run pytest --cov=src --cov-report=xml
59
+
60
+ - name: Upload coverage to Codecov
61
+ uses: codecov/codecov-action@v7
62
+ with:
63
+ file: ./coverage.xml
64
+ fail_ci_if_error: false
65
+
66
+ # ── Stage 2 ─────────────────────────────────────────────────────────────────
67
+ release:
68
+ name: "Stage 2 · Semantic Release / Build / Publish GitHub"
69
+ needs: pre-commit
70
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
71
+ runs-on: ubuntu-latest
72
+ concurrency: release
73
+ permissions:
74
+ contents: write
75
+ outputs:
76
+ released: ${{ steps.release.outputs.released || 'false' }}
77
+ tag: ${{ steps.release.outputs.tag }}
78
+ steps:
79
+ - uses: actions/checkout@v7
80
+ with:
81
+ fetch-depth: 0
82
+
83
+ - name: Semantic Release
84
+ id: release
85
+ uses: python-semantic-release/python-semantic-release@v10.6.1
86
+ with:
87
+ github_token: ${{ secrets.GITHUB_TOKEN }}
88
+ commit: false
89
+ changelog: false
90
+ build: false
91
+
92
+ - name: Install uv
93
+ if: steps.release.outputs.released == 'true'
94
+ uses: astral-sh/setup-uv@v7
95
+ with:
96
+ enable-cache: true
97
+
98
+ - name: Set up Python 3.14
99
+ if: steps.release.outputs.released == 'true'
100
+ run: uv python install 3.14
101
+
102
+ - name: Build distributions
103
+ if: steps.release.outputs.released == 'true'
104
+ run: uv build
105
+
106
+ - name: Upload Release Assets
107
+ if: steps.release.outputs.released == 'true'
108
+ uses: python-semantic-release/publish-action@v10.6.1
109
+ with:
110
+ github_token: ${{ secrets.GITHUB_TOKEN }}
111
+ tag: ${{ steps.release.outputs.tag }}
112
+
113
+ publish-pypi:
114
+ name: "Stage 3 · Build & Publish PyPI"
115
+ needs: release
116
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
117
+ runs-on: ubuntu-latest
118
+ environment: pypi
119
+ permissions:
120
+ id-token: write
121
+ steps:
122
+ - uses: actions/checkout@v7
123
+
124
+ - name: Install uv
125
+ uses: astral-sh/setup-uv@v7
126
+ with:
127
+ enable-cache: true
128
+
129
+ - name: Set up Python 3.14
130
+ run: uv python install 3.14
131
+
132
+ - name: Build distributions
133
+ run: uv build
134
+
135
+ - name: Publish package distributions to PyPI
136
+ uses: pypa/gh-action-pypi-publish@release/v1
137
+ with:
138
+ packages-dir: dist
139
+ skip-existing: true
@@ -0,0 +1,63 @@
1
+ ---
2
+
3
+ name: Dependabot Auto-Merge
4
+
5
+ on:
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ auto-merge:
14
+ name: Approve and enable auto-merge
15
+ runs-on: ubuntu-latest
16
+ if: github.actor == 'dependabot[bot]'
17
+ steps:
18
+ - name: Check out PR branch
19
+ uses: actions/checkout@v7
20
+ with:
21
+ ref: ${{ github.head_ref }}
22
+
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v7
25
+ with:
26
+ enable-cache: true
27
+
28
+ - name: Set up Python 3.14
29
+ run: uv python install 3.14
30
+
31
+ - name: Refresh lockfile
32
+ run: uv lock
33
+
34
+ - name: Commit and push uv.lock
35
+ run: |
36
+ if git diff --quiet -- uv.lock; then
37
+ echo "uv.lock already up to date"
38
+ exit 0
39
+ fi
40
+
41
+ git config user.name "github-actions[bot]"
42
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
43
+ git add uv.lock
44
+ git commit -m "chore: refresh uv.lock"
45
+ git push
46
+
47
+ - name: Fetch Dependabot metadata
48
+ id: metadata
49
+ uses: dependabot/fetch-metadata@v3
50
+ with:
51
+ github-token: ${{ secrets.GITHUB_TOKEN }}
52
+
53
+ - name: Approve PR
54
+ run: gh pr review --approve "$PR_URL"
55
+ env:
56
+ PR_URL: ${{ github.event.pull_request.html_url }}
57
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58
+
59
+ - name: Enable auto-merge (squash)
60
+ run: gh pr merge --auto --squash "$PR_URL"
61
+ env:
62
+ PR_URL: ${{ github.event.pull_request.html_url }}
63
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}