Skip to content

Commit 9365add

Browse files
author
James Boulton
committed
uv goodness
1 parent 12a9c81 commit 9365add

5 files changed

Lines changed: 108 additions & 47 deletions

File tree

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

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,41 @@ jobs:
66
build:
77
name: Build distribution 📦
88
runs-on: ubuntu-latest
9-
109
steps:
11-
- uses: actions/checkout@v4
12-
- name: Set up Python
13-
uses: actions/setup-python@v4
14-
with:
15-
python-version: "3.x"
16-
- name: Install pypa/build
17-
run: >-
18-
python3 -m
19-
pip install
20-
build
21-
--user
22-
- name: Build a binary wheel and a source tarball
23-
run: python3 -m build
24-
- name: Store the distribution packages
25-
uses: actions/upload-artifact@v4
26-
with:
27-
name: python-package-distributions
28-
path: dist/
10+
- uses: actions/checkout@v4
11+
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v4
14+
15+
- name: Set up Python
16+
run: uv python install 3.13
17+
18+
- name: Build distribution
19+
run: uvx --from build pyproject-build --installer uv
20+
21+
- name: Store the distribution packages
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: python-package-distributions
25+
path: dist/
2926

3027
publish-to-pypi:
31-
name: >-
32-
Publish Python 🐍 distribution 📦 to PyPI
28+
name: Publish Python 🐍 distribution 📦 to PyPI
3329
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
3430
needs:
35-
- build
31+
- build
3632
runs-on: ubuntu-latest
3733
environment:
3834
name: pypi
39-
url: https://pypi.org/project/dashio # Replace <package-name> with your PyPI project name
35+
url: https://pypi.org/project/dashio
4036
permissions:
4137
id-token: write # IMPORTANT: mandatory for trusted publishing
42-
4338
steps:
44-
- name: Download all the dists
45-
uses: actions/download-artifact@v4
46-
with:
47-
name: python-package-distributions
48-
path: dist/
49-
- name: Publish distribution 📦 to PyPI
50-
uses: pypa/gh-action-pypi-publish@release/v1
39+
- name: Download all the dists
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: python-package-distributions
43+
path: dist/
44+
45+
- name: Publish distribution 📦 to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/tests.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest]
11-
python-version: ["3.11", "3.12", "3.13"]
11+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1212
steps:
1313
- uses: actions/checkout@v3
14-
- name: Set up Python ${{ matrix.python-version }}
15-
uses: actions/setup-python@v4
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v4
1616
with:
17-
python-version: ${{ matrix.python-version }}
18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install 'tox>=4.0' tox-gh-actions
22-
- name: Test with tox
23-
run: tox
17+
enable-cache: true
18+
- name: Set up Python ${{ matrix.python-version }}
19+
run: uv python install ${{ matrix.python-version }}
20+
- name: Install tox
21+
run: uv tool install tox --with tox-uv
22+
- name: Run tests
23+
run: uvx tox

dashio/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@
3232
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3333
SOFTWARE.
3434
"""
35+
try:
36+
from importlib.metadata import version, PackageNotFoundError
37+
except ImportError:
38+
# Python < 3.8
39+
from importlib_metadata import version, PackageNotFoundError
40+
41+
try:
42+
__version__ = version("dashio")
43+
except PackageNotFoundError:
44+
__version__ = "unknown"
3545

3646
from .device import Device
3747
from .tcp_connection import TCPConnection

pyproject.toml

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,62 @@
11
[build-system]
2-
requires = ["setuptools>=42.0", "wheel"]
2+
requires = ["setuptools>=61.0", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5+
[project]
6+
name = "dashio"
7+
version = "3.5.7"
8+
description = "DashIO interface library"
9+
readme = "README.md"
10+
authors = [
11+
{name = "James Boulton", email = "james@dashio.com"}
12+
]
13+
license = "MIT"
14+
classifiers = [
15+
"Programming Language :: Python :: 3.9",
16+
"Programming Language :: Python :: 3.10",
17+
"Programming Language :: Python :: 3.11",
18+
"Programming Language :: Python :: 3.12",
19+
"Programming Language :: Python :: 3.13",
20+
"Operating System :: OS Independent",
21+
]
22+
requires-python = ">=3.9"
23+
dependencies = [
24+
"paho-mqtt>=2.0.0",
25+
"pyzmq",
26+
"python-dateutil",
27+
"zeroconf",
28+
"shortuuid",
29+
"pyserial",
30+
]
31+
32+
[project.optional-dependencies]
33+
dev = [
34+
"pytest>=6.0",
35+
"pytest-cov>=2.0",
36+
"flake8>=3.9",
37+
"tox>=4.0",
38+
]
39+
40+
[project.urls]
41+
Homepage = "https://dashio.io"
42+
Repository = "https://github.com/dashio-connect/python-dashio"
43+
Download = "https://github.com/dashio-connect/python-dashio"
44+
45+
[project.scripts]
46+
c64_encode = "dashio.utilities.c64_encode:main"
47+
c64_decode = "dashio.utilities.c64_decode:main"
48+
dashio_data_exporter = "dashio.utilities.dashio_data_exporter:main"
49+
50+
[tool.setuptools]
51+
packages = ["dashio"]
52+
zip-safe = false
53+
54+
[tool.setuptools.package-data]
55+
dashio = ["py.typed"]
556

657
[tool.pytest.ini_options]
758
addopts = "--cov=dashio"
8-
testpaths = [
9-
"tests",
10-
]
59+
testpaths = ["tests"]
1160

1261
[tool.mypy]
1362
mypy_path = "dashio"
@@ -22,3 +71,7 @@ warn_return_any = true
2271
warn_unreachable = true
2372
warn_unused_configs = true
2473
no_implicit_reexport = true
74+
75+
[tool.flake8]
76+
max-line-length = 260
77+
per-file-ignores = "__init__.py:F401"

tox.ini

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
[tox]
2-
minversion = 3.8.0
3-
envlist = py311, py312, py313, flake8
2+
minversion = 4.0.0
3+
envlist = py310, py311, py312, py313, flake8
44
isolated_build = true
5+
requires = tox-uv
56

67
[gh-actions]
78
python =
9+
3.10: py310
810
3.11: py311
911
3.12: py312
1012
3.13: py313, flake8

0 commit comments

Comments
 (0)