Repository navigation
Update dependencies and deprecations to fix Travis builds - #3072
Conversation
|
Hello @hmaarrfk! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on May 18, 2018 at 13:30 Hours UTC |
|
Dream list: I would ideally like the Unfortunately, it isn't really elegant to catch all the docstring warnings with wrappers. I tried to to the following or in hopes that the Unfortunately, the output is: |
Codecov Report
@@ Coverage Diff @@
## master #3072 +/- ##
========================================
Coverage ? 85.9%
========================================
Files ? 336
Lines ? 27301
Branches ? 0
========================================
Hits ? 23454
Misses ? 3847
Partials ? 0
Continue to review full report at Codecov.
|
|
I think this PR should be accepted because it goes a LONG way to making sure the tests PASS. The issues listed below should be kept for "future" improvements and not impede the progress awarded by this PR. Building tests take too longI think about 50% of the build time is taken by travis building the image and getting the setup ready to compile and run the tests. Potential sources of optimization:
|
566c4cc to
cd9fa70
Compare
| env: PIP_FLAGS="--pre" | ||
| env: WITH_PYAMG=1 QT=PyQt4 | ||
| # Examples need strange versions of Matplotlib and Qt | ||
| # I don't think we should be increasing the minimum version requirement |
There was a problem hiding this comment.
@hmaarrfk can you elaborate on this? Given this comment, I'm inclined to increase minimum mpl to 2.0 (over a year old now), and minimum Qt to 5.
There was a problem hiding this comment.
Well, I guess that relates to the philosophy of what scikit-image is. Is it a plotting and visualization guide or an image processing library?
Personally, I don't think that matplotlib should even be a dependency. But I see where things like "viewers" and other things might be useful.
I'm ok with increasing minimum version requirements, but I feel like that is because I am inexperience and haven't had the (mis)forture of dealing with legacy software that cannot be updated.
There was a problem hiding this comment.
I think @efiring is right: it's hard to imagine a situation where you can't update MPL past 1.3 but you can update skimage to 0.14. In my view, conda environments have pretty much solved the update problem, because any user can install up-to-date dependencies in user-space.
More generally, we could have a calendar-based guide: we will support dependency versions up to three years old, for example.
In either view, 1.3 should be updated to either 1.5 or 2.0.
Regarding removing the dependency altogether... Well, now that we are doing separate dependencies for documentation/examples and the library, this is a possibility. But that's a big job, as we would need to extricate the viewer from the library. I think this is a worthwhile goal... For skimage 1.0. For now, let's just bump up the dependency. =D
There was a problem hiding this comment.
1.5 didn't work if i recall. I'll try 2.0. I could setup docker to test. But lets see how many commits it takes me.
| fi | ||
| done | ||
| mv $MPL_DIR/matplotlibrc_backup $MPL_DIR/matplotlibrc | ||
| fi |
There was a problem hiding this comment.
Why did you change back from a script to travis.yml lines?
There was a problem hiding this comment.
They do some some kind of timing per command, but it isn't nearly as helpful.
I'll change it back to the script.
There was a problem hiding this comment.
@hmaarrfk no need to change it back if it's working: this is a super valid reason imho!
There was a problem hiding this comment.
But it doesn't work really. The script one doesn't fold as nicely. I don't know why.
There was a problem hiding this comment.
Well, another option would be to use the time command in front of stuff that you want to time, inside the .sh. (together with a bunch of echos to find your way around the timing printouts.
There was a problem hiding this comment.
We have this in a script because editing it is much less painful than updating a YAML list of commands.
There was a problem hiding this comment.
@stefanv yes editing the YAML was painful. I changed it back.
| def test_imread_flatten(): | ||
| # a color image is flattened | ||
| img = imread(os.path.join(data_dir, 'color.png'), flatten=True) | ||
| img = imread(os.path.join(data_dir, 'color.png'), as_gray=True) |
There was a problem hiding this comment.
If I'm not mistaken, this test should remain until flatten is removed, but with expected_warnings.
There was a problem hiding this comment.
Ok, I added this test:
def test_img_as_grey_flatten():
img = imread(os.path.join(data_dir, 'color.png'), as_gray=True)
with expected_warnings(['deprecated']):
img_flat = imread(os.path.join(data_dir, 'color.png'), flatten=True)
assert_array_equal(img, img_flat)| [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], | ||
| [0, 0, 0, 0, 0, 0, 0, 1, 1, 1]], dtype=np.bool_) | ||
| observed = remove_small_holes(labeled_holes_image, area_threshold=3) | ||
| with expected_warnings(['Any labeled images will be returned as a boolean array.']): # noqa |
There was a problem hiding this comment.
You don't need the full string here.
There was a problem hiding this comment.
Was still learning to use expected_warnings.
There was a problem hiding this comment.
Sure! But please update so that it's PEP8 friendly and the noqa is unnecessary. =)
There was a problem hiding this comment.
I guess I had the same line in two locations. Thanks for spotting this one.
| with warnings.catch_warnings(): | ||
| # UserWarning for possible precision loss, expected | ||
| warnings.simplefilter('ignore', UserWarning) | ||
| result = skeletonize_3d(image) |
There was a problem hiding this comment.
Why not use expected_warnings here also?
There was a problem hiding this comment.
You know, I really don't know why.
I guess for that file I copy pasted the warning statement from an other function that ignored warnings that way.
Fixed.
| out = restoration.denoise_bilateral(img, multichannel=False) | ||
| with warnings.catch_warnings(): | ||
| warnings.simplefilter("ignore") | ||
| out = restoration.denoise_bilateral(img, multichannel=False) |
There was a problem hiding this comment.
Here also, why not expected_warnings?
There was a problem hiding this comment.
I'm pretty sure for that one, it gives a warning on 3.X and not on 2.7. Probably because of a divide by 0 or Nan rule.
There was a problem hiding this comment.
@hmaarrfk see the documentation of expected_warnings for how to make a warning optional. IIRC it's expected_warnings(['warning text that may or may not happen|\A\Z']).
| assert data.shape == labels.shape | ||
|
|
||
|
|
||
| @pytest.mark.skip(reason="This test keeps failing on my computer") |
There was a problem hiding this comment.
But does this fail on Travis? Isn't this the test that was fixed by https://github.com/scikit-image/scikit-image/pull/3063/files ? Are you sure you are on the latest version of master?
There was a problem hiding this comment.
Sorry, I was between flights, my internet access was slow. good catch. that comment was there for you to find =D
| assert_almost_equal(sld.val, 2.5, 2) | ||
|
|
||
|
|
||
| @testing.skipif(True, reason="Don't know how to automate skipping.") |
There was a problem hiding this comment.
Can you elaborate on this? LOL I don't understand why the previous skipif was insufficient?
There was a problem hiding this comment.
This is issue #3081
The previous timer would close the QT window after 100 ms. But it doesn't seem to be working on my computer. Testing on travis is slow. I'll keep this on my todo after addressing your other comments.
There was a problem hiding this comment.
ping. ;) If you can't figure this out quickly, then write a better error message, something like "see issue #3081" ;)
| echo "backend : Template" > $MPL_DIR/matplotlibrc | ||
| fi | ||
| # Now configure Matplotlib to use Qt4 | ||
| if [[ "${QT}" == "PyQt4" ]]; then |
There was a problem hiding this comment.
I vote for deprecating Qt4 altogether
There was a problem hiding this comment.
Actually deprecating is the wrong word. Removing. Nuking. Obliterating. =P
There was a problem hiding this comment.
Yeah probably best. I just didn't want to impose things you know.
There was a problem hiding this comment.
Absolutely. For giant changes like this one, sometimes you can ask the mailing list or on the PR directly about what to do. It sometimes helps to avoid unnecessary work. But you have pushed things along very quickly by just forging ahead, so I very much appreciate that! =)
There was a problem hiding this comment.
Why not use one of the compatibility interfaces, as suggested in the relevant issue? Not important for this PR, though, I'm fine with any working approach for now.
There was a problem hiding this comment.
Do you mean use something like qtpy?
There was a problem hiding this comment.
One data point on this is that riverbank have pulled all the pyqt4 files from pypi (https://pypi.org/project/PyQt4/).
There was a problem hiding this comment.
I was wondering what happened. Can PyQt5 be used with 2.7?
There was a problem hiding this comment.
@tacaswell , it seems that conda shipped pyqt5.6 for 2.7 but not pyqt5.9.
Seeing as 0.14 is the last release to officially support 2.7, I think we are good :D.
There was a problem hiding this comment.
If Riverbank pulled 4, then 5-only seems very reasonable.
|
@hmaarrfk thanks for a gargantuan effort! When these commits first started coming in, I was wondering whether a lot of the work was even necessary. Having read through the changes, I think almost all of them are needed. Regarding NumPy printing: are you sure you are not on an outdated master? That should have been fixed in #2935 and #2975. I've made a few comments to address. To finish your task, this comment will probably be very useful. How good is your git-fu? There are many changes here, which ideally would be grouped together logically and organised into a nice commit history:
However I'm happy to squash if that becomes too hard. But you should rebase on the latest master, for sure. Where are you based? Getting this in is a high priority and I would like to work with you to get it merged. It might be easier if we chat over gitter. My timezone is Melbourne, Australia. Thanks again! |
|
Writing it here so I don't forget. What do you want "novice" to do when you resize an image. |
|
@hmaarrfk was that last question a note to self or a question for me? At any rate |
| - python setup.py develop | ||
| - section_end build | ||
| # Matplotlib settings - do not show figures during doc examples | ||
| # Where is the matplotlib home on a mac? |
| after_success: | ||
| - codecov | ||
| # Prepare.release | ||
| - doc/release/contribs.py HEAD~10 |
There was a problem hiding this comment.
Was in the script
scikit-image/tools/travis/script.sh
Line 121 in 51f598a
| """Convert an image array to a new color space. | ||
|
|
||
| Valid color spaces include: | ||
| 'RGB', 'HSV', 'RGB CIE', 'XYZ', 'YUV', 'YIQ', 'YPbPr', 'YCbCr', 'YDbDr' |
There was a problem hiding this comment.
include -> are
wrap this line to 80 chars since we aren't in a specially-formatted section now
| img = imread(os.path.join(data_dir, 'color.png'), as_gray=True) | ||
| with expected_warnings(['deprecated']): | ||
| img_flat = imread(os.path.join(data_dir, 'color.png'), flatten=True) | ||
| assert_array_equal(img, img_flat) |
There was a problem hiding this comment.
very nice! Although rename as_grey_flatten to as_gray_flatten. ;)
| out = restoration.denoise_bilateral(img, multichannel=False) | ||
|
|
||
| # TODO: This warning is not optional in python3. This should be | ||
| # made a strict warning when we get to 0.15 |
|
|
||
|
|
||
| @skipif(sys.version_info[:2] == (3, 4), | ||
| reason="Doesn't with python 3.4. See issue #3079") |
jni
left a comment
There was a problem hiding this comment.
I've added a few more comments, but this is looking very close to mergeable!
|
Thanks! This was a long one, but I really wanted tests to start passing with examples on OSX. I hacked the install of |
|
Fascinating! Just saw that commit, works for me. Probably the right way is to have another requirements: examples.txt, and docs.txt is just sphinx, numpydoc, and sphinx-gallery and implies examples.txt. But we can leave that till another PR. Don't forget to push your latest changes... ;) Maybe you're waiting for the present build to finish, which is fine. =) |
|
Yeah was waiting for the results of OSX. |
| * In ``skimage.transform.resize`` change default argument from | ||
| ``anti_aliasing=None`` to ``anti_aliasing=True``. | ||
| * In ``skimage/restoration/tests/test_denoise.py``, there is an optional | ||
| warning that needs to be made manditory when we move on from python 2.7 |
| echo "backend : Template" > $MPL_DIR/matplotlibrc | ||
| fi | ||
| # Now configure Matplotlib to use Qt4 | ||
| if [[ "${QT}" == "PyQt4" ]]; then |
There was a problem hiding this comment.
Why not use one of the compatibility interfaces, as suggested in the relevant issue? Not important for this PR, though, I'm fine with any working approach for now.
| - os: linux | ||
| python: 2.7 | ||
| env: PIP_FLAGS="--pre" | ||
| env: WITH_PYAMG=1 QT=PyQt4 |
There was a problem hiding this comment.
Just checking: is the pre flag preserved elsewhere?
There was a problem hiding this comment.
I'll add a 2.7 and 3.6 build that use pre. The only reference to PIP_FLAGS I found was in the before_install.sh is that correct?
| python: 3.5 | ||
| - os: linux | ||
| python: 3.5 | ||
| env: PIP_FLAGS="--pre" |
There was a problem hiding this comment.
Yeah, I didn't understand why were were testing for --pre.
I was mostly trimming builds to test quickly.
For now, I also added it to 2.7
| numpy>=1.11 | ||
| scipy>=0.17.0 | ||
| matplotlib>=1.3.1 | ||
| matplotlib>=2.0.0 |
There was a problem hiding this comment.
🎉 I strongly approve of this change!
|
@stefanv @jni I want to bring to your attention that in the proposed version, Qt and all optional dependencies are installed before any tests are run (with the exception of the doc dependencies, but now that I think those should also be moved to the install section). The old strategy of
has been removed in favour of: Just ask travis for two builds. |
|
FYI, appveyor file states the following: Therefore do we still need |
|
The Just for example, statsmodels didn't have a |
|
@matthew-brett Thanks for the explination. Ok, I don't understand what is happening with Appveyor. |
|
Thank you @hmaarrfk! Not having a working Travis is very disruptive to development. |
|
@stefanv yes, it was, I never knew what was actually failing. Taught alot about how to use pytest in the meantime 🍡 |


Description
Travis now passes!
I'm no git fu master, so maybe just a squash merge is OK?
Relevant changes are:
pytest -vdo not issue warnings (on 3.6) (Doctests still issue warnings, i think that is ok)installsection of travis--prebuilds for 2.7 and 3.6Things that were passed off to future issues:
test_wrap_aroundsometimes fails on python 3.4 #3079sphinx-gallery#3084Checklist
[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]
./doc/examples(new features only)[For detailed information on these and other aspects see scikit-image contribution guidelines]
For reviewers
(Don't remove the checklist below.)
later.
__init__.py.doc/release/release_dev.rst.