Skip to content

Commit

Permalink
Merge pull request #426 from GeoDerp/custom_cec
Browse files Browse the repository at this point in the history
WIP emhass csv append modules and fix inverters syntax and semantics
  • Loading branch information
davidusb-geek authored Jan 26, 2025
2 parents 11e80c3 + f97bfc2 commit 03eed89
Show file tree
Hide file tree
Showing 34 changed files with 1,039 additions and 415 deletions.
8 changes: 3 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"configureZshAsDefaultShell": "true",
"installOhMyZsh": "false",
"installOhMyZshConfig": "false"
"installBash": "true",
"configureBashAsDefaultShell": "true"
}
// "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
Expand Down Expand Up @@ -46,6 +44,6 @@
}
},

"postCreateCommand": ["pip3", "install", "--break-system-packages" , ".[test]"]
"postCreateCommand": ["uv", "pip", "install", "--cache-dir", ".cache", "--verbose", ".[test]"]

}
12 changes: 7 additions & 5 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ jobs:
PYTHON: '3.11'
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version-file: ".python-version"
- name: Generate Report
run: |
python -m pip install --upgrade pip
pip install .[test]
uv venv
uv pip install .[test]
coverage run -m --source=emhass unittest
coverage report
coverage xml
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Export Debian package list
run: mkdir OSV && docker run --rm --entrypoint '/bin/cat' ${{ steps.build.outputs.imageid }} /var/lib/dpkg/status >> ./OSV/${{ matrix.platform.target_arch }}.status
- name: Export Python package list
run: docker run --rm --entrypoint '/usr/bin/pip3' ${{ steps.build.outputs.imageid }} freeze >> ./OSV/${{ matrix.platform.target_arch }}-requirements.txt
run: docker run --rm --entrypoint '/bin/cat' ${{ steps.build.outputs.imageid }} uv.lock >> ./OSV/${{ matrix.platform.target_arch }}.lock
- name: Upload package list as digest
uses: actions/upload-artifact@v4
with:
Expand All @@ -77,10 +77,10 @@ jobs:
with:
download-artifact: "${{ matrix.platform.target_arch }}-packages"
matrix-property: "${{ matrix.platform.target_arch }}-"
fail-on-vuln: false
scan-args: |-
--lockfile=dpkg-status:./${{ matrix.platform.target_arch }}.status
--lockfile=requirements.txt:./${{matrix.platform.target_arch }}-requirements.txt
--fail-on-vuln: false
--lockfile=poetry.lock:./${{matrix.platform.target_arch }}.lock
permissions:
security-events: write
contents: read
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish_docker-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: "Publish Docker test image"

on:
push:
branches: [master]
branches: [testing]
workflow_dispatch:

env:
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Export Debian package list
run: mkdir OSV && docker run --rm --entrypoint '/bin/cat' ${{ steps.cache.outputs.imageid }} /var/lib/dpkg/status >> ./OSV/${{ matrix.platform.target_arch }}.status
- name: Export Python package list
run: docker run --rm --entrypoint '/usr/bin/pip3' ${{ steps.cache.outputs.imageid }} freeze >> ./OSV/${{ matrix.platform.target_arch }}-requirements.txt
run: docker run --rm --entrypoint '/bin/cat' ${{ steps.cache.outputs.imageid }} uv.lock >> ./OSV/${{ matrix.platform.target_arch }}.lock
- name: Upload package list as digest
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -120,10 +120,10 @@ jobs:
with:
download-artifact: "${{ matrix.platform.target_arch }}-packages"
matrix-property: "${{ matrix.platform.target_arch }}-"
fail-on-vuln: false
scan-args: |-
--lockfile=dpkg-status:./${{ matrix.platform.target_arch }}.status
--lockfile=requirements.txt:./${{matrix.platform.target_arch }}-requirements.txt
--fail-on-vuln: false
--lockfile=poetry.lock:./${{matrix.platform.target_arch }}.lock
permissions:
security-events: write
contents: read
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Export Debian package list
run: mkdir OSV && docker run --rm --entrypoint '/bin/cat' ${{ steps.cache.outputs.imageid }} /var/lib/dpkg/status >> ./OSV/${{ matrix.platform.target_arch }}.status
- name: Export Python package list
run: docker run --rm --entrypoint '/usr/bin/pip3' ${{ steps.cache.outputs.imageid }} freeze >> ./OSV/${{ matrix.platform.target_arch }}-requirements.txt
run: docker run --rm --entrypoint '/bin/cat' ${{ steps.cache.outputs.imageid }} uv.lock >> ./OSV/${{ matrix.platform.target_arch }}.lock
- name: Upload package list as digest
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -119,10 +119,10 @@ jobs:
with:
download-artifact: "${{ matrix.platform.target_arch }}-packages"
matrix-property: "${{ matrix.platform.target_arch }}-"
fail-on-vuln: false
scan-args: |-
--lockfile=dpkg-status:./${{ matrix.platform.target_arch }}.status
--lockfile=requirements.txt:./${{matrix.platform.target_arch }}-requirements.txt
--fail-on-vuln: false
--lockfile=poetry.lock:./${{matrix.platform.target_arch }}.lock
permissions:
security-events: write
contents: read
Expand Down
45 changes: 23 additions & 22 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,8 @@ permissions:

jobs:
# Google OSV-Scanner
scan-pr:
uses: "geoderp/osv-scanner-action/.github/workflows/[email protected]"
with:
scan-args: |-
--recursive
./
permissions:
security-events: write
contents: read
actions: read
build:
runs-on: ${{ matrix.os }}
needs:
- scan-pr
strategy:
fail-fast: false
matrix:
Expand All @@ -37,23 +25,36 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

python-version-file: ".python-version"
- name: Set up Python venv
run: uv venv
- name: Special dependencies for macos
run: |
brew install hdf5
pip3 install numpy==1.26.0
pip3 install tables==3.9.1
uv pip install numpy==1.26.0
uv pip install tables==3.9.1
if: ${{ matrix.os == 'macos-latest' }}

- name: Install EMHASS with test dependencies
run: |
pip install .[test]
uv pip install .[test] && uv lock
- name: Test with pytest
run: |
pytest
uv run pytest
scan-pr:
needs:
- build
uses: "geoderp/osv-scanner-action/.github/workflows/[email protected]"
with:
fail-on-vuln: false
scan-args: |-
--recursive
./
permissions:
security-events: write
contents: read
actions: read
34 changes: 17 additions & 17 deletions .github/workflows/upload-package-to-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,40 @@ on:

jobs:
# Google OSV-Scanner
osv-scan:
uses: "geoderp/osv-scanner-action/.github/workflows/[email protected]"
with:
scan-args: |-
--recursive
./
permissions:
security-events: write
contents: read
actions: read
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pypa/build
run: >-
python3 -m pip install build --user
python-version-file: ".python-version"
- name: Build a binary wheel and a source tarball
run: python3 -m build
run: uv build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
osv-scan:
uses: "geoderp/osv-scanner-action/.github/workflows/[email protected]"
needs:
- build
with:
scan-args: |-
--recursive
./
permissions:
security-events: write
contents: read
actions: read
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
needs:
- osv-scan
- build
runs-on: ubuntu-latest
environment:
name: pypi
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ data/entities/*.json
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
uv.lock

# Unit test / coverage reports
htmlcov/
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"python.defaultInterpreterPath": ".venv/bin/python",
"cSpell.words": [
"automations"
]
Expand Down
13 changes: 4 additions & 9 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
"tasks": [
{
"label": "EMHASS install",
"command": "pip3",
"command": "uv",
"group": {
"kind": "build",
"isDefault": true
},
"args": [
"install",
"--no-deps",
"--force-reinstall",
"--break-system-packages",
"--editable",
"."
"pip", "install", "--force-reinstall", ".[test]"
],
"presentation": {
"echo": true,
Expand All @@ -24,13 +19,13 @@
},
{
"label": "EMHASS install with dependencies",
"command": "pip3",
"command": "uv",
"group": {
"kind": "build",
"isDefault": true
},
"args": [
"install", "--break-system-packages", "--force-reinstall", "."
"pip", "install", "--reinstall", ".[test]"
],
"presentation": {
"echo": true,
Expand Down
Loading

0 comments on commit 03eed89

Please sign in to comment.