Skip to content

Commit ded157f

Browse files
authored
Merge pull request #114 from openradx/uv-project-management
Migrating from setuptools to uv
2 parents 8d79218 + a915f3f commit ded157f

File tree

8 files changed

+66
-103
lines changed

8 files changed

+66
-103
lines changed

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 80
3+
ignore = E121,E125,W504
4+
statistics = true

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build and Publish Client to PyPI
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
build-and-publish-client:
7+
runs-on: ubuntu-latest
8+
environment:
9+
name: pypi
10+
url: https://pypi.org/p/dicomweb-client
11+
permissions:
12+
id-token: write
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v6
18+
with:
19+
version: "0.7.2"
20+
- name: Setup Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version-file: "pyproject.toml"
24+
- name: Build wheel and sdist
25+
run: uv build
26+
- name: Publish package distributions to PyPI
27+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/run_unit_tests.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,16 @@ jobs:
2828
- name: Set up Python ${{ matrix.python-version }}
2929
uses: actions/setup-python@v2
3030
with:
31-
python-version: ${{ matrix.python-version }}
31+
python-version: ${{ matrix.python-version }}
32+
- name: Install uv
33+
uses: astral-sh/setup-uv@v6
34+
with:
35+
version: "0.7.2"
3236
- name: Install dependencies
33-
run: |
34-
python -m pip install --upgrade pip setuptools
35-
pip install '.[test]'
36-
pip install .
37+
run: uv sync
3738
- name: Lint with flake8
38-
run: |
39-
flake8 --exclude='bin,build,.eggs'
39+
run: uv run flake8 src tests --exclude=.venv,build,.eggs
4040
- name: Check type hints with mypy
41-
run: |
42-
mypy src tests
41+
run: uv run mypy src tests
4342
- name: Test with pytest
44-
run: |
45-
pytest --cov=dicomweb_client --cov-fail-under=65 tests
43+
run: uv run pytest --cov=dicomweb_client --cov-fail-under=65 tests

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,6 @@ venv.bak/
105105

106106
# pytest
107107
.pytest_cache
108+
109+
# lock files
110+
*.lock

pyproject.toml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
[build-system]
2-
requires = ["setuptools>=64"]
3-
build-backend = "setuptools.build_meta"
4-
51
[project]
62
name = "dicomweb-client"
7-
version = "0.59.3"
3+
dynamic = ["version"]
84
description = "Client for DICOMweb RESTful services."
95
readme = "README.md"
10-
requires-python = ">=3.6"
11-
authors = [
12-
{ name = "Markus D. Herrmann" },
13-
]
6+
requires-python = ">=3.9"
7+
authors = [{ name = "Markus D. Herrmann" }]
148
maintainers = [
159
{ name = "Markus D. Herrmann" },
1610
{ name = "Christopher P. Bridge" },
@@ -28,9 +22,6 @@ classifiers = [
2822
"Topic :: Multimedia :: Graphics",
2923
"Topic :: Scientific/Engineering :: Information Analysis",
3024
"Programming Language :: Python :: 3",
31-
"Programming Language :: Python :: 3.6",
32-
"Programming Language :: Python :: 3.7",
33-
"Programming Language :: Python :: 3.8",
3425
"Programming Language :: Python :: 3.9",
3526
"Programming Language :: Python :: 3.10",
3627
"Programming Language :: Python :: 3.11",
@@ -47,12 +38,12 @@ dependencies = [
4738
]
4839

4940
[project.optional-dependencies]
50-
gcp = [
51-
"dataclasses>=0.8; python_version=='3.6'",
52-
"google-auth>=1.6",
53-
]
41+
gcp = ["dataclasses>=0.8; python_version=='3.6'", "google-auth>=1.6"]
42+
43+
[dependency-groups]
5444
test = [
5545
"mypy==0.982",
46+
"flake8==6.1.0",
5647
"pytest==7.1.3",
5748
"pytest-cov==3.0.0",
5849
"pytest-flake8==1.1.3",
@@ -68,6 +59,9 @@ docs = [
6859
"sphinx-autodoc-typehints==1.12.0",
6960
]
7061

62+
[tool.uv]
63+
default-groups = "all"
64+
7165
[project.scripts]
7266
dicomweb_client = "dicomweb_client.cli:_main"
7367

@@ -98,3 +92,10 @@ ignore_missing_imports = true
9892
[[tool.mypy.overrides]]
9993
module = "retrying.*"
10094
ignore_missing_imports = true
95+
96+
[tool.hatch.version]
97+
source = "uv-dynamic-versioning"
98+
99+
[build-system]
100+
requires = ["hatchling", "uv-dynamic-versioning"]
101+
build-backend = "hatchling.build"

setup.cfg

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

setup.py

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

src/dicomweb_client/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
__version__ = '0.59.3'
1+
import importlib.metadata
22

33
from dicomweb_client.api import DICOMwebClient, DICOMfileClient
44
from dicomweb_client.protocol import DICOMClient
55
from dicomweb_client.uri import URI, URISuffix, URIType
66

7+
try:
8+
__version__ = importlib.metadata.version(__name__)
9+
except importlib.metadata.PackageNotFoundError:
10+
__version__ = '0.0.0'
11+
712
__all__ = [
813
'DICOMClient',
914
'DICOMfileClient',

0 commit comments

Comments
 (0)