AIM-Harvard / pyradiomics

Open-source python package for the extraction of Radiomics features from 2D and 3D images and binary masks. Support: https://discourse.slicer.org/c/community/radiomics
http://pyradiomics.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.14k stars 492 forks source link

Defer numpy import on first pass of setup.py #761

Open masalim2 opened 2 years ago

masalim2 commented 2 years ago

This PR addresses #653 by ensuring that numpy is not required on the first pass of setup.py. This makes pyradiomics easy to install into new virtual environments without having an a priori installation of numpy.

The update is based on the fact that setuptools invokes setup.py multiple times, and on the first pass, you must guard import statements of modules in the setup_requires section. We can therefore mock out the numpy module on the first pass, which should not affect the subsequent installation steps after the build system has fetched numpy and installed it.

masalim2 commented 2 years ago

Current CI failures are due to flake8 linting of labs/pyradiomics-dcm/pyradiomics-dcm.py -- unrelated to this change

JoostJM commented 1 year ago

Can you rebase on PR #788? This allows me to see if your changes do not break the build process.

masalim2 commented 1 year ago

@JoostJM All set -- this PR is now just one commit ahead of JoostJM/circle-ci-mac-os

JoostJM commented 1 year ago

I have only recently finished the updates to get CI working again. Involved not only a transition to different CI servers, but also a transition of testing package...

I'm about to make a new release (3.1.0). If you can rebase one more time on the new release (should not break much), then I'll create release 3.1.1 once this PR is merged. I don´t want to wait with release 3.1.0, as it is already long overdue.

JoostJM commented 1 year ago

In addition, as you can see in #807, adding the pyproject.toml also fixes this particular error. I think your issue will therefore be resolved upon the 3.1.0 release. In any case, I'm still planning to include this PR in a 3.1.1 release.