From 7b3a7bfbcbc2e8dbb44a372afe4193f3f3201d1a Mon Sep 17 00:00:00 2001 From: Bryn Lloyd <12702862+dyollb@users.noreply.github.com> Date: Sat, 14 Sep 2024 16:08:46 +0200 Subject: [PATCH] add pyproject.toml --- .gitignore | 3 +++ pyproject.toml | 40 ++++++++++++++++++++++++++++++++++++++++ setup.cfg | 5 ----- setup.py | 50 ++------------------------------------------------ 4 files changed, 45 insertions(+), 53 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg diff --git a/.gitignore b/.gitignore index 5adc6fe..e364b54 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ target/ # Local development environment .env .vscode/ + +# Virtual environment +.venv diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..82b3bba --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "slicerio" +dynamic = ["version"] +description = "Utilities for 3D Slicer" +readme = "README.md" +requires-python = ">=3.6" +keywords = ["3DSlicer", "medical imaging", "segmentation"] +authors = [{ name = "Andras Lasso", email = "lasso@queensu.ca" }] +maintainers = [{ name = "Andras Lasso", email = "lasso@queensu.ca" }] +license = { file = "LICENSE" } +classifiers = [ + "License :: OSI Approved :: MIT License", + "Intended Audience :: Developers", + "Intended Audience :: Healthcare Industry", + "Intended Audience :: Science/Research", + "Development Status :: 4 - Beta", + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", + "Topic :: Scientific/Engineering :: Medical Science Apps.", + "Topic :: System :: Networking", +] + +dependencies = ["pynrrd", "numpy", "requests"] + +[project.optional-dependencies] +dev = ["build", "mypy", "pre-commit", "pytest"] + +[project.urls] +Homepage = "https://github.com/lassoan/slicerio" +Download = "https://github.com/lassoan/slicerio/archive/master.zip" + +[tool.setuptools.dynamic] +version = {attr = "slicerio.__version__"} + +[tool.flake8] +max-line-length = 180 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8d80308..0000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -max-line-length = 180 - -[metadata] -description_file = README.md diff --git a/setup.py b/setup.py index c214d03..0ae4555 100644 --- a/setup.py +++ b/setup.py @@ -1,51 +1,5 @@ -#!/usr/bin/env python +from setuptools import setup -import os.path -from setuptools import setup, find_packages - -# Get __version__ from slicerio/_version.py -base_dir = os.path.dirname(os.path.realpath(__file__)) -version_file = os.path.join(base_dir, 'slicerio', '_version.py') -print("base_dir="+base_dir) -print("version_file="+version_file) -with open(version_file) as f: - exec(f.read()) -# pylint/flake does not know that this script injects a variable, so we need to disable checks -VERSION = __version__ # pylint:disable=undefined-variable # noqa: F821 - -# Get long description from README.md -base_path = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(base_path, 'README.md')) as f: - LONG_DESCRIPTION = f.read() - -opts = dict( - name="slicerio", - python_requires='>=3.6', - version=VERSION, - maintainer="Andras Lasso", - maintainer_email="lasso@queensu.ca", - author="Andras Lasso", - author_email="lasso@queensu.ca", - description="Utilities for 3D Slicer", - long_description=LONG_DESCRIPTION, - long_description_content_type='text/markdown', - url="https://github.com/lassoan/slicerio", - download_url="https://github.com/lassoan/slicerio/archive/master.zip", - keywords="3DSlicer medical imaging segmentation", - classifiers=[ - "License :: OSI Approved :: MIT License", - "Intended Audience :: Developers", - "Intended Audience :: Healthcare Industry", - "Intended Audience :: Science/Research", - "Development Status :: 4 - Beta", - "Programming Language :: Python :: 3", - "Operating System :: OS Independent", - "Topic :: Scientific/Engineering :: Medical Science Apps.", - "Topic :: System :: Networking" - ], - packages=find_packages(), - install_requires=['pynrrd', 'numpy', 'requests'], -) if __name__ == '__main__': - setup(**opts) + setup()