-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add package skeleton * Disable mypy * Address review comments * Use pypi-publish action * Rename package to improv_ble_client * Use trusted publishing mode
- Loading branch information
1 parent
7dbb591
commit cd5775d
Showing
12 changed files
with
281 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 10 |
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,9 @@ | ||
categories: | ||
- title: "⬆️ Dependencies" | ||
collapse-after: 1 | ||
labels: | ||
- "dependencies" | ||
template: | | ||
## What's Changed | ||
$CHANGES |
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,32 @@ | ||
# This workflows will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/py-improv-ble-client | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@release/[email protected] |
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,24 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
update_release_draft: | ||
permissions: | ||
# write permission is required to create a github release | ||
contents: write | ||
# write permission is required for autolabeler | ||
# otherwise, read permission is required at least | ||
pull-requests: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Drafts your next Release notes as Pull Requests are merged into "main" | ||
- uses: release-drafter/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Run Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Set up Python 3.11 | ||
uses: actions/[email protected] | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
pip install -r requirements-test.txt | ||
- name: Check formatting with black | ||
run: | | ||
black improv_ble_client --check --diff | ||
- name: Lint with flake8 | ||
run: | | ||
flake8 improv_ble_client | ||
- name: Lint with isort | ||
run: | | ||
isort improv_ble_client | ||
#- name: Lint with mypy | ||
# run: | | ||
# mypy improv_ble_client | ||
- name: Lint with pylint | ||
run: | | ||
pylint improv_ble_client |
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,19 @@ | ||
.DS_Store | ||
.idea | ||
*.log | ||
tmp/ | ||
|
||
*.py[cod] | ||
*.egg | ||
htmlcov | ||
|
||
.projectile | ||
.venv/ | ||
venv/ | ||
.mypy_cache/ | ||
*.egg-info/ | ||
|
||
# Visual Studio Code | ||
.vscode/* | ||
|
||
dist |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Home Assistant Team | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Empty file.
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,111 @@ | ||
[build-system] | ||
requires = ["setuptools~=65.6", "wheel~=0.37.1"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "py-improv-ble-client" | ||
version = "1.0.0" | ||
license = {text = "MIT"} | ||
description = "API to provision devices which implement Improv via BLE" | ||
readme = "README.md" | ||
requires-python = ">=3.11.0" | ||
|
||
[project.urls] | ||
"Homepage" = "https://github.com/homeassistant-libs/py-improv-ble-client" | ||
|
||
[tool.setuptools] | ||
platforms = ["any"] | ||
zip-safe = true | ||
include-package-data = true | ||
|
||
[tool.setuptools.packages.find] | ||
include = ["improv_ble_client*"] | ||
|
||
[tool.setuptools.package-data] | ||
"*" = ["py.typed"] | ||
|
||
[tool.black] | ||
target-version = ["py311"] | ||
extend-exclude = "/generated/" | ||
|
||
[tool.isort] | ||
# https://github.com/PyCQA/isort/wiki/isort-Settings | ||
profile = "black" | ||
# will group `import x` and `from x import` of the same module. | ||
force_sort_within_sections = true | ||
known_first_party = [ | ||
"improv_ble_client", | ||
"tests", | ||
] | ||
forced_separate = [ | ||
"tests", | ||
] | ||
combine_as_imports = true | ||
|
||
[tool.pylint.MAIN] | ||
py-version = "3.11" | ||
ignore = [ | ||
"tests", | ||
] | ||
# Use a conservative default here; 2 should speed up most setups and not hurt | ||
# any too bad. Override on command line as appropriate. | ||
jobs = 2 | ||
init-hook = """\ | ||
from pathlib import Path; \ | ||
import sys; \ | ||
from pylint.config import find_default_config_files; \ | ||
sys.path.append( \ | ||
str(Path(next(find_default_config_files())).parent.joinpath('pylint/plugins')) | ||
) \ | ||
""" | ||
load-plugins = [ | ||
"pylint.extensions.code_style", | ||
"pylint.extensions.typing", | ||
] | ||
|
||
[tool.pylint.BASIC] | ||
class-const-naming-style = "any" | ||
good-names = [ | ||
"_CMD_T", | ||
] | ||
|
||
[tool.pylint."MESSAGES CONTROL"] | ||
# Reasons disabled: | ||
# format - handled by black | ||
# locally-disabled - it spams too much | ||
# duplicate-code - unavoidable | ||
# cyclic-import - doesn't test if both import on load | ||
# abstract-class-little-used - prevents from setting right foundation | ||
# unused-argument - generic callbacks and setup methods create a lot of warnings | ||
# too-many-* - are not enforced for the sake of readability | ||
# too-few-* - same as too-many-* | ||
# abstract-method - with intro of async there are always methods missing | ||
# inconsistent-return-statements - doesn't handle raise | ||
# too-many-ancestors - it's too strict. | ||
# wrong-import-order - isort guards this | ||
# consider-using-f-string - str.format sometimes more readable | ||
disable = [ | ||
"format", | ||
"cyclic-import", | ||
"duplicate-code", | ||
"locally-disabled", | ||
"too-few-public-methods", | ||
"too-many-ancestors", | ||
"too-many-arguments", | ||
"too-many-branches", | ||
"too-many-instance-attributes", | ||
"too-many-lines", | ||
"too-many-locals", | ||
"too-many-public-methods", | ||
"too-many-return-statements", | ||
"too-many-statements", | ||
"too-many-boolean-expressions", | ||
"unused-argument", | ||
"wrong-import-order", | ||
] | ||
enable = [ | ||
"useless-suppression", | ||
"use-symbolic-message-instead", | ||
] |
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,5 @@ | ||
black==23.7.0 | ||
flake8==6.0.0 | ||
isort==5.12.0 | ||
mypy==1.5.1 | ||
pylint==2.17.4 |
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,2 @@ | ||
bleak | ||
bleak-retry-connector |
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,5 @@ | ||
[flake8] | ||
# To work with Black | ||
max-line-length = 88 | ||
# E203: Whitespace before ':' | ||
extend-ignore = E203 |