diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 68c5fcbd..13b92d31 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -27,7 +27,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools - pip install -r requirements_test.txt + pip install .[test] pip install ${{ matrix.dependencies }} - name: Lint with flake8 run: | diff --git a/docs/development.rst b/docs/development.rst index 4364c738..b6dd1d76 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -61,7 +61,7 @@ Install requirements: .. code-block:: none - pip install -r ~/highdicom/requirements_test.txt + pip install .[test] Run tests (including checks for PEP8 compliance): @@ -79,7 +79,7 @@ Install requirements: .. code-block:: none - pip install -r ~/highdicom/requirements_docs.txt + pip install .[docs] Build documentation in *HTML* format: diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..516ee805 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,82 @@ +[build-system] +requires = ["setuptools>=64"] +build-backend = "setuptools.build_meta" + +[project] +name = "highdicom" +dynamic = ["version"] +description = "High-level DICOM abstractions." +readme = "README.md" +requires-python = ">=3.6" +authors = [ + { name = "Markus D. Herrmann" }, +] +maintainers = [ + { name = "Markus D. Herrmann" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX :: Linux", + "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", + "Topic :: Multimedia :: Graphics", + "Topic :: Scientific/Engineering :: Information Analysis", +] +dependencies = [ + "numpy>=1.19", + "pillow-jpls>=1.0", + "pillow>=8.3", + "pydicom>=2.3.0,!=2.4.0", +] + +[project.optional-dependencies] +libjpeg = [ + "pylibjpeg-libjpeg>=1.3", + "pylibjpeg-openjpeg>=1.2", + "pylibjpeg>=1.4", +] +test = [ + "mypy==0.971", + "pytest==7.1.2", + "pytest-cov==3.0.0", + "pytest-flake8==1.1.1", + "numpy-stubs @ git+https://github.com/numpy/numpy-stubs@201115370a0c011d879d69068b60509accc7f750", +] +docs = [ + "sphinx-autodoc-typehints==1.17.0", + "sphinx-pyreverse==0.0.17", + "sphinx-rtd-theme==1.0.0", + "sphinxcontrib-autoprogram==0.1.7", + "sphinxcontrib-websupport==1.2.4", +] + +[project.urls] +homepage = "https://github.com/imagingdatacommons/highdicom" +documentation = "https://highdicom.readthedocs.io/" +repository = "https://github.com/ImagingDataCommons/highdicom.git" + +[tool.pytest.ini_options] +addopts = "--doctest-modules" +testpaths = ["tests"] +log_cli_level = "INFO" + +[tool.mypy] +warn_unreachable = true + +[[tool.mypy.overrides]] +module = "mypy-pydicom.*" +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = "mypy-PIL.*" +ignore_missing_imports = true diff --git a/requirements_docs.txt b/requirements_docs.txt deleted file mode 100644 index 112567c4..00000000 --- a/requirements_docs.txt +++ /dev/null @@ -1,5 +0,0 @@ -sphinx-autodoc-typehints==1.17.0 -sphinx-pyreverse==0.0.17 -sphinx-rtd-theme==1.0.0 -sphinxcontrib-autoprogram==0.1.7 -sphinxcontrib-websupport==1.2.4 diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100644 index 28485662..00000000 --- a/requirements_test.txt +++ /dev/null @@ -1,5 +0,0 @@ -mypy==0.971 -pytest==7.1.2 -pytest-cov==3.0.0 -pytest-flake8==1.1.1 -git+https://github.com/numpy/numpy-stubs@201115370a0c011d879d69068b60509accc7f750#egg=numpy-stubs diff --git a/setup.cfg b/setup.cfg index a33db6a4..1340c5f1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,17 +5,3 @@ test=pytest max_line_length = 80 ignore = E121 E125 W504 statistics = True - -[mypy] -warn_unreachable = True - -[mypy-pydicom.*] -ignore_missing_imports = True - -[mypy-PIL.*] -ignore_missing_imports = True - -[tool:pytest] -python_files = tests/*.py -log_cli_level = INFO -addopts = --doctest-modules diff --git a/setup.py b/setup.py deleted file mode 100644 index 65c6914b..00000000 --- a/setup.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -import re - -import setuptools -from pathlib import Path - -root_directory = Path(__file__).parent -readme_filepath = root_directory.joinpath('README.md') -long_description = readme_filepath.read_text() - - -def get_version(): - version_filepath = Path('src', 'highdicom', 'version.py') - with open(version_filepath, encoding='utf8') as f: - version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1) - return version - - -setuptools.setup( - name='highdicom', - version=get_version(), - description='High-level DICOM abstractions.', - long_description=long_description, - long_description_content_type='text/markdown', - author='Markus D. Herrmann', - maintainer='Markus D. Herrmann', - url='https://github.com/imagingdatacommons/highdicom', - license='MIT', - platforms=['Linux', 'MacOS', 'Windows'], - classifiers=[ - 'Operating System :: MacOS', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: POSIX :: Linux', - 'License :: OSI Approved :: MIT License', - 'Intended Audience :: Science/Research', - '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', - 'Development Status :: 4 - Beta', - ], - include_package_data=True, - packages=setuptools.find_packages('src'), - package_dir={'': 'src'}, - python_requires='>=3.6', - install_requires=[ - 'pydicom>=2.3.0,!=2.4.0', - 'numpy>=1.19', - 'pillow>=8.3', - 'pillow-jpls>=1.0', - ], - extras_require={ - 'libjpeg': [ - 'pylibjpeg>=1.4', - 'pylibjpeg-libjpeg>=1.3', - 'pylibjpeg-openjpeg>=1.2' - ], - }, -)