Skip to content

Commit 322520e

Browse files
authored
Migrate to pyproject.toml and Git versioning (#223)
* Migrate to pyproject.toml * Fix pre-commit formatting errors
1 parent 04f9501 commit 322520e

File tree

7 files changed

+89
-75
lines changed

7 files changed

+89
-75
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ jobs:
99
name: Build and publish distributions to PyPI and TestPyPI
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@master
12+
- uses: actions/checkout@v2
1313
- name: Set up Python 3.8
14-
uses: actions/setup-python@v1
14+
uses: actions/setup-python@v2
1515
with:
16-
version: 3.8
16+
python-version: 3.8
1717
- name: Install wheel
1818
run: >-
19-
pip install wheel
19+
pip install wheel build
2020
- name: Build
2121
run: >-
22-
python3 setup.py sdist bdist_wheel
22+
python3 -m build
2323
- name: Publish distribution to PyPI
2424
uses: pypa/gh-action-pypi-publish@master
2525
with:

.github/workflows/release-management.yml

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

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ repos:
2525
additional_dependencies:
2626
- flake8-docstrings==1.5.0
2727
- pydocstyle==5.1.1
28+
- Flake8-pyproject==1.2.3
2829

2930
- repo: https://github.com/PyCQA/isort
3031
rev: 5.12.0

pyproject.toml

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

requirements_test.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
# Test dependencies
1+
# Test dependencies.
22

33
asynctest
4-
coveralls==3.0.1
5-
pytest
4+
isort
5+
black
6+
flake8
7+
codecov
8+
colorlog
9+
codespell
10+
mypy==1.2.0
11+
pre-commit
12+
pylint
613
pytest-cov
7-
pytest-asyncio
14+
pytest-sugar
815
pytest-timeout
16+
pytest-asyncio>=0.17
17+
pytest>=7.1.3
18+
zigpy>=0.54.1
19+
ruff==0.0.261
20+
Flake8-pyproject

setup.cfg

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

setup.py

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
1-
"""Setup module for zigpy-deconz."""
1+
"""Setup stub for legacy builds."""
22

3-
import os
3+
import setuptools
44

5-
from setuptools import find_packages, setup
6-
7-
import zigpy_deconz
8-
9-
this_directory = os.path.join(os.path.abspath(os.path.dirname(__file__)))
10-
with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
11-
long_description = f.read()
12-
13-
setup(
14-
name="zigpy-deconz",
15-
version=zigpy_deconz.__version__,
16-
description="A library which communicates with Deconz radios for zigpy",
17-
long_description=long_description,
18-
long_description_content_type="text/markdown",
19-
url="http://github.com/zigpy/zigpy-deconz",
20-
author="Daniel Schmidt",
21-
author_email="schmidt.d@aon.at",
22-
license="GPL-3.0",
23-
packages=find_packages(exclude=["tests"]),
24-
install_requires=["zigpy>=0.54.0"],
25-
tests_require=["pytest", "asynctest"],
26-
)
5+
if __name__ == "__main__":
6+
setuptools.setup()

0 commit comments

Comments
 (0)