From a0f22754e4e87b4dfae3bddb331bb871a0ca1fc2 Mon Sep 17 00:00:00 2001 From: Chris Bridge Date: Sat, 19 Oct 2024 14:33:45 -0400 Subject: [PATCH 1/4] docstring fix --- src/dicomweb_client/web.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/dicomweb_client/web.py b/src/dicomweb_client/web.py index 4066f9c..6876ec4 100644 --- a/src/dicomweb_client/web.py +++ b/src/dicomweb_client/web.py @@ -877,9 +877,7 @@ def _build_multipart_accept_header_field_value( media_types: Union[Tuple[Union[str, Tuple[str, str]], ...], None] Acceptable media types and optionally the UIDs of the corresponding transfer syntaxes - supported_media_types: Union[ - Mapping[str, Union[str, Tuple[str, ...]]], Set[str] - ] + supported_media_types: Union[Mapping[str, Union[str, Tuple[str, ...]]], Set[str]] Set of supported media types or mapping of transfer syntaxes to their corresponding media types @@ -888,7 +886,7 @@ def _build_multipart_accept_header_field_value( str Accept header field value - """ + """ # noqa: E501 if not isinstance(media_types, (list, tuple, set)): raise TypeError( 'Acceptable media types must be provided as a sequence.' From 1371496dd416557f4e8de0b1f07d9a366eeef02f Mon Sep 17 00:00:00 2001 From: Chris Bridge Date: Sat, 19 Oct 2024 18:41:19 -0400 Subject: [PATCH 2/4] Move to pyproject.toml, add support for 3.11, 3.12, 3.13 --- .github/workflows/run_unit_tests.yml | 12 +++- .readthedocs.yaml | 10 +-- MANIFEST.in | 1 - docs/development.rst | 15 ++-- pyproject.toml | 100 +++++++++++++++++++++++++++ requirements_docs.txt | 5 -- requirements_test.txt | 7 -- setup.cfg | 16 ----- src/dicomweb_client/__init__.py | 2 +- 9 files changed, 126 insertions(+), 42 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 requirements_docs.txt delete mode 100644 requirements_test.txt diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index f0504ec..ce70c41 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -15,7 +15,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: [ + "3.7", + "3.8", + "3.9", + "3.10", + "3.11", + "3.12", + "3.13" + ] steps: - uses: actions/checkout@v2 @@ -26,7 +34,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools - pip install -r requirements_test.txt + pip install '.[test]' pip install . - name: Lint with flake8 run: | diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 1315801..a790306 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,14 +1,16 @@ version: 2 build: - os: "ubuntu-20.04" + os: "ubuntu-22.04" tools: - python: "3.8" + python: "3.11" python: install: - - requirements: requirements_docs.txt - - path: . + - method: pip + path: . + extra_requirements: + - docs sphinx: configuration: docs/conf.py diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 3b6c6da..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include src/dicomweb_client/* diff --git a/docs/development.rst b/docs/development.rst index 96c5425..faa425a 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -7,13 +7,16 @@ Source code is available at Github and can be cloned via git: .. code-block:: none - git clone https://github.com/ImagingDataCommons/dicomweb-client ~/dicomweb-client + git clone https://github.com/ImagingDataCommons/dicomweb-client /path/to/dicomweb-client + +where `/path/to/dicomweb-client` is a suitable path on your system where you +wish to clone the repository. The :mod:`dicomweb_client` package can be installed in *develop* mode for local development: .. code-block:: none - pip install -e ~/dicomweb-client + pip install -e /path/to/dicomweb-client .. _pull-requests: @@ -54,13 +57,13 @@ Install requirements: .. code-block:: none - pip install -r ~/dicomweb-client/requirements_test.txt + pip install '/path/to/dicomweb-client[test]' Run tests (including checks for PEP8 compliance): .. code-block:: none - cd ~/dicomweb-client + cd /path/to/dicomweb-client pytest --flake8 .. _building-documentation: @@ -72,13 +75,13 @@ Install requirements: .. code-block:: none - pip install -r ~/dicomweb-client/requirements_docs.txt + pip install '/path/to/dicomweb-client[docs]' Build documentation in *HTML* format: .. code-block:: none - cd ~/dicomweb-client + cd /path/to/dicomweb-client sphinx-build -b html docs/ docs/build/ The built ``index.html`` file will be located in ``docs/build``. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bfc9cfd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,100 @@ +[build-system] +requires = ["setuptools>=64"] +build-backend = "setuptools.build_meta" + +[project] +name = "dicomweb-client" +version = "0.59.2" +description = "Client for DICOMweb RESTful services." +readme = "README.md" +requires-python = ">=3.6" +authors = [ + { name = "Markus D. Herrmann" }, +] +maintainers = [ + { name = "Markus D. Herrmann" }, + { name = "Christopher P. Bridge" }, + { name = "Steve Pieper" }, +] +license = { text = "LICENSE" } +classifiers = [ + "Environment :: Web Environment", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "Intended Audience :: Science/Research", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Multimedia :: Graphics", + "Topic :: Scientific/Engineering :: Information Analysis", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +dependencies = [ + "numpy>=1.19", + "requests>=2.18", + "retrying>=1.3.3", + "Pillow>=8.3", + "pydicom>=2.2", + "typing-extensions>=4.0; python_version < '3.8.0'", +] + +[project.optional-dependencies] +gcp = [ + "dataclasses>=0.8; python_version=='3.6'", + "google-auth>=1.6", +] +test = [ + "mypy==0.982", + "pytest==7.1.3", + "pytest-cov==3.0.0", + "pytest-flake8==1.1.1", + "pytest-localserver==0.5.0", + "types-requests==2.27.14", + "types-Pillow==9.0.8", +] +docs = [ + "sphinx-pyreverse==0.0.17", + "sphinx-rtd-theme==1.0.0", + "sphinxcontrib-autoprogram==0.1.7", + "sphinxcontrib-websupport==1.2.4", + "sphinx-autodoc-typehints==1.12.0", +] + +[project.scripts] +dicomweb-client = "dicomweb_client.cli:_main" + +[project.urls] +homepage = "https://github.com/imagingdatacommons/dicomweb-client" +documentation = "https://dicomweb-client.readthedocs.io/" +repository = "https://github.com/ImagingDataCommons/dicomweb-client.git" + +[tool.pytest.ini_options] +minversion = "7" +addopts = ["--doctest-modules", "-ra", "--strict-config", "--strict-markers"] +testpaths = ["tests"] +log_cli_level = "INFO" +xfail_strict = true + +[tool.mypy] +warn_unreachable = true +enable_error_code = ["redundant-expr", "truthy-bool"] + +[[tool.mypy.overrides]] +module = "pydicom.*" +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "google.*" +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "retrying.*" +ignore_missing_imports = true diff --git a/requirements_docs.txt b/requirements_docs.txt deleted file mode 100644 index 7fb5267..0000000 --- a/requirements_docs.txt +++ /dev/null @@ -1,5 +0,0 @@ -sphinx-pyreverse==0.0.17 -sphinx-rtd-theme==1.0.0 -sphinxcontrib-autoprogram==0.1.7 -sphinxcontrib-websupport==1.2.4 -sphinx-autodoc-typehints==1.12.0 diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100644 index 49b87c1..0000000 --- a/requirements_test.txt +++ /dev/null @@ -1,7 +0,0 @@ -mypy==0.982 -pytest==7.1.3 -pytest-cov==3.0.0 -pytest-flake8==1.1.1 -pytest-localserver==0.5.0 -types-requests==2.27.14 -types-Pillow==9.0.8 diff --git a/setup.cfg b/setup.cfg index 15b355e..1340c5f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,19 +5,3 @@ test=pytest max_line_length = 80 ignore = E121 E125 W504 statistics = True - -[mypy] -warn_unreachable = True - -[mypy-google.*] -ignore_missing_imports = True - -[mypy-pydicom.*] -ignore_missing_imports = True - -[mypy-retrying.*] -ignore_missing_imports = True - -[tool:pytest] -python_files = tests/*.py -log_cli_level = INFO diff --git a/src/dicomweb_client/__init__.py b/src/dicomweb_client/__init__.py index 07ea8c7..9d515d8 100644 --- a/src/dicomweb_client/__init__.py +++ b/src/dicomweb_client/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.59.1' +__version__ = '0.59.2' from dicomweb_client.api import DICOMwebClient, DICOMfileClient from dicomweb_client.protocol import DICOMClient From 4d694cfaccd18ec780e8c459ca01e2ea72a8d365 Mon Sep 17 00:00:00 2001 From: Chris Bridge Date: Sat, 19 Oct 2024 20:48:38 -0400 Subject: [PATCH 3/4] Bump pytest-flake8 version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bfc9cfd..94d891a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ test = [ "mypy==0.982", "pytest==7.1.3", "pytest-cov==3.0.0", - "pytest-flake8==1.1.1", + "pytest-flake8==1.2.2", "pytest-localserver==0.5.0", "types-requests==2.27.14", "types-Pillow==9.0.8", From 5d7f42123b0ac3225dafdb993d9d7b2bceb2b82d Mon Sep 17 00:00:00 2001 From: Chris Bridge Date: Sat, 19 Oct 2024 20:53:46 -0400 Subject: [PATCH 4/4] Downgrade pytest-flake8 again to support older python --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 94d891a..cd302f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ test = [ "mypy==0.982", "pytest==7.1.3", "pytest-cov==3.0.0", - "pytest-flake8==1.2.2", + "pytest-flake8==1.1.3", "pytest-localserver==0.5.0", "types-requests==2.27.14", "types-Pillow==9.0.8",