Skip to content

Commit c057b35

Browse files
committed
Migrate to pyproject.toml
1 parent 2f1fb28 commit c057b35

File tree

9 files changed

+157
-128
lines changed

9 files changed

+157
-128
lines changed

.github/release-drafter.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI
2+
3+
# yamllint disable-line rule:truthy
4+
on:
5+
push:
6+
pull_request: ~
7+
8+
jobs:
9+
shared-ci:
10+
uses: zigpy/workflows/.github/workflows/ci.yml@main
11+
with:
12+
CODE_FOLDER: zigpy_deconz
13+
CACHE_VERSION: 2
14+
PYTHON_VERSION_DEFAULT: 3.8.14
15+
PRE_COMMIT_CACHE_PATH: ~/.cache/pre-commit
16+
MINIMUM_COVERAGE_PERCENTAGE: 97
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "codespell",
5+
"severity": "warning",
6+
"pattern": [
7+
{
8+
"regexp": "^(.+):(\\d+):\\s(.+)$",
9+
"file": 1,
10+
"line": 2,
11+
"message": 3
12+
}
13+
]
14+
}
15+
]
16+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "flake8-error",
5+
"severity": "error",
6+
"pattern": [
7+
{
8+
"regexp": "^(.*):(\\d+):(\\d+):\\s([EF]\\d{3}\\s.*)$",
9+
"file": 1,
10+
"line": 2,
11+
"column": 3,
12+
"message": 4
13+
}
14+
]
15+
},
16+
{
17+
"owner": "flake8-warning",
18+
"severity": "warning",
19+
"pattern": [
20+
{
21+
"regexp": "^(.*):(\\d+):(\\d+):\\s([CDNW]\\d{3}\\s.*)$",
22+
"file": 1,
23+
"line": 2,
24+
"column": 3,
25+
"message": 4
26+
}
27+
]
28+
}
29+
]
30+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "python",
5+
"pattern": [
6+
{
7+
"regexp": "^\\s*File\\s\\\"(.*)\\\",\\sline\\s(\\d+),\\sin\\s(.*)$",
8+
"file": 1,
9+
"line": 2
10+
},
11+
{
12+
"regexp": "^\\s*raise\\s(.*)\\(\\'(.*)\\'\\)$",
13+
"message": 2
14+
}
15+
]
16+
}
17+
]
18+
}

.github/workflows/publish-to-pypi.yml

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,12 @@
1-
name: Publish distributions to PyPI and TestPyPI
1+
name: Publish distributions to PyPI
2+
23
on:
3-
push:
4-
tags:
5-
- "*"
4+
release:
5+
types:
6+
- published
67

78
jobs:
8-
build-and-publish:
9-
name: Build and publish distributions to PyPI and TestPyPI
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@master
13-
- name: Set up Python 3.8
14-
uses: actions/setup-python@v1
15-
with:
16-
version: 3.8
17-
- name: Install wheel
18-
run: >-
19-
pip install wheel
20-
- name: Build
21-
run: >-
22-
python3 setup.py sdist
23-
- name: Publish distribution to PyPI
24-
uses: pypa/gh-action-pypi-publish@master
25-
with:
26-
password: ${{ secrets.PYPI_TOKEN }}
27-
update_draft_release:
28-
runs-on: ubuntu-latest
29-
steps:
30-
# Drafts your next Release notes as Pull Requests are merged into "master"
31-
- uses: release-drafter/release-drafter@v5
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9+
shared-build-and-publish:
10+
uses: zigpy/workflows/.github/workflows/publish-to-pypi.yml@main
11+
secrets:
12+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

.github/workflows/tests.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

pyproject.toml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0.0", "wheel", "setuptools-git-versioning<2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "zigpy-zigate"
7+
dynamic = ["version"]
8+
description = "A library which communicates with ZiGate radios for zigpy"
9+
urls = {repository = "https://github.com/zigpy/zigpy-zigate"}
10+
authors = [
11+
{name = "Sébastien RAMAGE", email = "[email protected]"}
12+
]
13+
readme = "README.md"
14+
license = {text = "GPL-3.0"}
15+
requires-python = ">=3.8"
16+
dependencies = [
17+
"voluptuous",
18+
"zigpy>=0.60.0",
19+
"pyusb>=1.1.0",
20+
"gpiozero",
21+
'async-timeout; python_version<"3.11"',
22+
]
23+
24+
[tool.setuptools.packages.find]
25+
exclude = ["tests", "tests.*"]
26+
27+
[project.optional-dependencies]
28+
testing = [
29+
"pytest>=7.1.2",
30+
"pytest-asyncio>=0.19.0",
31+
"pytest-timeout>=2.1.0",
32+
"pytest-mock>=3.8.2",
33+
"pytest-cov>=3.0.0",
34+
]
35+
36+
[tool.setuptools-git-versioning]
37+
enabled = true
38+
39+
[tool.isort]
40+
profile = "black"
41+
# will group `import x` and `from x import` of the same module.
42+
force_sort_within_sections = true
43+
known_first_party = ["zigpy_zigate", "tests"]
44+
forced_separate = "tests"
45+
combine_as_imports = true
46+
47+
[tool.mypy]
48+
ignore_errors = true
49+
50+
[tool.pytest.ini_options]
51+
asyncio_mode = "auto"
52+
53+
[tool.flake8]
54+
exclude = [".venv", ".git", ".tox", "docs", "venv", "bin", "lib", "deps", "build"]
55+
# To work with Black
56+
max-line-length = 88
57+
# W503: Line break occurred before a binary operator
58+
# E203: Whitespace before ':'
59+
# E501: line too long
60+
# D202 No blank lines allowed after function docstring
61+
ignore = [
62+
"W503", "E203", "E501", "D202",
63+
"D103", "D102", "D101", # TODO: remove these once docstrings are added
64+
]
65+
per-file-ignores = ["tests/*:F811,F401,F403"]

setup.py

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,4 @@
1-
"""Setup module for zigpy-zigate"""
1+
import setuptools
22

3-
import pathlib
4-
5-
from setuptools import find_packages, setup
6-
from zigpy_zigate import __version__
7-
8-
setup(
9-
name="zigpy-zigate",
10-
version=__version__,
11-
description="A library which communicates with ZiGate radios for zigpy",
12-
long_description=(pathlib.Path(__file__).parent / "README.md").read_text(),
13-
long_description_content_type="text/markdown",
14-
url="http://github.com/zigpy/zigpy-zigate",
15-
author="Sébastien RAMAGE",
16-
author_email="[email protected]",
17-
license="GPL-3.0",
18-
packages=find_packages(exclude=['tests']),
19-
install_requires=[
20-
'pyserial>=3.5',
21-
'pyserial-asyncio>=0.5; platform_system!="Windows"',
22-
'pyserial-asyncio!=0.5; platform_system=="Windows"', # 0.5 broke writes
23-
'pyusb>=1.1.0',
24-
'zigpy>=0.51.0',
25-
'gpiozero',
26-
],
27-
tests_require=[
28-
'pytest',
29-
'pytest-asyncio',
30-
'mock'
31-
],
32-
)
3+
if __name__ == "__main__":
4+
setuptools.setup()

0 commit comments

Comments
 (0)