Skip to content

[ENH] Abandon distutils #1627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 4, 2016
Merged

[ENH] Abandon distutils #1627

merged 13 commits into from
Oct 4, 2016

Conversation

oesteban
Copy link
Contributor

@oesteban oesteban commented Sep 13, 2016

This PR removes the dependency on distutils and uses only setuptools.

Following the recommendations I have reorganized the way nipype installs. Reading through this discussion it seems that requirements.txt should be written for development environments, and production (pypi, mostly) dependencies should be handled with setuptools.

Therefore, in this PR we start using all the available possibilities (setup_requires, install_requires, test_requires, extra_requires, etc.) to install nipype smoothly.

I am testing all the possibilities with fresh environments:

  • Regular user install through pypi, with the duecredit extra dependency:

    pip install nipype[duecredit]
    
  • Regular user install from master:

    python setup.py install
    
  • Developer install:

    pip install -r requirements.txt
    pip install -e .[test,doc]
    
  • Testing install:

    pip install -r requirements.txt
    pip install -e .[all]
    

The available extra dependencies are listed here: https://github.com/oesteban/nipype/blob/enh/MigrateToSetuptools/nipype/info.py#L157

This PR requires #1623 to be merged first. Closes #1605

@oesteban
Copy link
Contributor Author

One possible improvement to help novice users would be adding a check on the available third party tools (AFNI, FSL, FreeSurfer, etc.) and report it ala matplotlib, warning the user about those missing software pieces.

@codecov-io
Copy link

codecov-io commented Sep 13, 2016

Current coverage is 70.95% (diff: 100%)

Merging #1627 into master will increase coverage by 0.05%

@@             master      #1627   diff @@
==========================================
  Files          1027       1027          
  Lines         51574      51577     +3   
  Methods           0          0          
  Messages          0          0          
  Branches       7309       7310     +1   
==========================================
+ Hits          36564      36596    +32   
+ Misses        13917      13887    -30   
- Partials       1093       1094     +1   

Powered by Codecov. Last update 5427538...8d28bde

@satra
Copy link
Member

satra commented Sep 13, 2016

@oesteban - i would make that part of the new cli #1608 and it could internally use a function that checks and returns underlying tool status

@oesteban
Copy link
Contributor Author

oesteban commented Sep 13, 2016

That sounds pretty cool!

Something like nipype check_deps ?

But I guess that'd be better in another PR, right?

@satra
Copy link
Member

satra commented Oct 1, 2016

@oesteban - resolve conflicts here.

EXTRA_REQUIRES = {
'doc': ['Sphinx>=0.3'],
'tests': TESTS_REQUIRES,
'fmri': ['nitime', 'nilearn'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this also have support for nipy and dipy and matplotlib?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fmri extra or the tests extras? I guess so, this is the best moment to decide the dependencies and how we organize them

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps for both, but at present for the various interfaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, for the doc extra, what are the dependencies?? There were some graphviz-related dependencies here right?. Also matplotlib.

Copy link
Contributor Author

@oesteban oesteban Oct 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, found it. As per #1350, what do you think? pygraphviz or pydot (or pydot2 #1280) - @satra

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of them actually require graphviz installed. but if pydot2 or pydotplus works, i think those are the most recent things. i haven't looked into this in a while.

@@ -70,27 +70,26 @@ def get_nipype_gitversion():
# Note: this long_description is actually a copy/paste from the top-level
# README.txt, so that it shows up nicely on PyPI. So please remember to edit
# it only in one place and sync it correctly.
long_description = \
"""
long_description = """\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a triple-quoted string should not require a \

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to avoid that newline, but I can remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make the string start right after the quotes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, np. It just looked nicer to me this way. Probably not for others, will change XD

@satra
Copy link
Member

satra commented Oct 3, 2016

@oesteban - should we merge this before or after the command line changes?

@oesteban
Copy link
Contributor Author

oesteban commented Oct 3, 2016

@satra I'd do this before. When the command line can be added as an entry_point, which is a better way of adding console scripts.

@oesteban
Copy link
Contributor Author

oesteban commented Oct 4, 2016

Ok, this is ready. However, please double check that writing the COMMIT_INFO still works. Other than that, I think this is pretty done

@satra
Copy link
Member

satra commented Oct 4, 2016

@oesteban - still has byte/str issues:

on python 3, any stream from popen returns bytes and should be stripped and decoded.

In [2]: nipype.get_info()
Out[2]: 
{'commit_hash': "b'3e7dd7f\\n'",
 'commit_source': 'installation',
 'networkx_version': '1.11',
 'nibabel_version': '2.2.0dev',
 'numpy_version': '1.11.1',
 'pkg_path': '/software/anaconda/envs/dev3pype/lib/python3.5/site-packages/nipype-0.13.0_g3e7dd7f.dev-py3.5.egg/nipype',
 'scipy_version': '0.18.0',
 'sys_executable': '/software/anaconda/envs/dev3pype/bin/python',
 'sys_platform': 'darwin',
 'sys_version': '3.5.2 | packaged by conda-forge | (default, Jul 26 2016, 01:37:38) \n[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)]',
 'traits_version': '4.5.0'}

Copy link
Member

@satra satra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works fine in py2 but not in py3 because bytes are str are equivalent in py2 but different in py3.

shell=True)
repo_commit, _ = proc.communicate()
# Fix for python 3
repo_commit = '{}'.format(repo_commit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use repo_commit.decode() on py3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@oesteban
Copy link
Contributor Author

oesteban commented Oct 4, 2016

@satra - I've been also looking at getting rid of that long list of packages, using find_packages() from setuptools:

psetup = find_packages(exclude=['*.tests'])

print '\n'.join(list(set(packages)-set(psetup)))
nipype.testing.data.tbss_dir
nipype.caching.tests
nipype.interfaces.semtools.brains.tests
nipype.interfaces.semtools.tests
nipype.interfaces.elastix.tests
nipype.interfaces.mrtrix.tests
nipype.workflows.fmri.fsl.tests
nipype.interfaces.dipy.tests
nipype.utils.tests
nipype.interfaces.ants.tests
nipype.interfaces.slicer.legacy.diffusion.tests
nipype.interfaces.vista.tests
nipype.testing.data.bedpostxout
nipype.interfaces.semtools.segmentation.tests
nipype.interfaces.script_templates
nipype.interfaces.semtools.diffusion.tests
nipype.interfaces.diffusion_toolkit.tests
nipype.algorithms.tests
nipype.interfaces.slicer.legacy.tests
nipype.interfaces.slicer.diffusion.tests
nipype.interfaces.nitime.tests
nipype.pipeline.plugins.tests
nipype.workflows.dmri.fsl.tests
nipype.interfaces.slicer.segmentation.tests
nipype.interfaces.freesurfer.tests
nipype.interfaces.camino2trackvis.tests
nipype.interfaces.slicer.quantification.tests
nipype.interfaces.tests
nipype.interfaces.camino.tests
nipype.interfaces.fsl.tests
nipype.interfaces.cmtk.tests
nipype.interfaces.semtools.filtering.tests
nipype.interfaces.spm.tests
nipype.interfaces.mipav.tests
nipype.interfaces.mne.tests
nipype.interfaces.nipy.tests
nipype.interfaces.mrtrix3.tests
nipype.interfaces.semtools.registration.tests
nipype.interfaces.minc.tests
nipype.interfaces.slicer.registration.tests
nipype.interfaces.afni.tests
nipype.interfaces.semtools.diffusion.tractography.tests
nipype.interfaces.semtools.legacy.tests
nipype.pipeline.engine.tests
nipype.testing.data.dicomdir
nipype.testing.data
nipype.interfaces.semtools.utilities.tests
nipype.interfaces.slicer.filtering.tests
nipype.interfaces.slicer.tests
nipype.workflows.fmri.spm.tests

Do we really want to install all those *.tests packages? Then there are other folders that I'm not sure they should be packages as well (nipype.testing.data.tbss_dir, nipype.testing.data.bedpostxout, nipype.testing.data, nipype.testing.data.dicomdir, nipype.interfaces.script_templates, etc.)

@satra satra merged commit dbd53b2 into nipy:master Oct 4, 2016
@satra satra removed the in-progress label Oct 4, 2016
@oesteban oesteban deleted the enh/MigrateToSetuptools branch February 14, 2017 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants