Skip to content

Commit bc75a69

Browse files
authored
Merge pull request #193 from allenporter/dev
Manage project with scruft
2 parents 03325ff + eb2c67e commit bc75a69

11 files changed

Lines changed: 319 additions & 40 deletions

File tree

.cruft.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"template": "http://github.com/allenporter/cookiecutter-python",
3+
"commit": "da08492f3d4d2c7bd2d4600cda2b508bc75db3a2",
4+
"checkout": null,
5+
"context": {
6+
"cookiecutter": {
7+
"full_name": "Allen Porter",
8+
"email": "allen.porter@gmail.com",
9+
"github_username": "allenporter",
10+
"project_name": "home_assistant_datasets",
11+
"description": "Library and tools for building datasets related to Home Assistant.",
12+
"version": "0.0.1",
13+
"_template": "http://github.com/allenporter/cookiecutter-python"
14+
}
15+
},
16+
"directory": null
17+
}

.github/renovate.json5

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
{
2-
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
3-
extends: [
4-
'config:recommended',
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended"
55
],
6-
assignees: [
7-
'allenporter',
8-
],
9-
packageRules: [
6+
"assignees": ["allenporter"],
7+
"packageRules": [
108
{
11-
description: 'Minor updates are automatic',
12-
automerge: true,
13-
automergeType: 'branch',
14-
matchUpdateTypes: [
15-
'minor',
16-
'patch',
17-
],
18-
},
9+
"description": "Minor updates are automatic",
10+
"automerge": true,
11+
"automergeType": "branch",
12+
"matchUpdateTypes": ["minor", "patch"]
13+
}
1914
],
20-
pip_requirements: {
21-
fileMatch: [
22-
'requirements_dev.txt',
23-
],
24-
},
25-
'pre-commit': {
26-
enabled: true,
15+
"pip_requirements": {
16+
"fileMatch": ["requirements_dev.txt"]
2717
},
18+
"pre-commit": {"enabled": true}
2819
}

.github/workflows/cruft.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
name: Update repository with Cruft
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
actions: write
7+
on:
8+
schedule:
9+
- cron: "0 0 * * *"
10+
11+
env:
12+
PYTHON_VERSION: 3.13
13+
14+
jobs:
15+
update:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: true
19+
matrix:
20+
include:
21+
- add-paths: .
22+
body: Use this to merge the changes to this repository.
23+
branch: cruft/update
24+
commit-message: "chore: accept new Cruft update"
25+
title: New updates detected with Cruft
26+
- add-paths: .cruft.json
27+
body: Use this to reject the changes in this repository.
28+
branch: cruft/reject
29+
commit-message: "chore: reject new Cruft update"
30+
title: Reject new updates detected with Cruft
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ env.PYTHON_VERSION }}
37+
38+
- name: Install Cruft
39+
run: pip3 install cruft
40+
41+
- name: Check if update is available
42+
continue-on-error: false
43+
id: check
44+
run: |
45+
CHANGES=0
46+
if [ -f .cruft.json ]; then
47+
if ! cruft check; then
48+
CHANGES=1
49+
fi
50+
else
51+
echo "No .cruft.json file"
52+
fi
53+
54+
echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"
55+
56+
- name: Run update if available
57+
if: steps.check.outputs.has_changes == '1'
58+
run: |
59+
git config --global user.email "allen.porter@gmail.com"
60+
git config --global user.name "Allen Porter"
61+
62+
cruft update --skip-apply-ask --refresh-private-variables
63+
git restore --staged .
64+
65+
66+
- name: Create pull request
67+
if: steps.check.outputs.has_changes == '1'
68+
uses: peter-evans/create-pull-request@v6
69+
with:
70+
token: ${{ secrets.GITHUB_TOKEN }}
71+
add-paths: ${{ matrix.add-paths }}
72+
commit-message: ${{ matrix.commit-message }}
73+
branch: ${{ matrix.branch }}
74+
title: ${{ matrix.title }}
75+
body: |
76+
This is an autogenerated PR. ${{ matrix.body }}
77+
78+
[Cruft](https://cruft.github.io/cruft/) has detected updates from the Cookiecutter repository.

.github/workflows/lint.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,13 @@ jobs:
3535
config_file: "./.yaml-lint.yaml"
3636
strict: true
3737

38-
- name: Set up Python
39-
uses: actions/setup-python@v5
40-
with:
41-
python-version: ${{ env.PYTHON_VERSION }}
42-
cache: "pip"
43-
cache-dependency-path: "**/requirements_dev.txt"
44-
4538
- name: Install uv
4639
uses: astral-sh/setup-uv@v6
4740
with:
4841
python-version: ${{ env.PYTHON_VERSION }}
4942
enable-cache: true
5043
cache-dependency-glob: "requirements_dev.txt"
5144
activate-environment: true
52-
5345
- name: Install dependencies
5446
run: |
5547
uv pip install -r requirements_dev.txt

.github/workflows/publish.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Upload Python Package
3+
4+
on:
5+
release:
6+
types: [created]
7+
8+
env:
9+
PYTHON_VERSION: 3.13
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ env.PYTHON_VERSION }}
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build --user
24+
- name: Build a binary wheel and a source tarball
25+
run: python3 -m build
26+
- name: Store the distribution packages
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: python-package-distributions
30+
path: dist/
31+
32+
publish-to-pypi:
33+
name: >-
34+
Publish Python 🐍 distribution 📦 to PyPI
35+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
36+
needs:
37+
- build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/home_assistant_datasets
42+
permissions:
43+
id-token: write # IMPORTANT: mandatory for trusted publishing
44+
steps:
45+
- name: Download all the dists
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
- name: Publish distribution 📦 to PyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,10 @@ jobs:
4141
run: |
4242
export PYTHONPATH="${PYTHONPATH}:./home-assistant-synthetic-home/"
4343
touch secrets.yaml
44-
pytest -vv
44+
pytest --cov=home_assistant_datasets --cov-report=term-missing
45+
- uses: codecov/codecov-action@v4
46+
with:
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
env_vars: OS,PYTHON
49+
fail_ci_if_error: true
50+
verbose: true

.gitignore

Lines changed: 147 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,152 @@
1-
*.pyc
2-
venv
3-
*.egg-info
4-
*_cache
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
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+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110+
.pdm.toml
111+
.pdm-python
112+
.pdm-build/
113+
114+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115+
__pypackages__/
116+
117+
# Celery stuff
118+
celerybeat-schedule
119+
celerybeat.pid
120+
121+
# SageMath parsed files
122+
*.sage.py
123+
124+
# Environments
125+
.env
5126
.venv
6127
__pycache__
128+
env/
129+
venv/
130+
ENV/
131+
env.bak/
132+
venv.bak/
133+
134+
# Spyder project settings
135+
.spyderproject
136+
.spyproject
137+
138+
# Rope project settings
139+
.ropeproject
140+
141+
# mkdocs documentation
142+
/site
143+
144+
# mypy
145+
.mypy_cache/
146+
.dmypy.json
147+
dmypy.json
148+
149+
.DS_Store
7150

8151
**/secrets.yaml
9152
deps

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ repos:
7070
model_eval/.*/output/.*
7171
)$
7272
args:
73+
- --strict
7374
- -c
7475
- ".yaml-lint.yaml"
7576
- repo: https://github.com/pre-commit/mirrors-prettier

.ruff.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exclude = ["generation", "venv", ".ipynb"]
2+
3+
[lint]
4+
ignore = ["E501"]

0 commit comments

Comments
 (0)