From c341b31f76be6eb5b2247a333b27924f95a1fe30 Mon Sep 17 00:00:00 2001 From: joostjm Date: Tue, 9 May 2023 16:15:35 +0200 Subject: [PATCH] REFACTOR: Use pyproject.toml project definition --- MANIFEST.in | 3 +- pyproject.toml | 47 ++++++++++++++++++++++ scikit-ci.yml | 6 +-- setup.cfg | 22 +++++++++-- setup.py | 90 ------------------------------------------- tests/test_wavelet.py | 2 +- 6 files changed, 68 insertions(+), 102 deletions(-) create mode 100644 pyproject.toml diff --git a/MANIFEST.in b/MANIFEST.in index fb19cd77..f50e20be 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,7 +6,7 @@ include requirements-dev.txt include requirements-setup.txt include versioneer.py -recursive-include radiomics * +recursive-include src/radiomics * recursive-include data/baseline * recursive-include data *_image.nrrd @@ -24,4 +24,3 @@ recursive-include bin *.py recursive-exclude * __pycache__ recursive-exclude * *.py[cod] -recursive-exclude * nosetests.xml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..40034f9b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,47 @@ +[build-system] +requires = ["setuptools>=61.0", "numpy", "versioneer"] +build-backend = "setuptools.build_meta" + +[project] +name = "pyradiomics" +version = "3.0.1a1" +authors = [ + { name = "PyRadimiomics Community", email = "pyradiomics@googlegroups.com"} +] +description = "Radiomics features library for python" +readme = "README.md" +requires-python =">=3.5" +license = { file = "LICENSE.txt"} +keywords = [ "radiomics", "cancerimaging", "medicalresearch", "computationalimaging" ] +classifiers = [ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: BSD License', + 'Operating System :: OS Independent', + 'Programming Language :: C', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Topic :: Scientific/Engineering :: Bio-Informatics' +] +dependencies = [ + "numpy", + "SimpleITK", + "PyWavelets", + "pykwalify", + "six" +] + +[project.scripts] +pyradiomics = "radiomics.scripts.__init__:parse_args" + +[project.urls] +"Homepaget" = "http://github.com/AIM-Harvard/pyradiomics#readme" +"Radiomics.io" = "https://www.radiomics.io/" +"Documentation" = "https://pyradiomics.readthedocs.io/en/latest/index.html" +"Docker" = "https://hub.docker.com/r/radiomics/pyradiomics/" +"Github" = "https://github.com/AIM-Harvard/pyradiomics" diff --git a/scikit-ci.yml b/scikit-ci.yml index fba7450a..cb1b6db3 100644 --- a/scikit-ci.yml +++ b/scikit-ci.yml @@ -46,11 +46,7 @@ build: test: commands: - - $ python setup.py test --args="--with-xunit --logging-level=DEBUG" - - circleci: - commands: - - cp nosetests.xml $CIRCLE_TEST_REPORTS + - $ pytest after_test: commands: diff --git a/setup.cfg b/setup.cfg index d973f4c7..4d7af05d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,23 @@ [metadata] -description-file = README.md +description_file = README.md -[nosetests] -verbosity=3 -where=tests +[options] +install_requires = + numpy + SimpleITK + PyWavelets + pykwalify + six +include_package_data=False + +[options.packages.find] +include=radiomics* +exclude=radiomics.schemas + +[options.package_data] +radiomics = + schemas/paramSchema.yaml + schemas/schemaFuncs.py [versioneer] VCS = git diff --git a/setup.py b/setup.py index d922a42d..eed0c4d2 100644 --- a/setup.py +++ b/setup.py @@ -2,59 +2,15 @@ from distutils import sysconfig import platform -import sys import numpy from setuptools import Extension, setup -from setuptools.command.test import test as TestCommand import versioneer -# Check if current PyRadiomics is compatible with current python installation (> 2.6, 64 bits) -if sys.version_info < (2, 6, 0): - raise Exception("pyradiomics > 0.9.7 requires python 2.6 or later") - if platform.architecture()[0].startswith('32'): raise Exception('PyRadiomics requires 64 bits python') -with open('requirements.txt', 'r') as fp: - requirements = list(filter(bool, (line.strip() for line in fp))) - -with open('requirements-dev.txt', 'r') as fp: - dev_requirements = list(filter(bool, (line.strip() for line in fp))) - -with open('requirements-setup.txt', 'r') as fp: - setup_requirements = list(filter(bool, (line.strip() for line in fp))) - -with open('README.md', 'rb') as fp: - long_description = fp.read().decode('utf-8') - - -class NoseTestCommand(TestCommand): - """Command to run unit tests using nose driver after in-place build""" - - user_options = TestCommand.user_options + [ - ("args=", None, "Arguments to pass to nose"), - ] - - def initialize_options(self): - self.args = [] - TestCommand.initialize_options(self) - - def finalize_options(self): - TestCommand.finalize_options(self) - if self.args: - self.args = __import__('shlex').split(self.args) - - def run_tests(self): - # Run nose ensuring that argv simulates running nosetests directly - nose_args = ['nosetests'] - nose_args.extend(self.args) - __import__('nose').run_exit(argv=nose_args) - - commands = versioneer.get_cmdclass() -commands['test'] = NoseTestCommand - incDirs = [sysconfig.get_python_inc(), numpy.get_include()] ext = [Extension("radiomics._cmatrices", ["radiomics/src/_cmatrices.c", "radiomics/src/cmatrices.c"], @@ -65,56 +21,10 @@ def run_tests(self): setup( name='pyradiomics', - url='http://github.com/Radiomics/pyradiomics#readme', - project_urls={ - 'Radiomics.io': 'https://www.radiomics.io/', - 'Documentation': 'https://pyradiomics.readthedocs.io/en/latest/index.html', - 'Docker': 'https://hub.docker.com/r/radiomics/pyradiomics/', - 'Github': 'https://github.com/Radiomics/pyradiomics' - }, - - author='pyradiomics community', - author_email='pyradiomics@googlegroups.com', - version=versioneer.get_version(), cmdclass=commands, packages=['radiomics', 'radiomics.scripts'], ext_modules=ext, zip_safe=False, - package_data={'radiomics': ['schemas/paramSchema.yaml', 'schemas/schemaFuncs.py']}, - - entry_points={ - 'console_scripts': [ - 'pyradiomics=radiomics.scripts.__init__:parse_args' - ]}, - - description='Radiomics features library for python', - long_description=long_description, - long_description_content_type='text/markdown', - - license='BSD License', - - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: C', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Topic :: Scientific/Engineering :: Bio-Informatics', - ], - - keywords='radiomics cancerimaging medicalresearch computationalimaging', - - install_requires=requirements, - test_suite='nose.collector', - tests_require=dev_requirements, - setup_requires=setup_requirements ) diff --git a/tests/test_wavelet.py b/tests/test_wavelet.py index 81a98a00..2d2c71aa 100644 --- a/tests/test_wavelet.py +++ b/tests/test_wavelet.py @@ -8,7 +8,7 @@ logger = logging.getLogger('radiomics.testing') testCases = ('test_wavelet_64x64x64', 'test_wavelet_37x37x37') -baselineFile = '../data/baseline/wavelet.npy' +baselineFile = os.path.join(os.path.dirname(__file__), '../data/baseline/wavelet.npy') def pytest_generate_tests(metafunc):