updates2mqtt 1.3.4__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 (45) hide show
  1. updates2mqtt-1.3.4/.dockerignore +13 -0
  2. updates2mqtt-1.3.4/.github/dependabot.yml +24 -0
  3. updates2mqtt-1.3.4/.github/workflows/docker-publish.yml +78 -0
  4. updates2mqtt-1.3.4/.github/workflows/pypi-publish.yml +75 -0
  5. updates2mqtt-1.3.4/.github/workflows/python-package.yml +44 -0
  6. updates2mqtt-1.3.4/.gitignore +170 -0
  7. updates2mqtt-1.3.4/.hintrc +8 -0
  8. updates2mqtt-1.3.4/.pre-commit-config.yaml +71 -0
  9. updates2mqtt-1.3.4/.python-version +1 -0
  10. updates2mqtt-1.3.4/.safety-project.ini +5 -0
  11. updates2mqtt-1.3.4/Dockerfile +39 -0
  12. updates2mqtt-1.3.4/LICENSE +201 -0
  13. updates2mqtt-1.3.4/PKG-INFO +236 -0
  14. updates2mqtt-1.3.4/README.md +201 -0
  15. updates2mqtt-1.3.4/SECURITY.md +29 -0
  16. updates2mqtt-1.3.4/common_packages.yaml +84 -0
  17. updates2mqtt-1.3.4/conftest.py +84 -0
  18. updates2mqtt-1.3.4/docs/images/ha_mqtt_discovery.png +0 -0
  19. updates2mqtt-1.3.4/docs/images/ha_update_detail.png +0 -0
  20. updates2mqtt-1.3.4/docs/images/ha_update_page.png +0 -0
  21. updates2mqtt-1.3.4/docs/index.md +1 -0
  22. updates2mqtt-1.3.4/examples/config.yaml.maximal +33 -0
  23. updates2mqtt-1.3.4/examples/config.yaml.minimal +22 -0
  24. updates2mqtt-1.3.4/examples/docker-compose.yaml +18 -0
  25. updates2mqtt-1.3.4/mkdocs.yml +40 -0
  26. updates2mqtt-1.3.4/pyproject.toml +176 -0
  27. updates2mqtt-1.3.4/refresh-deps.sh +7 -0
  28. updates2mqtt-1.3.4/scripts/healthcheck.sh +86 -0
  29. updates2mqtt-1.3.4/src/updates2mqtt/__init__.py +5 -0
  30. updates2mqtt-1.3.4/src/updates2mqtt/__main__.py +6 -0
  31. updates2mqtt-1.3.4/src/updates2mqtt/app.py +203 -0
  32. updates2mqtt-1.3.4/src/updates2mqtt/config.py +135 -0
  33. updates2mqtt-1.3.4/src/updates2mqtt/hass_formatter.py +75 -0
  34. updates2mqtt-1.3.4/src/updates2mqtt/integrations/__init__.py +1 -0
  35. updates2mqtt-1.3.4/src/updates2mqtt/integrations/docker.py +402 -0
  36. updates2mqtt-1.3.4/src/updates2mqtt/integrations/git_utils.py +64 -0
  37. updates2mqtt-1.3.4/src/updates2mqtt/model.py +98 -0
  38. updates2mqtt-1.3.4/src/updates2mqtt/mqtt.py +286 -0
  39. updates2mqtt-1.3.4/src/updates2mqtt/py.typed +0 -0
  40. updates2mqtt-1.3.4/tests/__init__.py +0 -0
  41. updates2mqtt-1.3.4/tests/test_config.py +46 -0
  42. updates2mqtt-1.3.4/tests/test_docker.py +86 -0
  43. updates2mqtt-1.3.4/tests/test_git_utils.py +49 -0
  44. updates2mqtt-1.3.4/tests/test_mqtt.py +138 -0
  45. updates2mqtt-1.3.4/uv.lock +1109 -0
@@ -0,0 +1,13 @@
1
+ venv
2
+ .venv
3
+ .mypy_cache
4
+ .pytest_cache
5
+ tests
6
+ .coverage
7
+ __pycache__
8
+ *.pyc
9
+ *.pyo
10
+ *.pyd
11
+ lcov.info
12
+ *.log
13
+
@@ -0,0 +1,24 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "uv"
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
12
+
13
+ - package-ecosystem: "github-actions"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "monthly"
17
+
18
+ - package-ecosystem: "docker"
19
+ directory: "/"
20
+ schedule:
21
+ interval: "weekly"
22
+
23
+
24
+
@@ -0,0 +1,78 @@
1
+ #
2
+ name: Create and publish a Docker image
3
+
4
+ # Configures this workflow to run every time a change is pushed to a release branch
5
+ on:
6
+ release:
7
+ types: [published]
8
+
9
+
10
+ # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
11
+ env:
12
+ REGISTRY: ghcr.io
13
+ IMAGE_NAME: ${{ github.repository }}
14
+
15
+ # There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
16
+ jobs:
17
+ build-and-push-image:
18
+ runs-on: ubuntu-latest
19
+ # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
20
+ permissions:
21
+ contents: read
22
+ packages: write
23
+ attestations: write
24
+ id-token: write
25
+ #
26
+ steps:
27
+ - name: Checkout repository
28
+ uses: actions/checkout@v5
29
+ # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
30
+ - name: Log in to the Container registry
31
+ uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef
32
+ with:
33
+ registry: ${{ env.REGISTRY }}
34
+ username: ${{ github.actor }}
35
+ password: ${{ secrets.GITHUB_TOKEN }}
36
+ # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
37
+ -
38
+ name: Set up QEMU
39
+ uses: docker/setup-qemu-action@v3
40
+ -
41
+ name: Set up Docker Buildx
42
+ uses: docker/setup-buildx-action@v3
43
+ - name: Extract metadata (tags, labels) for Docker
44
+ id: meta
45
+ uses: docker/metadata-action@032a4b3bda1b716928481836ac5bfe36e1feaad6
46
+ with:
47
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48
+ tags: |
49
+ type=ref,event=branch
50
+ type=semver,pattern={{version}}
51
+ type=semver,pattern={{major}}.{{minor}}
52
+ type=raw,value=release
53
+ annotations: |
54
+ org.opencontainers.image.documentation=https://updates2mqtt.rhizomatics.org.uk
55
+ org.opencontainers.image.vendor=Rhizomatics Open Source
56
+
57
+ # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
58
+ # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
59
+ # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
60
+ - name: Build and push Docker image
61
+ id: push
62
+ uses: docker/build-push-action@9e436ba9f2d7bcd1d038c8e55d039d37896ddc5d
63
+ with:
64
+ context: .
65
+ platforms: linux/amd64,linux/arm64
66
+ push: true
67
+ tags: ${{ steps.meta.outputs.tags }}
68
+ labels: ${{ steps.meta.outputs.labels }}
69
+ annotations: ${{ steps.meta.outputs.annotations }}
70
+
71
+ # This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
72
+ - name: Generate artifact attestation
73
+ uses: actions/attest-build-provenance@v3
74
+ with:
75
+ subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
76
+ subject-digest: ${{ steps.push.outputs.digest }}
77
+ push-to-registry: true
78
+
@@ -0,0 +1,75 @@
1
+ name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ name: Build distribution 📦
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v5
12
+ with:
13
+ persist-credentials: false
14
+ - name: uv-setup
15
+ run: curl -LsSf https://astral.sh/uv/install.sh | sh
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v6
18
+ with:
19
+ python-version-file: "pyproject.toml"
20
+ - name: Install dependencies
21
+ run: uv sync --all-extras --dev
22
+ - name: Build a binary wheel and a source tarball
23
+ run: uv build
24
+ - name: Store the distribution packages
25
+ uses: actions/upload-artifact@v4
26
+ with:
27
+ name: python-package-distributions
28
+ path: dist/
29
+
30
+ publish-to-pypi:
31
+ name: >-
32
+ Publish Python 🐍 distribution 📦 to PyPI
33
+ #if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
34
+ needs:
35
+ - build
36
+ runs-on: ubuntu-latest
37
+ environment:
38
+ name: pypi
39
+ url: https://pypi.org/p/updates2mqtt
40
+ permissions:
41
+ id-token: write # IMPORTANT: mandatory for trusted publishing
42
+
43
+ steps:
44
+ - name: Download all the dists
45
+ uses: actions/download-artifact@v4
46
+ with:
47
+ name: python-package-distributions
48
+ path: dist/
49
+ - name: Publish distribution 📦 to PyPI
50
+ uses: pypa/gh-action-pypi-publish@release/v1
51
+
52
+ publish-to-testpypi:
53
+ name: Publish Python 🐍 distribution 📦 to TestPyPI
54
+ needs:
55
+ - build
56
+ runs-on: ubuntu-latest
57
+
58
+ environment:
59
+ name: testpypi
60
+ url: https://test.pypi.org/p/updates2mqtt
61
+
62
+ permissions:
63
+ id-token: write # IMPORTANT: mandatory for trusted publishing
64
+
65
+ steps:
66
+ - name: Download all the dists
67
+ uses: actions/download-artifact@v4
68
+ with:
69
+ name: python-package-distributions
70
+ path: dist/
71
+ - name: Publish distribution 📦 to TestPyPI
72
+ uses: pypa/gh-action-pypi-publish@release/v1
73
+ with:
74
+ repository-url: https://test.pypi.org/legacy/
75
+ skip-existing: true
@@ -0,0 +1,44 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3
+
4
+ name: Github Deploy
5
+
6
+ on:
7
+ push:
8
+ branches: [ "main" ]
9
+ pull_request:
10
+ branches: [ "main" ]
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ contents: write
17
+ steps:
18
+ - uses: actions/checkout@v5
19
+ - name: uv-setup
20
+ # Install a specific uv version using the installer
21
+ run: curl -LsSf https://astral.sh/uv/install.sh | sh
22
+ - name: "Set up Python"
23
+ uses: actions/setup-python@v6
24
+ with:
25
+ python-version-file: "pyproject.toml"
26
+ - name: Install dependencies
27
+ run: uv sync --all-extras --dev
28
+ - name: Ruff
29
+ uses: chartboost/ruff-action@v1
30
+ - name: Test with pytest
31
+ run: uv run pytest tests
32
+ - name: Build a binary wheel and a source tarball
33
+ run: uv build
34
+ - name: Prep for mkdocs
35
+ run: uv pip compile pyproject.toml -o requirements_docs.txt --group mkdocs
36
+ - name: Deploy docs
37
+ uses: mhausenblas/mkdocs-deploy-gh-pages@master
38
+ env:
39
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40
+ REQUIREMENTS: requirements_docs.txt
41
+ CUSTOM_DOMAIN: updates2mqtt.rhizomatics.org.uk
42
+
43
+
44
+
@@ -0,0 +1,170 @@
1
+
2
+ conf/
3
+ # ---> Python
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+ cov.xml
9
+ htmlcov/
10
+ .ruff_cache/
11
+ lcov.info
12
+ .vscode/
13
+ .DS_Store
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
+ share/python-wheels/
33
+ *.egg-info/
34
+ .installed.cfg
35
+ *.egg
36
+ MANIFEST
37
+
38
+ # PyInstaller
39
+ # Usually these files are written by a python script from a template
40
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
41
+ *.manifest
42
+ *.spec
43
+
44
+ # Installer logs
45
+ pip-log.txt
46
+ pip-delete-this-directory.txt
47
+
48
+ # Unit test / coverage reports
49
+ htmlcov/
50
+ .tox/
51
+ .nox/
52
+ .coverage
53
+ .coverage.*
54
+ .cache
55
+ nosetests.xml
56
+ coverage.xml
57
+ *.cover
58
+ *.py,cover
59
+ .hypothesis/
60
+ .pytest_cache/
61
+ cover/
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
+ .pybuilder/
85
+ target/
86
+
87
+ # Jupyter Notebook
88
+ .ipynb_checkpoints
89
+
90
+ # IPython
91
+ profile_default/
92
+ ipython_config.py
93
+
94
+ # pyenv
95
+ # For a library or package, you might want to ignore these files since the code is
96
+ # intended to run in multiple environments; otherwise, check them in:
97
+ # .python-version
98
+
99
+ # pipenv
100
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
101
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
102
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
103
+ # install all needed dependencies.
104
+ #Pipfile.lock
105
+
106
+ # poetry
107
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
108
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
109
+ # commonly ignored for libraries.
110
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
111
+ #poetry.lock
112
+
113
+ # pdm
114
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
115
+ #pdm.lock
116
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
117
+ # in version control.
118
+ # https://pdm.fming.dev/#use-with-ide
119
+ .pdm.toml
120
+
121
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
122
+ __pypackages__/
123
+
124
+ # Celery stuff
125
+ celerybeat-schedule
126
+ celerybeat.pid
127
+
128
+ # SageMath parsed files
129
+ *.sage.py
130
+
131
+ # Environments
132
+ .env
133
+ .venv
134
+ env/
135
+ venv/
136
+ ENV/
137
+ env.bak/
138
+ venv.bak/
139
+
140
+ # Spyder project settings
141
+ .spyderproject
142
+ .spyproject
143
+
144
+ # Rope project settings
145
+ .ropeproject
146
+
147
+ # mkdocs documentation
148
+ /site
149
+
150
+ # mypy
151
+ .mypy_cache/
152
+ .dmypy.json
153
+ dmypy.json
154
+
155
+ # Pyre type checker
156
+ .pyre/
157
+
158
+ # pytype static type analyzer
159
+ .pytype/
160
+
161
+ # Cython debug symbols
162
+ cython_debug/
163
+
164
+ # PyCharm
165
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
166
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
167
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
168
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
169
+ #.idea/
170
+
@@ -0,0 +1,8 @@
1
+ {
2
+ "connector": {
3
+ "name": "local",
4
+ "options": {
5
+ "pattern": ["**", "!htmlcov/**"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,71 @@
1
+ repos:
2
+ - repo: https://github.com/asottile/pyupgrade
3
+ rev: v3.21.0
4
+ hooks:
5
+ - id: pyupgrade
6
+ args: [--py313-plus]
7
+ - repo: https://github.com/pre-commit/pre-commit-hooks
8
+ rev: v6.0.0
9
+ hooks:
10
+ - id: check-merge-conflict
11
+ name: Check for merge-conflicts
12
+ - id: check-yaml
13
+ name: Check for un-parseable yaml
14
+ args: [--allow-multiple-documents]
15
+ - id: check-executables-have-shebangs
16
+ name: Check shell script for shebang lines
17
+ - id: check-shebang-scripts-are-executable
18
+ name: Check shell scripts are executable
19
+ - repo: https://github.com/astral-sh/uv-pre-commit
20
+ rev: 0.9.7
21
+ hooks:
22
+ - id: uv-lock
23
+ - repo: https://github.com/astral-sh/ruff-pre-commit
24
+ rev: v0.14.4
25
+ hooks:
26
+ # Run the linter.
27
+ - id: ruff-check
28
+ args: [ --fix ]
29
+ # Run the formatter.
30
+ - id: ruff-format
31
+ - repo: https://github.com/codespell-project/codespell
32
+ rev: v2.4.1
33
+ hooks:
34
+ - id: codespell
35
+ args:
36
+ - --ignore-words-list=hass,alot,datas,dof,dur,farenheit,hist,iff,ines,ist,lightsensor,mut,nd,pres,referer,ser,serie,te,technik,ue,uint,visability,wan,wanna,withing
37
+ - --skip="./.*,*.csv,*.json"
38
+ - --quiet-level=2
39
+ exclude_types: [csv, json]
40
+
41
+ - repo: https://github.com/pre-commit/mirrors-mypy
42
+ rev: v1.18.2
43
+ hooks:
44
+ - id: mypy
45
+ args:
46
+ - --warn-redundant-casts
47
+ - --warn-unused-ignores
48
+ - --warn-unreachable
49
+ - --report-deprecated-as-note
50
+ - --pretty
51
+ - --namespace-packages
52
+ - --explicit-package-bases
53
+ - --show-error-codes
54
+ - --show-error-context
55
+ - --follow-untyped-imports
56
+ additional_dependencies:
57
+ - structlog
58
+ - pytest
59
+ - pytest-httpx
60
+ - paho-mqtt
61
+ - omegaconf
62
+ - types-docker
63
+ - hishel[httpx]
64
+ - usingversion
65
+
66
+ - repo: https://github.com/PyCQA/bandit
67
+ rev: '1.8.6'
68
+ hooks:
69
+ - id: bandit
70
+ args: ["-c", "pyproject.toml"]
71
+ additional_dependencies: ["bandit[toml]"]
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,5 @@
1
+ [project]
2
+ id = updates2mqtt
3
+ url = /codebases/updates2mqtt/findings
4
+ name = updates2mqtt
5
+
@@ -0,0 +1,39 @@
1
+ FROM python:3.13-slim
2
+
3
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
4
+
5
+ ENV UV_COMPILE_BYTECODE=1
6
+
7
+ RUN apt-get -y update && apt-get -y upgrade
8
+ RUN apt-get -y install git ca-certificates curl
9
+ RUN install -m 0755 -d /etc/apt/keyrings
10
+ RUN curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
11
+ RUN chmod a+r /etc/apt/keyrings/docker.asc
12
+
13
+ # Add the docker repository to apt sources:
14
+ RUN echo \
15
+ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
16
+ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
17
+ tee /etc/apt/sources.list.d/docker.list > /dev/null
18
+
19
+ RUN apt-get -y update
20
+ RUN apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin mosquitto-clients jq
21
+
22
+ WORKDIR /app
23
+
24
+ ADD uv.lock /app/uv.lock
25
+ ADD pyproject.toml /app/pyproject.toml
26
+ RUN uv sync --locked --no-install-project
27
+
28
+ ADD src /app
29
+ ADD scripts/healthcheck.sh /app
30
+ RUN chmod ug+x /app/healthcheck.sh
31
+ ADD README.md /app/README.md
32
+ ADD common_packages.yaml /app
33
+
34
+
35
+ RUN uv sync --locked
36
+
37
+ ENV PATH="/app/.venv/bin:$PATH"
38
+ # Use explicit path and python executable rather than `uv run` to get proper signal handling
39
+ ENTRYPOINT ["python", "-m", "updates2mqtt"]