glinet4 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.
- glinet4-0.1.0/.env.example +7 -0
- glinet4-0.1.0/.github/workflows/ci.yml +31 -0
- glinet4-0.1.0/.github/workflows/codeql.yml +100 -0
- glinet4-0.1.0/.github/workflows/dependency-review.yml +39 -0
- glinet4-0.1.0/.github/workflows/publish.yml +66 -0
- glinet4-0.1.0/.github/workflows/pylint.yml +25 -0
- glinet4-0.1.0/.gitignore +141 -0
- glinet4-0.1.0/LICENSE +674 -0
- glinet4-0.1.0/NOTICE +10 -0
- glinet4-0.1.0/PKG-INFO +73 -0
- glinet4-0.1.0/README.md +54 -0
- glinet4-0.1.0/docs/superpowers/plans/2026-06-26-api-transport-boundary.md +1479 -0
- glinet4-0.1.0/docs/superpowers/specs/2026-06-26-api-transport-boundary-design.md +224 -0
- glinet4-0.1.0/examples.md +311 -0
- glinet4-0.1.0/glinet4/__init__.py +82 -0
- glinet4-0.1.0/glinet4/_transport.py +159 -0
- glinet4-0.1.0/glinet4/_types.py +334 -0
- glinet4-0.1.0/glinet4/enums.py +13 -0
- glinet4-0.1.0/glinet4/error_codes.py +15 -0
- glinet4-0.1.0/glinet4/error_handling.py +66 -0
- glinet4-0.1.0/glinet4/glinet.py +729 -0
- glinet4-0.1.0/glinet4/py.typed +0 -0
- glinet4-0.1.0/pyproject.toml +61 -0
- glinet4-0.1.0/tests/__init__.py +0 -0
- glinet4-0.1.0/tests/test_enums.py +12 -0
- glinet4-0.1.0/tests/test_glinet.py +641 -0
- glinet4-0.1.0/tests/test_glinet_unit.py +766 -0
- glinet4-0.1.0/tests/test_transport.py +93 -0
- glinet4-0.1.0/uv.lock +1245 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Copy to .env and fill in to run the live router tests (`uv run pytest`).
|
|
2
|
+
# .env is git-ignored. Without GLINET_PASSWORD the live suite is skipped.
|
|
3
|
+
GLINET_HOST=http://192.168.8.1
|
|
4
|
+
GLINET_USERNAME=root
|
|
5
|
+
GLINET_PASSWORD=
|
|
6
|
+
# Set truthy (1/true/yes) to also run disruptive tests (reboot, VPN toggles).
|
|
7
|
+
GLINET_RUN_DISRUPTIVE=
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [dev, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [dev, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v6
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: uv sync
|
|
24
|
+
- name: Ruff lint
|
|
25
|
+
run: uv run ruff check .
|
|
26
|
+
- name: Ruff format check
|
|
27
|
+
run: uv run ruff format --check .
|
|
28
|
+
- name: Mypy (strict)
|
|
29
|
+
run: uv run mypy glinet4
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: uv run pytest -v
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL Advanced"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ "master" ]
|
|
17
|
+
pull_request:
|
|
18
|
+
branches: [ "master" ]
|
|
19
|
+
schedule:
|
|
20
|
+
- cron: '23 18 * * 0'
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
analyze:
|
|
24
|
+
name: Analyze (${{ matrix.language }})
|
|
25
|
+
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
|
26
|
+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
|
27
|
+
# - https://gh.io/supported-runners-and-hardware-resources
|
|
28
|
+
# - https://gh.io/using-larger-runners (GitHub.com only)
|
|
29
|
+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
|
|
30
|
+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
|
31
|
+
permissions:
|
|
32
|
+
# required for all workflows
|
|
33
|
+
security-events: write
|
|
34
|
+
|
|
35
|
+
# required to fetch internal or private CodeQL packs
|
|
36
|
+
packages: read
|
|
37
|
+
|
|
38
|
+
# only required for workflows in private repositories
|
|
39
|
+
actions: read
|
|
40
|
+
contents: read
|
|
41
|
+
|
|
42
|
+
strategy:
|
|
43
|
+
fail-fast: false
|
|
44
|
+
matrix:
|
|
45
|
+
include:
|
|
46
|
+
- language: actions
|
|
47
|
+
build-mode: none
|
|
48
|
+
- language: python
|
|
49
|
+
build-mode: none
|
|
50
|
+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
|
|
51
|
+
# Use `c-cpp` to analyze code written in C, C++ or both
|
|
52
|
+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
|
|
53
|
+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
|
|
54
|
+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
|
|
55
|
+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
|
|
56
|
+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
|
|
57
|
+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
|
|
58
|
+
steps:
|
|
59
|
+
- name: Checkout repository
|
|
60
|
+
uses: actions/checkout@v4
|
|
61
|
+
|
|
62
|
+
# Add any setup steps before running the `github/codeql-action/init` action.
|
|
63
|
+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
|
|
64
|
+
# or others). This is typically only required for manual builds.
|
|
65
|
+
# - name: Setup runtime (example)
|
|
66
|
+
# uses: actions/setup-example@v1
|
|
67
|
+
|
|
68
|
+
# Initializes the CodeQL tools for scanning.
|
|
69
|
+
- name: Initialize CodeQL
|
|
70
|
+
uses: github/codeql-action/init@v3
|
|
71
|
+
with:
|
|
72
|
+
languages: ${{ matrix.language }}
|
|
73
|
+
build-mode: ${{ matrix.build-mode }}
|
|
74
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
75
|
+
# By default, queries listed here will override any specified in a config file.
|
|
76
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
77
|
+
|
|
78
|
+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
|
79
|
+
# queries: security-extended,security-and-quality
|
|
80
|
+
|
|
81
|
+
# If the analyze step fails for one of the languages you are analyzing with
|
|
82
|
+
# "We were unable to automatically build your code", modify the matrix above
|
|
83
|
+
# to set the build mode to "manual" for that language. Then modify this step
|
|
84
|
+
# to build your code.
|
|
85
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
86
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
87
|
+
- if: matrix.build-mode == 'manual'
|
|
88
|
+
shell: bash
|
|
89
|
+
run: |
|
|
90
|
+
echo 'If you are using a "manual" build mode for one or more of the' \
|
|
91
|
+
'languages you are analyzing, replace this with the commands to build' \
|
|
92
|
+
'your code, for example:'
|
|
93
|
+
echo ' make bootstrap'
|
|
94
|
+
echo ' make release'
|
|
95
|
+
exit 1
|
|
96
|
+
|
|
97
|
+
- name: Perform CodeQL Analysis
|
|
98
|
+
uses: github/codeql-action/analyze@v3
|
|
99
|
+
with:
|
|
100
|
+
category: "/language:${{matrix.language}}"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Dependency Review Action
|
|
2
|
+
#
|
|
3
|
+
# This Action will scan dependency manifest files that change as part of a Pull Request,
|
|
4
|
+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
|
|
5
|
+
# Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable
|
|
6
|
+
# packages will be blocked from merging.
|
|
7
|
+
#
|
|
8
|
+
# Source repository: https://github.com/actions/dependency-review-action
|
|
9
|
+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
|
|
10
|
+
name: 'Dependency review'
|
|
11
|
+
on:
|
|
12
|
+
pull_request:
|
|
13
|
+
branches: [ "master" ]
|
|
14
|
+
|
|
15
|
+
# If using a dependency submission action in this workflow this permission will need to be set to:
|
|
16
|
+
#
|
|
17
|
+
# permissions:
|
|
18
|
+
# contents: write
|
|
19
|
+
#
|
|
20
|
+
# https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
|
|
24
|
+
pull-requests: write
|
|
25
|
+
|
|
26
|
+
jobs:
|
|
27
|
+
dependency-review:
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- name: 'Checkout repository'
|
|
31
|
+
uses: actions/checkout@v4
|
|
32
|
+
- name: 'Dependency Review'
|
|
33
|
+
uses: actions/dependency-review-action@v4
|
|
34
|
+
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
|
|
35
|
+
with:
|
|
36
|
+
comment-summary-in-pr: always
|
|
37
|
+
# fail-on-severity: moderate
|
|
38
|
+
# deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later
|
|
39
|
+
# retry-on-snapshot-warnings: true
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload Python Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
release-build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Install uv
|
|
26
|
+
uses: astral-sh/setup-uv@v6
|
|
27
|
+
|
|
28
|
+
- name: Build release distributions
|
|
29
|
+
run: uv build
|
|
30
|
+
|
|
31
|
+
- name: Upload distributions
|
|
32
|
+
uses: actions/upload-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: release-dists
|
|
35
|
+
path: dist/
|
|
36
|
+
|
|
37
|
+
pypi-publish:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
needs:
|
|
40
|
+
- release-build
|
|
41
|
+
permissions:
|
|
42
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
43
|
+
id-token: write
|
|
44
|
+
|
|
45
|
+
# Dedicated environments with protections for publishing are strongly recommended.
|
|
46
|
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
47
|
+
environment:
|
|
48
|
+
name: pypi
|
|
49
|
+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
|
|
50
|
+
url: https://pypi.org/project/glinet4/
|
|
51
|
+
#
|
|
52
|
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
|
|
53
|
+
# ALTERNATIVE: exactly, uncomment the following line instead:
|
|
54
|
+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
|
|
55
|
+
|
|
56
|
+
steps:
|
|
57
|
+
- name: Retrieve release distributions
|
|
58
|
+
uses: actions/download-artifact@v4
|
|
59
|
+
with:
|
|
60
|
+
name: release-dists
|
|
61
|
+
path: dist/
|
|
62
|
+
|
|
63
|
+
- name: Publish release distributions to PyPI
|
|
64
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
65
|
+
with:
|
|
66
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Pylint
|
|
2
|
+
|
|
3
|
+
on: [push,pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
python-version: ["3.13"]
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
14
|
+
uses: actions/setup-python@v3
|
|
15
|
+
with:
|
|
16
|
+
python-version: ${{ matrix.python-version }}
|
|
17
|
+
- name: Install dependencies
|
|
18
|
+
run: |
|
|
19
|
+
python -m pip install --upgrade pip
|
|
20
|
+
pip install pylint
|
|
21
|
+
- name: Analysing the code with pylint
|
|
22
|
+
# Over time, bring into line with https://github.com/home-assistant/core/blob/4be2e84ce65de68883f16770818cf2e354cd6cc7/pyproject.toml#L276
|
|
23
|
+
# At the moment we are disabling fix-me
|
|
24
|
+
run: |
|
|
25
|
+
pylint --disable=import-error,fixme,line-too-long,invalid-name,too-many-public-methods,abstract-method,overridden-final-method,too-many-instance-attributes,too-many-public-methods,too-few-public-methods,too-many-branches $(git ls-files '*.py')
|
glinet4-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
#vscode
|
|
7
|
+
.vscode/
|
|
8
|
+
|
|
9
|
+
#secrets
|
|
10
|
+
tests/router_pwd
|
|
11
|
+
tests/example_token
|
|
12
|
+
router_pwd
|
|
13
|
+
example_token
|
|
14
|
+
|
|
15
|
+
# C extensions
|
|
16
|
+
*.so
|
|
17
|
+
|
|
18
|
+
# Distribution / packaging
|
|
19
|
+
.Python
|
|
20
|
+
build/
|
|
21
|
+
develop-eggs/
|
|
22
|
+
dist/
|
|
23
|
+
downloads/
|
|
24
|
+
eggs/
|
|
25
|
+
.eggs/
|
|
26
|
+
lib/
|
|
27
|
+
lib64/
|
|
28
|
+
parts/
|
|
29
|
+
sdist/
|
|
30
|
+
var/
|
|
31
|
+
wheels/
|
|
32
|
+
pip-wheel-metadata/
|
|
33
|
+
share/python-wheels/
|
|
34
|
+
*.egg-info/
|
|
35
|
+
.installed.cfg
|
|
36
|
+
*.egg
|
|
37
|
+
MANIFEST
|
|
38
|
+
|
|
39
|
+
# PyInstaller
|
|
40
|
+
# Usually these files are written by a python script from a template
|
|
41
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
42
|
+
*.manifest
|
|
43
|
+
*.spec
|
|
44
|
+
|
|
45
|
+
# Installer logs
|
|
46
|
+
pip-log.txt
|
|
47
|
+
pip-delete-this-directory.txt
|
|
48
|
+
|
|
49
|
+
# Unit test / coverage reports
|
|
50
|
+
htmlcov/
|
|
51
|
+
.tox/
|
|
52
|
+
.nox/
|
|
53
|
+
.coverage
|
|
54
|
+
.coverage.*
|
|
55
|
+
.cache
|
|
56
|
+
nosetests.xml
|
|
57
|
+
coverage.xml
|
|
58
|
+
*.cover
|
|
59
|
+
*.py,cover
|
|
60
|
+
.hypothesis/
|
|
61
|
+
.pytest_cache/
|
|
62
|
+
|
|
63
|
+
# Translations
|
|
64
|
+
*.mo
|
|
65
|
+
*.pot
|
|
66
|
+
|
|
67
|
+
# Django stuff:
|
|
68
|
+
*.log
|
|
69
|
+
local_settings.py
|
|
70
|
+
db.sqlite3
|
|
71
|
+
db.sqlite3-journal
|
|
72
|
+
|
|
73
|
+
# Flask stuff:
|
|
74
|
+
instance/
|
|
75
|
+
.webassets-cache
|
|
76
|
+
|
|
77
|
+
# Scrapy stuff:
|
|
78
|
+
.scrapy
|
|
79
|
+
|
|
80
|
+
# Sphinx documentation
|
|
81
|
+
docs/_build/
|
|
82
|
+
|
|
83
|
+
# PyBuilder
|
|
84
|
+
target/
|
|
85
|
+
|
|
86
|
+
# Jupyter Notebook
|
|
87
|
+
.ipynb_checkpoints
|
|
88
|
+
|
|
89
|
+
# IPython
|
|
90
|
+
profile_default/
|
|
91
|
+
ipython_config.py
|
|
92
|
+
|
|
93
|
+
# pyenv
|
|
94
|
+
.python-version
|
|
95
|
+
|
|
96
|
+
# pipenv
|
|
97
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
98
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
99
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
100
|
+
# install all needed dependencies.
|
|
101
|
+
#Pipfile.lock
|
|
102
|
+
|
|
103
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
104
|
+
__pypackages__/
|
|
105
|
+
|
|
106
|
+
# Celery stuff
|
|
107
|
+
celerybeat-schedule
|
|
108
|
+
celerybeat.pid
|
|
109
|
+
|
|
110
|
+
# SageMath parsed files
|
|
111
|
+
*.sage.py
|
|
112
|
+
|
|
113
|
+
# Environments
|
|
114
|
+
.env
|
|
115
|
+
.venv
|
|
116
|
+
env/
|
|
117
|
+
venv/
|
|
118
|
+
ENV/
|
|
119
|
+
env.bak/
|
|
120
|
+
venv.bak/
|
|
121
|
+
|
|
122
|
+
# Spyder project settings
|
|
123
|
+
.spyderproject
|
|
124
|
+
.spyproject
|
|
125
|
+
|
|
126
|
+
# Rope project settings
|
|
127
|
+
.ropeproject
|
|
128
|
+
|
|
129
|
+
# mkdocs documentation
|
|
130
|
+
/site
|
|
131
|
+
|
|
132
|
+
# mypy
|
|
133
|
+
.mypy_cache/
|
|
134
|
+
.dmypy.json
|
|
135
|
+
dmypy.json
|
|
136
|
+
|
|
137
|
+
# Pyre type checker
|
|
138
|
+
.pyre/
|
|
139
|
+
|
|
140
|
+
# local device captures may contain unsanitised WAN details; regenerate via glinet-profiler
|
|
141
|
+
docs/devices/
|