Declare optional dependencies in extras_require#8198
Declare optional dependencies in extras_require#8198astrofrog merged 13 commits intoastropy:masterfrom
Conversation
5436134 to
a6780b5
Compare
405c169 to
6d6af00
Compare
|
For consistency should |
|
@drdavella - I'm not sure yet, because some of the test dependencies are optional, so I don't want to always force people to temporarily install those. Maybe we should have a |
|
Ah, makes sense. Maybe at the very least we can just say that |
|
I was thinking about this when playing with tox, but I'm not sure about the 'all' dependencies bundle, which represents a lot of things. It could make sense to have a finer split, maybe by sub-package, 'io', 'table', 'stats', 'viz' ? I think these can be combined in the pip command. But I don't know where to put scipy... |
in that framework I suppose on package can be specified in several points. at least scipy should go into multiple ones |
That may be an option, but I think if if you specify multiple extra to pip then it will complain about the duplicate dependencies. Something to check. |
|
Then it's a feature request for them to do a |
|
It doesn't actually take long to install |
6d6af00 to
5eb1105
Compare
|
So this now also adds a |
5eb1105 to
de1ca0e
Compare
Codecov Report
@@ Coverage Diff @@
## master #8198 +/- ##
==========================================
- Coverage 86.91% 86.91% -0.01%
==========================================
Files 383 383
Lines 57889 57889
Branches 1056 1056
==========================================
- Hits 50313 50312 -1
- Misses 6962 6963 +1
Partials 614 614
Continue to review full report at Codecov.
|
48e1f94 to
45f918e
Compare
8840061 to
8c88cb9
Compare
There was a problem hiding this comment.
I like this change, but a few suggestions (which I'm not necessarily attached to but they might be good ideas):
- (related to an inline comment) keep the requirements files and just pull them in in the setup script so people can
pip install -r <whatever>but still get all of the goodness here. - Add something about this to the install instructions?
- Make sure this works on RTD. I think @astrofrog did this already (in-person discussion), but just making sure.
Also, later on (doesn't have to be in this PR), we should add something that somehow checks if all the optional dependencies are actually in this list. @astrofrog says there's something already in glue that makes that fairly straightofrward to manage (i.e., a thing we can replace our HAS_SCIPY and similar pytest marks with). But we can add an issue after this is merged about this.
setup.py
Outdated
| extras_require = {} | ||
|
|
||
| # All optional dependencies for the tests | ||
| extras_require['test'] = ['pytest-astropy', 'pytest-xdist', 'pytest-mpl', |
There was a problem hiding this comment.
We could keep the existing requirements files and instead do something like:
| extras_require['test'] = ['pytest-astropy', 'pytest-xdist', 'pytest-mpl', | |
| with open('pip-requrirements-test') as f: | |
| extras_require['test'] = [line for line in f.read().split('\n') if line.strip()!=''] |
?
|
Some in-person discussion re 1 led to: we should not use requirements files because they aren't for dependencies, rather for environments according to the PyPA (thanks @Cadair for pointing that out). But we can still see have a cleaner representation of the requirements by putting them in @pllim pointed out some users are using |
Maybe send out a notice to astropy users mailing list to see if there are any objections? |
a493618 to
00f2f6a
Compare
3c2e6d6 to
2d215f5
Compare
|
I've added mentions of this to the installation docs, and tested that it works on RTD. I've also added a dummy pip-requirements file with instructions for using the new way. |
[ci skip]
|
Since the CI passed before my minor changelog entry change, and this has been approved, I'll go ahead and merge. |
| py:obj NotImplementedError | ||
| py:obj AttributeError | ||
| py:obj NotImplementedError | ||
| py:obj RendererBase |
There was a problem hiding this comment.
I need this change in the release. Should I try to backport the whole PR, or rather just cherry pick this single commit?
|
So, what is the minversion of |
|
I think it's setuptools 30.3. |
This reverts commit 1d9729b. The way `astropy` declared its dependencies was changed in astropy#8198. The migration instructions added by the reverted commit are more than 4 years old by now and it is safe to assume they are not needed anymore.
The way `astropy` declared its dependencies was changed in astropy#8198. The migration instructions added by the deleted file are more than 4 years old by now and it is safe to assume they are not needed anymore.
The way `astropy` declared its dependencies was changed in astropy#8198. The migration instructions added by the deleted file are more than 4 years old by now and it is safe to assume they are not needed anymore.
This does the following:
extras_requireentry insetup.py- with this, users could get all dependencies by runningpip install astropy[all]testentry inextras_require. This would allow all those dependencies to be installed when doingpip install astropy[test]. Note that this is different fromtests_requirewhich is the one actually used to temporarily install the bare minimum testing dependencies when running tests.docsentry - and RTD can recognize thisAt the moment, this has a small performance impact on Travis - the build I modified took 14 min 37 sec in the last successful run before this PR, and 15 min 58 sec now. I think this is because astropy is built twice, once in the pip install command, and the second time from the
python setup.py testcommand, so I need to look into whether we can avoid this. Part of it could also be because we now run 12638 tests in this build instead of 12123, presumably because not all optional dependencies were included inCONDA_ALL_DEPENDENCIES.As a side goal, I want to see how fast installing dependencies with pip is, as if it is quite fast then we could consider actually using pip to install dependencies in most builds instead of conda, and we could also avoid declaring all dependencies in CI config files (instead relying on the minimal/full configurations available in setup.py - that is, some builds could use the
allextras_require`` and some not).This is an experimental PR that I hope to find time to discuss next week, so do not merge!