Skip to content

Commit

Permalink
REFACTOR: Use pyproject.toml project definition
Browse files Browse the repository at this point in the history
  • Loading branch information
JoostJM committed May 9, 2023
1 parent e889f94 commit c341b31
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 102 deletions.
3 changes: 1 addition & 2 deletions MANIFEST.in
Expand Up @@ -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
Expand All @@ -24,4 +24,3 @@ recursive-include bin *.py

recursive-exclude * __pycache__
recursive-exclude * *.py[cod]
recursive-exclude * nosetests.xml
47 changes: 47 additions & 0 deletions 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"
6 changes: 1 addition & 5 deletions scikit-ci.yml
Expand Up @@ -46,11 +46,7 @@ build:

test:
commands:
- $<RUN_ENV> python setup.py test --args="--with-xunit --logging-level=DEBUG"

circleci:
commands:
- cp nosetests.xml $CIRCLE_TEST_REPORTS
- $<RUN_ENV> pytest

after_test:
commands:
Expand Down
22 changes: 18 additions & 4 deletions 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
Expand Down
90 changes: 0 additions & 90 deletions setup.py
Expand Up @@ -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"],
Expand All @@ -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
)
2 changes: 1 addition & 1 deletion tests/test_wavelet.py
Expand Up @@ -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):
Expand Down

0 comments on commit c341b31

Please sign in to comment.