pycityvisitorparking 0.2.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.
- pycityvisitorparking-0.2.0/.devcontainer/devcontainer.json +22 -0
- pycityvisitorparking-0.2.0/.github/workflows/ci.yml +50 -0
- pycityvisitorparking-0.2.0/.github/workflows/release.yml +37 -0
- pycityvisitorparking-0.2.0/.gitignore +207 -0
- pycityvisitorparking-0.2.0/.vscode/extensions.json +10 -0
- pycityvisitorparking-0.2.0/.vscode/settings.json +19 -0
- pycityvisitorparking-0.2.0/AGENTS.md +133 -0
- pycityvisitorparking-0.2.0/CHANGELOG.md +14 -0
- pycityvisitorparking-0.2.0/LICENSE +21 -0
- pycityvisitorparking-0.2.0/PKG-INFO +115 -0
- pycityvisitorparking-0.2.0/README.md +82 -0
- pycityvisitorparking-0.2.0/docs/RELEASING.md +139 -0
- pycityvisitorparking-0.2.0/docs/provider-template/CHANGELOG.md +5 -0
- pycityvisitorparking-0.2.0/docs/provider-template/README.md +30 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/__init__.py +28 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/_version.py +3 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/client.py +83 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/exceptions.py +21 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/models.py +40 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/AGENTS.md +130 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/README.md +173 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/__init__.py +1 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/base.py +280 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/dvsportal/CHANGELOG.md +5 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/dvsportal/README.md +119 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/dvsportal/__init__.py +5 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/dvsportal/api.py +637 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/dvsportal/const.py +19 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/dvsportal/manifest.json +5 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/dvsportal/tests/test_mapping.py +186 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/loader.py +90 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/manifest.schema.json +19 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/the_hague/CHANGELOG.md +5 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/the_hague/README.md +75 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/the_hague/__init__.py +5 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/the_hague/api.py +483 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/the_hague/const.py +17 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/the_hague/manifest.json +5 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/provider/the_hague/tests/test_mapping.py +105 -0
- pycityvisitorparking-0.2.0/pycityvisitorparking/util.py +103 -0
- pycityvisitorparking-0.2.0/pyproject.toml +140 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pyCityVisitorParking",
|
|
3
|
+
"image": "mcr.microsoft.com/devcontainers/python:1-3.13",
|
|
4
|
+
"features": {
|
|
5
|
+
"ghcr.io/devcontainers/features/git:1": {},
|
|
6
|
+
"ghcr.io/devcontainers/features/github-cli:1": {}
|
|
7
|
+
},
|
|
8
|
+
"postCreateCommand": "python -m pip install -U pip && pip install -e '.[dev]' && pre-commit install",
|
|
9
|
+
"customizations": {
|
|
10
|
+
"vscode": {
|
|
11
|
+
"extensions": [
|
|
12
|
+
"ms-python.python",
|
|
13
|
+
"ms-python.vscode-pylance",
|
|
14
|
+
"charliermarsh.ruff",
|
|
15
|
+
"editorconfig.editorconfig",
|
|
16
|
+
"github.vscode-github-actions",
|
|
17
|
+
"openai.chatgpt"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"remoteUser": "vscode"
|
|
22
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: ["main"]
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v6
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.13"
|
|
23
|
+
cache: "pip"
|
|
24
|
+
|
|
25
|
+
- name: Install Hatch
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
python -m pip install hatch
|
|
29
|
+
|
|
30
|
+
- name: Lint (ruff)
|
|
31
|
+
run: |
|
|
32
|
+
hatch run lint:check
|
|
33
|
+
hatch run lint:format-check
|
|
34
|
+
|
|
35
|
+
- name: Type check (pyright)
|
|
36
|
+
run: |
|
|
37
|
+
hatch run typecheck:run
|
|
38
|
+
|
|
39
|
+
- name: Tests
|
|
40
|
+
run: |
|
|
41
|
+
hatch run test:run
|
|
42
|
+
|
|
43
|
+
- name: Build (sdist + wheel)
|
|
44
|
+
run: |
|
|
45
|
+
hatch build
|
|
46
|
+
|
|
47
|
+
- name: Verify dist metadata
|
|
48
|
+
run: |
|
|
49
|
+
python -m pip install --upgrade twine
|
|
50
|
+
python -m twine check dist/*
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v6
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v6
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.13"
|
|
24
|
+
cache: "pip"
|
|
25
|
+
|
|
26
|
+
- name: Install build tooling
|
|
27
|
+
run: |
|
|
28
|
+
python -m pip install --upgrade pip
|
|
29
|
+
python -m pip install hatch twine
|
|
30
|
+
|
|
31
|
+
- name: Build
|
|
32
|
+
run: |
|
|
33
|
+
hatch build
|
|
34
|
+
python -m twine check dist/*
|
|
35
|
+
|
|
36
|
+
- name: Publish to PyPI
|
|
37
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"python.testing.pytestEnabled": true,
|
|
3
|
+
"python.testing.pytestArgs": ["tests"],
|
|
4
|
+
|
|
5
|
+
"editor.formatOnSave": true,
|
|
6
|
+
"editor.defaultFormatter": "charliermarsh.ruff",
|
|
7
|
+
|
|
8
|
+
"editor.codeActionsOnSave": {
|
|
9
|
+
"source.fixAll.ruff": "explicit",
|
|
10
|
+
"source.organizeImports.ruff": "explicit"
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
"files.insertFinalNewline": true,
|
|
14
|
+
"files.trimTrailingWhitespace": true,
|
|
15
|
+
|
|
16
|
+
"python.analysis.typeCheckingMode": "basic",
|
|
17
|
+
"python.analysis.autoSearchPaths": true,
|
|
18
|
+
"python.analysis.extraPaths": ["src"]
|
|
19
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# AGENT.md — Development Guide (pyCityVisitorParking)
|
|
2
|
+
|
|
3
|
+
✅ **Build an async Home Assistant–friendly API library (Python 3.13)**
|
|
4
|
+
- Build an async Python library that standardizes Dutch municipal “visitor parking” operations for Home Assistant.
|
|
5
|
+
- Target Python 3.13 and set `requires-python = ">=3.13"`.
|
|
6
|
+
|
|
7
|
+
✅ **Use English as the primary project language**
|
|
8
|
+
- Write all documentation, comments, docstrings, commit messages, and changelogs in English.
|
|
9
|
+
- Use Dutch only when quoting provider UI text or official municipality wording, and label it clearly.
|
|
10
|
+
|
|
11
|
+
✅ **Maintain root documentation and changelog**
|
|
12
|
+
- Maintain root `README.md`.
|
|
13
|
+
- Maintain root `CHANGELOG.md`.
|
|
14
|
+
- Keep an “Unreleased” section and move entries into a versioned section on release.
|
|
15
|
+
- Update root `CHANGELOG.md` on every release.
|
|
16
|
+
|
|
17
|
+
✅ **Require docstrings and clear comments**
|
|
18
|
+
- Add docstrings for all public modules, classes, and methods.
|
|
19
|
+
- Add clear inline comments for non-obvious logic (e.g., time/UTC conversion, normalization, fallback behavior).
|
|
20
|
+
- Keep comments/docstrings free of credentials, tokens, or other PII.
|
|
21
|
+
|
|
22
|
+
✅ **Enforce project rules without exceptions**
|
|
23
|
+
- Use an async-only public API.
|
|
24
|
+
- Use `aiohttp` for all HTTP communication.
|
|
25
|
+
- ❌ Avoid third-party provider plugins.
|
|
26
|
+
- ❌ Avoid entry points.
|
|
27
|
+
- Keep providers inside `src/pycityvisitorparking/provider/<provider_id>/`.
|
|
28
|
+
- Allow adding a provider by changing only `provider/<provider_id>/...`.
|
|
29
|
+
- Discover providers without importing provider code.
|
|
30
|
+
- Keep public models strict and ❌ avoid provider-specific fields.
|
|
31
|
+
|
|
32
|
+
✅ **Use the required repository layout**
|
|
33
|
+
- Use `src/` layout.
|
|
34
|
+
- Keep core code in `src/pycityvisitorparking/`.
|
|
35
|
+
- Keep provider code in `src/pycityvisitorparking/provider/<provider_id>/`.
|
|
36
|
+
- Keep `manifest.schema.json` in `src/pycityvisitorparking/provider/`.
|
|
37
|
+
- Keep root `README.md` and `CHANGELOG.md` at repository root.
|
|
38
|
+
- Keep per-provider `README.md` and `CHANGELOG.md` inside each provider folder.
|
|
39
|
+
|
|
40
|
+
✅ **Implement the public Client facade**
|
|
41
|
+
- Expose `Client` in `client.py`.
|
|
42
|
+
- Implement `list_providers()` by reading manifests without importing provider modules.
|
|
43
|
+
- Implement `get_provider(provider_id, ...)` by importing only the selected provider on-demand.
|
|
44
|
+
- Support injecting an `aiohttp.ClientSession`.
|
|
45
|
+
- ❌ Avoid closing an injected session.
|
|
46
|
+
- Create an internal session only when not injected.
|
|
47
|
+
- Provide `async with Client(...)` and/or `await client.aclose()` for internal cleanup.
|
|
48
|
+
* Take `base_url` and `api_uri` as config inputs and pass them into providers.
|
|
49
|
+
* ❌ Avoid hardcoded endpoints; keep only relative paths/constants.
|
|
50
|
+
|
|
51
|
+
✅ **Define and enforce the provider interface**
|
|
52
|
+
- Define `BaseProvider` in `provider/base.py`.
|
|
53
|
+
- Require providers to implement standardized async methods for login, permit, reservations, and favorites.
|
|
54
|
+
- Implement core fallback behavior for `update_favorite` when native update is not supported.
|
|
55
|
+
|
|
56
|
+
✅ **Standardize time, license plates, and zone_validity**
|
|
57
|
+
- Return public timestamps as UTC ISO 8601 with `Z` and without microseconds.
|
|
58
|
+
- Convert provider-local/offset timestamps to UTC internally.
|
|
59
|
+
- Normalize license plates to uppercase `A–Z0–9` and remove spaces/special chars.
|
|
60
|
+
- Raise `ValidationError` for invalid or empty plates after normalization.
|
|
61
|
+
- Filter `zone_validity` to include only chargeable windows and filter out free windows.
|
|
62
|
+
|
|
63
|
+
✅ **Keep public dataclasses strict**
|
|
64
|
+
- Define public dataclasses only in `models.py`.
|
|
65
|
+
- Expose only:
|
|
66
|
+
- `ProviderInfo`
|
|
67
|
+
- `Permit`
|
|
68
|
+
- `ZoneValidityBlock`
|
|
69
|
+
- `Reservation`
|
|
70
|
+
- `Favorite`
|
|
71
|
+
- ❌ Avoid adding provider-specific metadata to public models.
|
|
72
|
+
|
|
73
|
+
✅ **Enforce validation rules**
|
|
74
|
+
- Require `start_time` and `end_time` for `start_reservation` and ❌ avoid defaults.
|
|
75
|
+
- Enforce `end_time > start_time` and raise `ValidationError` when violated.
|
|
76
|
+
- Treat IDs as opaque strings and ❌ avoid format assumptions.
|
|
77
|
+
- Ensure timestamps are parseable as timezone-aware UTC datetimes.
|
|
78
|
+
|
|
79
|
+
✅ **Use secure HTTP standards**
|
|
80
|
+
- Enable TLS verification.
|
|
81
|
+
- Enforce request timeouts.
|
|
82
|
+
- Map HTTP and provider errors to custom exceptions.
|
|
83
|
+
- ❌ Avoid leaking raw `aiohttp` exceptions into the public API.
|
|
84
|
+
- Apply retries only to idempotent GET requests and keep defaults conservative or disabled.
|
|
85
|
+
|
|
86
|
+
✅ **Implement controlled errors and safe logging**
|
|
87
|
+
- Define exceptions in `exceptions.py`.
|
|
88
|
+
- Provide at minimum: `AuthError`, `NetworkError`, `ValidationError`, `ProviderError`.
|
|
89
|
+
- ❌ Avoid including credentials, tokens, or PII in logs or exception messages.
|
|
90
|
+
- Mask license plates in logs when logging is necessary.
|
|
91
|
+
|
|
92
|
+
✅ **Implement provider discovery via manifests without imports**
|
|
93
|
+
- Require each provider to include `manifest.json` with `id`, `name`, and `favorite_update_possible`.
|
|
94
|
+
- Read manifests using `importlib.resources` without importing provider modules.
|
|
95
|
+
- Import provider modules only when selected by `get_provider()`.
|
|
96
|
+
|
|
97
|
+
✅ **Validate manifests via schema and fail CI on errors**
|
|
98
|
+
- Add `manifest.schema.json` in `src/pycityvisitorparking/provider/`.
|
|
99
|
+
- Validate every provider `manifest.json` against the schema.
|
|
100
|
+
- Add a test that validates all manifests and fail CI on schema errors.
|
|
101
|
+
|
|
102
|
+
✅ **Test without live calls**
|
|
103
|
+
- ❌ Avoid live municipal services in tests.
|
|
104
|
+
- Use fixtures and mocked HTTP responses.
|
|
105
|
+
- Add tests for normalization, UTC conversion, loader discovery, schema validation, and fallback behaviors.
|
|
106
|
+
|
|
107
|
+
✅ **Use Hatch for development, build, and publishing**
|
|
108
|
+
- Use Hatch as the single entrypoint for dev workflows.
|
|
109
|
+
- Run lint and format using Hatch environments.
|
|
110
|
+
- Run tests using Hatch environments.
|
|
111
|
+
- Build artifacts using `hatch build`.
|
|
112
|
+
- Validate artifacts using `python -m twine check dist/*`.
|
|
113
|
+
|
|
114
|
+
✅ **Verify documentation and pinned versions and correct assumptions**
|
|
115
|
+
- Check the current project documentation and the versions pinned in our lockfiles and CI.
|
|
116
|
+
- Update any assumptions immediately when documentation, lockfiles, and CI disagree.
|
|
117
|
+
- Align `requires-python`, Hatch environments, and CI matrices to the pinned versions.
|
|
118
|
+
- Prefer the repository as the source of truth for supported versions and tooling.
|
|
119
|
+
- Avoid “latest” installs in CI and keep dev tooling versions pinned.
|
|
120
|
+
|
|
121
|
+
✅ **Publish releases to PyPI in a controlled way (Hatch)**
|
|
122
|
+
- Bump versions using `hatch version <new>` or `hatch version <major|minor|patch>`.
|
|
123
|
+
- Update root `CHANGELOG.md` and move “Unreleased” entries into the new version section.
|
|
124
|
+
- Create a git tag `vX.Y.Z` and push it.
|
|
125
|
+
- Publish from CI on tags using trusted publishing (OIDC) when possible.
|
|
126
|
+
- ❌ Avoid manual local publishing when CI publish is available.
|
|
127
|
+
- Verify release contents include manifests, schema, and provider docs in `sdist`.
|
|
128
|
+
|
|
129
|
+
✅ **Apply release rules**
|
|
130
|
+
- Use SemVer and keep root `CHANGELOG.md` updated.
|
|
131
|
+
- Bump MINOR for provider additions.
|
|
132
|
+
- Bump PATCH for bug fixes.
|
|
133
|
+
- Tag releases and maintain a clear changelog history.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.2.0
|
|
6
|
+
|
|
7
|
+
- Add async client facade, provider interface, and provider discovery without imports.
|
|
8
|
+
- Add strict public models, normalization utilities, and validation helpers.
|
|
9
|
+
- Add manifest schema, loader utilities, and schema validation test.
|
|
10
|
+
- Add fallback behavior for favorite updates and zero-provider tests.
|
|
11
|
+
- Add documentation updates and pre-commit config for Ruff.
|
|
12
|
+
- Add base_url and api_uri support for provider requests using relative paths.
|
|
13
|
+
- Add The Hague provider implementation.
|
|
14
|
+
- Document DVS Portal municipality endpoints.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 sir-Unknown
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pycityvisitorparking
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Async integration layer between Home Assistant and Dutch municipal visitor parking APIs.
|
|
5
|
+
Project-URL: Homepage, https://github.com/sir-Unknown/pyCityVisitorParking
|
|
6
|
+
Project-URL: Repository, https://github.com/sir-Unknown/pyCityVisitorParking
|
|
7
|
+
Project-URL: Issues, https://github.com/sir-Unknown/pyCityVisitorParking/issues
|
|
8
|
+
Author: pyCityVisitorParking contributors
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: aiohttp,async,home-assistant,municipality,parking
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Framework :: AsyncIO
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
+
Classifier: Topic :: Home Automation
|
|
20
|
+
Requires-Python: >=3.13
|
|
21
|
+
Requires-Dist: aiohttp>=3.9
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: build; extra == 'dev'
|
|
24
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
25
|
+
Requires-Dist: jsonschema; extra == 'dev'
|
|
26
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
27
|
+
Requires-Dist: pyright==1.1.407; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
31
|
+
Requires-Dist: twine; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# pyCityVisitorParking
|
|
35
|
+
|
|
36
|
+
Async integration layer between Home Assistant and Dutch municipal visitor parking APIs.
|
|
37
|
+
|
|
38
|
+
## Status
|
|
39
|
+
|
|
40
|
+
This package ships the core client, provider interface, and discovery tooling,
|
|
41
|
+
plus the following providers:
|
|
42
|
+
|
|
43
|
+
- DVS Portal
|
|
44
|
+
- The Hague
|
|
45
|
+
|
|
46
|
+
`list_providers()` reads provider manifests under `src/pycityvisitorparking/provider/`.
|
|
47
|
+
|
|
48
|
+
Provider documentation:
|
|
49
|
+
|
|
50
|
+
- DVS Portal: [src/pycityvisitorparking/provider/dvsportal/README.md](src/pycityvisitorparking/provider/dvsportal/README.md)
|
|
51
|
+
- The Hague: [src/pycityvisitorparking/provider/the_hague/README.md](src/pycityvisitorparking/provider/the_hague/README.md)
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install pycityvisitorparking
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import asyncio
|
|
63
|
+
|
|
64
|
+
from pycityvisitorparking import Client
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
async def main() -> None:
|
|
68
|
+
async with Client() as client:
|
|
69
|
+
providers = await client.list_providers()
|
|
70
|
+
print(providers)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
asyncio.run(main())
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Provider framework
|
|
77
|
+
|
|
78
|
+
Providers are discovered via `manifest.json` files without importing provider
|
|
79
|
+
modules. To add a provider later, create:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
src/pycityvisitorparking/provider/<provider_id>/
|
|
83
|
+
manifest.json
|
|
84
|
+
__init__.py
|
|
85
|
+
api.py
|
|
86
|
+
const.py
|
|
87
|
+
README.md
|
|
88
|
+
CHANGELOG.md
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Only files under `src/pycityvisitorparking/provider/<provider_id>/` should change
|
|
92
|
+
in a provider PR.
|
|
93
|
+
|
|
94
|
+
## Normalization rules
|
|
95
|
+
|
|
96
|
+
- All public timestamps must be UTC ISO 8601 with `Z` and no microseconds.
|
|
97
|
+
- License plates are normalized to uppercase `A-Z0-9` without spaces/symbols.
|
|
98
|
+
- `zone_validity` must include only chargeable windows.
|
|
99
|
+
|
|
100
|
+
## Development
|
|
101
|
+
|
|
102
|
+
Run checks with Hatch:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
hatch run lint:check
|
|
106
|
+
hatch run lint:format-check
|
|
107
|
+
hatch run test:run
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Build artifacts:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
hatch build
|
|
114
|
+
python -m twine check dist/*
|
|
115
|
+
```
|