Skip to content

Commit b77e01d

Browse files
committed
switch to pyproject.toml and update tox.ini
1 parent 8496397 commit b77e01d

File tree

9 files changed

+96
-186
lines changed

9 files changed

+96
-186
lines changed

.pre-commit-config.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v3.4.0
3+
rev: v6.0.0
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
77
- id: check-yaml
8-
- id: check-added-large-files
8+
- id: check-json
99
- id: detect-private-key
1010
- id: check-merge-conflict
1111
- id: check-case-conflict
12-
- id: check-docstring-first
1312
- id: check-builtin-literals
13+
- id: check-illegal-windows-names
1414

1515
- repo: https://github.com/asottile/setup-cfg-fmt
16-
rev: v1.16.0
16+
rev: v2.7.0
1717
hooks:
1818
- id: setup-cfg-fmt
1919

20-
- repo: https://github.com/dizballanze/gray
21-
rev: v0.10.1
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: v0.14.10
2222
hooks:
23-
- id: gray
23+
###### Relevant part below ######
24+
- id: ruff-check
25+
types_or: [python, pyi]
26+
args: ["check", "--select", "I", "--fix"]
27+
###### Relevant part above ######
28+
- id: ruff-format
29+
types_or: [python, pyi]

aprsd_slack_plugin/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
# License for the specific language governing permissions and limitations
1111
# under the License.
1212

13-
import pbr.version
13+
try:
14+
from importlib.metadata import PackageNotFoundError, version
15+
except ImportError:
16+
# Python < 3.8
17+
from importlib_metadata import PackageNotFoundError, version
1418

15-
__version__ = pbr.version.VersionInfo("aprsd_slack_plugin").version_string()
19+
try:
20+
__version__ = version("aprsd_slack_plugin")
21+
except PackageNotFoundError:
22+
__version__ = "unknown"

pyproject.toml

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,53 @@
22
requires = ["setuptools>=46.0", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5-
[tool.black]
6-
# Use the more relaxed max line length permitted in PEP8.
7-
line-length = 99
8-
target-version = ["py36", "py37", "py38"]
9-
# black will automatically exclude all files listed in .gitignore
5+
[project]
6+
name = "aprsd_slack_plugin"
7+
version = "1.2.0"
8+
description = "Amateur radio APRS daemon which listens for messages and responds"
9+
readme = "README.rst"
10+
requires-python = ">=3.11"
11+
license = {file = "LICENSE.txt"}
12+
authors = [
13+
{name = "Walter A. Boring IV", email = "[email protected]"}
14+
]
15+
classifiers = [
16+
"Topic :: Communications :: Ham Radio",
17+
"Operating System :: POSIX :: Linux",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3.11",
20+
]
21+
dependencies = [
22+
"slack_sdk>=3.0",
23+
"slackeventsapi>=2.1.0",
24+
"aprsd",
25+
"oslo_config",
26+
]
27+
28+
[project.optional-dependencies]
29+
dev = [
30+
"tox",
31+
"pytest",
32+
"pytest-cov",
33+
"mypy",
34+
"flake8",
35+
"pep8-naming",
36+
"black",
37+
"isort",
38+
"sphinx",
39+
"pre-commit",
40+
"pip-tools",
41+
]
42+
43+
[project.entry-points]
44+
"oslo.config.opts" = { "aprsd_slack_plugin.conf" = "aprsd_slack_plugin.conf.opts:list_opts" }
45+
46+
[tool.setuptools]
47+
packages = ["aprsd_slack_plugin"]
48+
49+
[tool.setuptools.package-data]
50+
aprsd_slack_plugin = ["py.typed"]
51+
1052

1153
[tool.isort]
1254
profile = "black"
@@ -20,3 +62,7 @@ skip_gitignore = true
2062

2163
[tool.coverage.run]
2264
branch = true
65+
66+
[tool.mypy]
67+
ignore_missing_imports = true
68+
strict = true

requirements-dev.in

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

requirements-dev.txt

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

requirements.txt

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

setup.cfg

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

setup.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
16-
import setuptools
15+
# Configuration is now in pyproject.toml
16+
# This file is kept for compatibility with tools that expect setup.py
17+
from setuptools import setup
1718

18-
# In python < 2.7.4, a lazy loading of package `pbr` will break
19-
# setuptools if some other modules registered functions in `atexit`.
20-
# solution from: http://bugs.python.org/issue15881#msg170215
21-
try:
22-
import multiprocessing # noqa
23-
except ImportError:
24-
pass
25-
26-
setuptools.setup(setup_requires=["pbr"], pbr=True)
19+
setup()

tox.ini

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,65 @@
1-
[flake8]
2-
# Use the more relaxed max line length permitted in PEP8.
3-
max-line-length = 99
4-
# This ignore is required by black.
5-
extend-ignore = E203
6-
extend-exclude =
7-
venv
8-
91
# This is the configuration for the tox-gh-actions plugin for GitHub Actions
102
# https://github.com/ymyzk/tox-gh-actions
113
# This section is not needed if not using GitHub Actions for CI.
124
[gh-actions]
135
python =
14-
3.9: py39
6+
3.11: py311
157

168
[tox]
179
# These are the default environments that will be run
1810
# when ``tox`` is run without arguments.
1911
envlist =
2012
lint
21-
py{39}
13+
py{311}
2214
skip_missing_interpreters = true
15+
requires = tox-uv
2316

2417
# Activate isolated build environment. tox will use a virtual environment
2518
# to build a source distribution from the source tree. For build tools and
2619
# arguments use the pyproject.toml file as specified in PEP-517 and PEP-518.
2720
isolated_build = true
2821

2922
[testenv]
23+
package = editable
3024
deps =
31-
-r{toxinidir}/requirements.txt
32-
-r{toxinidir}/requirements-dev.txt
25+
pytest
3326
commands =
3427
# Use -bb to enable BytesWarnings as error to catch str/bytes misuse.
3528
# Use -Werror to treat warnings as errors.
36-
{envpython} -bb -Werror -m pytest {posargs}
29+
uv run pytest tests {posargs}
3730

3831
[testenv:type-check]
3932
skip_install = true
4033
deps =
41-
-r{toxinidir}/requirements.txt
42-
-r{toxinidir}/requirements-dev.txt
34+
pytest
35+
mypy
4336
commands =
44-
mypy src tests
37+
uv run mypy src tests
4538

4639
[testenv:lint]
4740
skip_install = true
4841
deps =
49-
-r{toxinidir}/requirements-dev.txt
42+
pytest
43+
ruff
5044
commands =
51-
flake8 aprsd_slack_plugin tests
45+
uv run ruff check aprsd_slack_plugin tests
5246

5347
[testenv:docs]
5448
skip_install = true
5549
deps =
56-
-r{toxinidir}/requirements.txt
57-
-r{toxinidir}/requirements-dev.txt
50+
pytest
51+
sphinx
5852
changedir = {toxinidir}/docs
5953
commands =
60-
{envpython} clean_docs.py
61-
sphinx-apidoc --force --output-dir apidoc {toxinidir}/aprsd_slack_plugin
62-
sphinx-build -a -W . _build
54+
uv run python clean_docs.py
55+
uv run sphinx-apidoc --force --output-dir apidoc {toxinidir}/aprsd_slack_plugin
56+
uv run sphinx-build -a -W . _build
6357

6458
[testenv:licenses]
6559
skip_install = true
6660
recreate = true
6761
deps =
68-
-r{toxinidir}/requirements.txt
62+
pytest
6963
pip-licenses
7064
commands =
71-
pip-licenses {posargs}
65+
uv run pip-licenses {posargs}

0 commit comments

Comments
 (0)