pygira 0.0.1__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.
- pygira-0.0.1/.github/dependabot.yml +20 -0
- pygira-0.0.1/.github/workflows/ci.yml +60 -0
- pygira-0.0.1/.github/workflows/publish.yml +30 -0
- pygira-0.0.1/.gitignore +33 -0
- pygira-0.0.1/.pre-commit-config.yaml +32 -0
- pygira-0.0.1/.python-version +1 -0
- pygira-0.0.1/CONTRIBUTING.md +57 -0
- pygira-0.0.1/LICENSE +674 -0
- pygira-0.0.1/PKG-INFO +276 -0
- pygira-0.0.1/README.md +245 -0
- pygira-0.0.1/TODO.md +19 -0
- pygira-0.0.1/devices.toml.example +28 -0
- pygira-0.0.1/pyproject.toml +151 -0
- pygira-0.0.1/src/pygira/__init__.py +1 -0
- pygira-0.0.1/src/pygira/_http.py +142 -0
- pygira-0.0.1/src/pygira/api.py +292 -0
- pygira-0.0.1/src/pygira/cli.py +49 -0
- pygira-0.0.1/src/pygira/commands/__init__.py +1 -0
- pygira-0.0.1/src/pygira/commands/bootstrap.py +246 -0
- pygira-0.0.1/src/pygira/commands/config.py +232 -0
- pygira-0.0.1/src/pygira/commands/device.py +547 -0
- pygira-0.0.1/src/pygira/commands/firmware.py +163 -0
- pygira-0.0.1/src/pygira/commands/gds.py +219 -0
- pygira-0.0.1/src/pygira/commands/maintenance.py +604 -0
- pygira-0.0.1/src/pygira/config_service.py +394 -0
- pygira-0.0.1/src/pygira/context.py +206 -0
- pygira-0.0.1/src/pygira/core/__init__.py +1 -0
- pygira-0.0.1/src/pygira/core/detect.py +84 -0
- pygira-0.0.1/src/pygira/core/resolve.py +29 -0
- pygira-0.0.1/src/pygira/core/types.py +29 -0
- pygira-0.0.1/src/pygira/devices/__init__.py +1 -0
- pygira-0.0.1/src/pygira/devices/base.py +17 -0
- pygira-0.0.1/src/pygira/devices/g1.py +162 -0
- pygira-0.0.1/src/pygira/devices/registry.py +16 -0
- pygira-0.0.1/src/pygira/devices/x1.py +165 -0
- pygira-0.0.1/src/pygira/gds.py +342 -0
- pygira-0.0.1/src/pygira/models.py +105 -0
- pygira-0.0.1/src/pygira/options.py +84 -0
- pygira-0.0.1/src/pygira/tks_web.py +188 -0
- pygira-0.0.1/src/pygira/transports/__init__.py +1 -0
- pygira-0.0.1/src/pygira/transports/api.py +5 -0
- pygira-0.0.1/src/pygira/transports/config_service.py +17 -0
- pygira-0.0.1/src/pygira/transports/gds.py +5 -0
- pygira-0.0.1/src/pygira/weather.py +70 -0
- pygira-0.0.1/tests/__init__.py +0 -0
- pygira-0.0.1/tests/_httpmock.py +207 -0
- pygira-0.0.1/tests/fixtures.py +189 -0
- pygira-0.0.1/tests/test_api.py +383 -0
- pygira-0.0.1/tests/test_cli_gds.py +277 -0
- pygira-0.0.1/tests/test_config_cli.py +162 -0
- pygira-0.0.1/tests/test_config_service.py +311 -0
- pygira-0.0.1/tests/test_device_detection.py +92 -0
- pygira-0.0.1/tests/test_gds.py +504 -0
- pygira-0.0.1/tests/test_maintenance_cli.py +39 -0
- pygira-0.0.1/tests/test_tks_web.py +167 -0
- pygira-0.0.1/tests/test_weather.py +218 -0
- pygira-0.0.1/tests/test_x1_program.py +127 -0
- pygira-0.0.1/uv.lock +1273 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: github-actions
|
|
4
|
+
directory: /
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
groups:
|
|
8
|
+
actions:
|
|
9
|
+
patterns:
|
|
10
|
+
- "*"
|
|
11
|
+
|
|
12
|
+
- package-ecosystem: uv
|
|
13
|
+
directory: /
|
|
14
|
+
schedule:
|
|
15
|
+
interval: weekly
|
|
16
|
+
groups:
|
|
17
|
+
python-minor-patch:
|
|
18
|
+
update-types:
|
|
19
|
+
- minor
|
|
20
|
+
- patch
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
quality:
|
|
13
|
+
name: Python ${{ matrix.python-version }}
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Check out repository
|
|
22
|
+
uses: actions/checkout@v7
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@v7
|
|
28
|
+
with:
|
|
29
|
+
enable-cache: true
|
|
30
|
+
|
|
31
|
+
- name: Set up Python
|
|
32
|
+
uses: actions/setup-python@v6
|
|
33
|
+
with:
|
|
34
|
+
python-version: ${{ matrix.python-version }}
|
|
35
|
+
|
|
36
|
+
- name: Install dependencies
|
|
37
|
+
run: uv sync --locked --group dev
|
|
38
|
+
|
|
39
|
+
- name: Ruff lint
|
|
40
|
+
run: uv run ruff check src/ tests/
|
|
41
|
+
|
|
42
|
+
- name: Ruff format check
|
|
43
|
+
run: uv run ruff format --check src/ tests/
|
|
44
|
+
|
|
45
|
+
- name: Mypy type check
|
|
46
|
+
run: uv run mypy src/
|
|
47
|
+
|
|
48
|
+
- name: Tests with coverage
|
|
49
|
+
run: uv run pytest
|
|
50
|
+
|
|
51
|
+
- name: Build distributions
|
|
52
|
+
run: uv build
|
|
53
|
+
|
|
54
|
+
- name: Report diff coverage on pull requests
|
|
55
|
+
if: github.event_name == 'pull_request'
|
|
56
|
+
run: uv run diff-cover coverage.xml --compare-branch origin/${{ github.base_ref }} --fail-under=0
|
|
57
|
+
|
|
58
|
+
- name: Report diff coverage on pushes
|
|
59
|
+
if: github.event_name == 'push' && github.event.before != '0000000000000000000000000000000000000000'
|
|
60
|
+
run: uv run diff-cover coverage.xml --compare-branch ${{ github.event.before }} --fail-under=0
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment: pypi
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
id-token: write
|
|
17
|
+
steps:
|
|
18
|
+
- name: Check out repository
|
|
19
|
+
uses: actions/checkout@v7
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v7
|
|
25
|
+
|
|
26
|
+
- name: Build distributions
|
|
27
|
+
run: uv build
|
|
28
|
+
|
|
29
|
+
- name: Publish to PyPI
|
|
30
|
+
run: uv publish --trusted-publishing always
|
pygira-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Device credentials — never commit
|
|
14
|
+
devices.toml
|
|
15
|
+
|
|
16
|
+
# Logs and other temporary files
|
|
17
|
+
.tmp/
|
|
18
|
+
|
|
19
|
+
# Tool caches and OS files
|
|
20
|
+
.mypy_cache/
|
|
21
|
+
.pytest_cache/
|
|
22
|
+
.ruff_cache/
|
|
23
|
+
.DS_Store
|
|
24
|
+
|
|
25
|
+
# Coverage reports
|
|
26
|
+
.coverage
|
|
27
|
+
coverage.xml
|
|
28
|
+
htmlcov/
|
|
29
|
+
|
|
30
|
+
# Local-only
|
|
31
|
+
firmware/
|
|
32
|
+
research/
|
|
33
|
+
.omo/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: local
|
|
3
|
+
hooks:
|
|
4
|
+
- id: ruff-check
|
|
5
|
+
name: ruff check
|
|
6
|
+
entry: uv run ruff check src/ tests/
|
|
7
|
+
language: system
|
|
8
|
+
pass_filenames: false
|
|
9
|
+
|
|
10
|
+
- id: ruff-format-check
|
|
11
|
+
name: ruff format --check
|
|
12
|
+
entry: uv run ruff format --check src/ tests/
|
|
13
|
+
language: system
|
|
14
|
+
pass_filenames: false
|
|
15
|
+
|
|
16
|
+
- id: mypy
|
|
17
|
+
name: mypy
|
|
18
|
+
entry: uv run mypy src/
|
|
19
|
+
language: system
|
|
20
|
+
pass_filenames: false
|
|
21
|
+
|
|
22
|
+
- id: pytest-coverage
|
|
23
|
+
name: pytest with coverage
|
|
24
|
+
entry: uv run pytest
|
|
25
|
+
language: system
|
|
26
|
+
pass_filenames: false
|
|
27
|
+
|
|
28
|
+
- id: diff-coverage
|
|
29
|
+
name: diff coverage against HEAD
|
|
30
|
+
entry: uv run diff-cover coverage.xml --compare-branch HEAD --fail-under=0
|
|
31
|
+
language: system
|
|
32
|
+
pass_filenames: false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.14
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Development setup
|
|
4
|
+
|
|
5
|
+
This project uses `uv` for dependency management and command execution. Supported Python versions are 3.10 through 3.14, and CI runs the full quality gate on each supported version.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv sync --group dev
|
|
9
|
+
uv run pre-commit install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Device credentials live in `devices.toml`, which is intentionally ignored by Git. Use `uv run pygira config init`, `uv run pygira config add-device ...`, and `uv run pygira config validate` to manage local device entries. `devices.toml.example` shows the direct-device and optional-location TOML shape.
|
|
13
|
+
|
|
14
|
+
## Required checks
|
|
15
|
+
|
|
16
|
+
Every commit should be clean for linting, formatting, type checking, tests, and diff coverage.
|
|
17
|
+
The local pre-commit hooks run the same gates that CI runs:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv run ruff check src/ tests/
|
|
21
|
+
uv run ruff format --check src/ tests/
|
|
22
|
+
uv run mypy src/
|
|
23
|
+
uv run pytest
|
|
24
|
+
uv run diff-cover coverage.xml --compare-branch HEAD --fail-under=0
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`pytest` writes `coverage.xml`; run it before `diff-cover` if you invoke the commands manually.
|
|
28
|
+
Overall coverage must stay at or above the configured floor. Diff coverage reports measure
|
|
29
|
+
how well new or changed executable lines are covered; raise the `--fail-under` value when
|
|
30
|
+
you are ready to make changed-line coverage a hard ratchet.
|
|
31
|
+
|
|
32
|
+
## Adding a command
|
|
33
|
+
|
|
34
|
+
All commands follow the same pattern: decorate with `@common_options`, call
|
|
35
|
+
`resolve_login()` first, construct `ApiClient` with `profile.api_prefix`, and
|
|
36
|
+
wrap the body in `try/except Exception as e: die(e)`. Commands are registered
|
|
37
|
+
via `register(main)` in each file under `src/pygira/commands/` and wired in
|
|
38
|
+
`cli.py`.
|
|
39
|
+
|
|
40
|
+
`resolve_login()` pulls credentials from `devices.toml` when `--apartment` is
|
|
41
|
+
given, or prompts interactively. G1-only features must call
|
|
42
|
+
`require_capability()` before using the GDS transport.
|
|
43
|
+
|
|
44
|
+
## Test infrastructure
|
|
45
|
+
|
|
46
|
+
Tests use the custom HTTP mock in `tests/_httpmock.py` (not respx/responses —
|
|
47
|
+
those only intercept httpx; this project uses a stdlib-based `_http.py` shim).
|
|
48
|
+
Use the `@mock` decorator or `with mock:` context, then register routes with
|
|
49
|
+
`respx.get(url)`, `respx.post(url)`, etc. Shared fixture data lives in
|
|
50
|
+
`tests/fixtures.py`.
|
|
51
|
+
|
|
52
|
+
## Pull requests
|
|
53
|
+
|
|
54
|
+
- Keep pull requests focused and small enough to review.
|
|
55
|
+
- Add or update tests for changed behavior.
|
|
56
|
+
- Do not commit credentials, firmware dumps, local device IPs, or generated cache files.
|
|
57
|
+
- Wait for the GitHub Actions CI workflow to pass before merging.
|