-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update project and CI #221
Merged
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4ffc6cf
move to pyproject.toml
marcelveldt b429070
add default vscode config
marcelveldt 4cea7fe
add pre-commit config
marcelveldt 1285710
lint round 1
marcelveldt ee6c76c
add/fix CI workflows
marcelveldt 042f776
remove hacks now we have editable installs working
marcelveldt e8085b9
fix annotation checking code for python3.10
marcelveldt 25cbaa0
fix missing effects in enum
marcelveldt 7a3aa5b
Merge branch 'master' into pyproject
marcelveldt 3ae68f0
Update pyproject.toml
marcelveldt a2bb3b0
remove redundant exclusions
marcelveldt dc05a34
Merge branch 'pyproject' of https://github.com/home-assistant-libs/ai…
marcelveldt 1ae06f7
add missing exclusions
marcelveldt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
name-template: '$RESOLVED_VERSION' | ||
tag-template: '$RESOLVED_VERSION' | ||
change-template: '- #$NUMBER - $TITLE (@$AUTHOR)' | ||
categories: | ||
- title: "⬆️ Dependencies" | ||
- title: "⚠ Breaking Changes" | ||
labels: | ||
- 'breaking-change' | ||
- title: '⬆️ Dependencies' | ||
collapse-after: 1 | ||
labels: | ||
- "dependencies" | ||
- 'dependencies' | ||
- 'ci' | ||
template: | | ||
## What's Changed | ||
## What’s Changed | ||
|
||
$CHANGES | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'breaking-change' | ||
minor: | ||
labels: | ||
- 'new-feature' | ||
- 'new-provider' | ||
- 'enhancement' | ||
- 'refactor' | ||
default: patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
name: PR Labels | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
pull_request: | ||
types: | ||
- synchronize | ||
- labeled | ||
- unlabeled | ||
branches: | ||
- main | ||
|
||
jobs: | ||
pr_labels: | ||
name: Verify | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏷 Verify PR has a valid label | ||
uses: ludeeus/action-require-labels@1.0.0 | ||
with: | ||
labels: >- | ||
breaking-change, bugfix, refactor, new-feature, maintenance, ci, dependencies, new-provider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Pre-commit auto-update | ||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
jobs: | ||
auto-update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4.7.0 | ||
with: | ||
python-version: '3.10' | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
- name: Run pre-commit autoupdate | ||
run: pre-commit autoupdate | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5.0.2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: update/pre-commit-autoupdate | ||
title: Auto-update pre-commit hooks | ||
commit-message: Auto-update pre-commit hooks | ||
body: | | ||
Update versions of tools in pre-commit | ||
configs to latest version | ||
labels: dependencies |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Publish releases | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build-and-publish-pypi: | ||
name: Builds and publishes releases to PyPI | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.vars.outputs.tag }} | ||
steps: | ||
- uses: actions/checkout@v4.0.0 | ||
- name: Get tag | ||
id: vars | ||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4.7.0 | ||
with: | ||
python-version: "3.10" | ||
- name: Install build | ||
run: >- | ||
pip install build tomli tomli-w | ||
- name: Set Python project version from tag | ||
shell: python | ||
run: |- | ||
import tomli | ||
import tomli_w | ||
|
||
with open("pyproject.toml", "rb") as f: | ||
pyproject = tomli.load(f) | ||
|
||
pyproject["project"]["version"] = "${{ steps.vars.outputs.tag }}" | ||
|
||
with open("pyproject.toml", "wb") as f: | ||
tomli_w.dump(pyproject, f) | ||
- name: Build | ||
run: >- | ||
python3 -m build | ||
- name: Publish release to PyPI | ||
uses: pypa/gh-action-pypi-publish@v1.8.10 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: no-commit-to-branch | ||
args: | ||
- --branch=main | ||
- id: debug-statements | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
rev: 'v0.0.284' | ||
hooks: | ||
- id: ruff | ||
- repo: https://github.com/psf/black | ||
rev: 23.7.0 | ||
hooks: | ||
- id: black | ||
args: | ||
- --safe | ||
- --quiet | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.2.5 | ||
hooks: | ||
- id: codespell | ||
args: [] | ||
exclude_types: [csv, json] | ||
exclude: ^tests/fixtures/ | ||
additional_dependencies: | ||
- tomli | ||
|
||
# - repo: local | ||
# hooks: | ||
# - id: pylint | ||
# name: pylint | ||
# entry: script/run-in-env.sh pylint -j 0 | ||
# language: script | ||
# types: [python] | ||
# files: ^aiohue/.+\.py$ | ||
|
||
# - id: mypy | ||
# name: mypy | ||
# entry: script/run-in-env.sh mypy | ||
# language: script | ||
# types: [python] | ||
# files: ^aiohue/.+\.py$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"[python]": { | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true, | ||
"source.organizeImports": true | ||
} | ||
}, | ||
"python.formatting.provider": "black", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could directly switch to Trusted Publisher to improve security
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, can we do that in a follow up? I'm not sure how to do that with the libs org and I think the PYPI account linked is still from @balloob