Skip to content
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

Test against oldest version of matploltib, numpy and scipy #2485

Merged
merged 4 commits into from Aug 22, 2020

Conversation

ericpre
Copy link
Member

@ericpre ericpre commented Aug 16, 2020

Progress of the PR

  • add a build to travis to check the oldest supported version of matplotlib, numpy and scipy,
  • ready for review.

There are binaries incompatibilities issues for old version of numpy and the imagecodecs wheels on linux, which make me think we should possibly make imagecodecs an optional dependencies - at the moment imagecodecs is installed through tifffile[all]. This should not be an issue for more recent version and therefore it should be a fairly niche issue.

@codecov
Copy link

codecov bot commented Aug 16, 2020

Codecov Report

Merging #2485 into RELEASE_next_patch will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           RELEASE_next_patch    #2485   +/-   ##
===================================================
  Coverage               74.77%   74.77%           
===================================================
  Files                     201      201           
  Lines                   29690    29690           
  Branches                 6472     6472           
===================================================
  Hits                    22200    22200           
  Misses                   5671     5671           
  Partials                 1819     1819           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7119bcb...4538ba8. Read the comment docs.

@tjof2
Copy link
Contributor

tjof2 commented Aug 17, 2020

Is it worth documenting somewhere the rationale behind the different test environments? e.g. that Travis is pip, Azure is conda, 3.6 through to 3.8 is tested, codecov bot only runs if the 3.7 Linux Travis test passes, this "oldest version" test...

@thomasaarholt
Copy link
Contributor

@ericpre, this is a very good idea!
@tjof2 I'd like that! I just learnt now that Travis is testing pip! (how come it isn't in the azure suite? Just because it was already in Travis?)

@ericpre
Copy link
Member Author

ericpre commented Aug 17, 2020

There is already quite a bit in the dev guide on this topic: https://hyperspy.readthedocs.io/en/latest/dev_guide/testing.html#continuous-integration-ci

If we are happy with the approach, I will update the dev guide regarding this "oldest supported version" build.

@tjof2
Copy link
Contributor

tjof2 commented Aug 18, 2020

The docs are good @ericpre but there's no rationale or explanation for e.g.

  • Python 3.7 on Travis being the only place we test the minimum requirements for installation (no sklearn etc)
  • how/why that test is different to the one you propose here in this PR
  • codecov bot only works if the Python 3.7 Travis test passes. If it fails but all the others pass, there's no coverage report generated
  • docs build is also done by readthedocs now

@tjof2
Copy link
Contributor

tjof2 commented Aug 22, 2020

Let's tackle the docs separately, I'll take a look this week.

@tjof2 tjof2 merged commit 371af7d into hyperspy:RELEASE_next_patch Aug 22, 2020
@tjof2 tjof2 mentioned this pull request Aug 24, 2020
5 tasks
ericpre added a commit that referenced this pull request Aug 24, 2020
@ericpre ericpre deleted the test_minimum_version branch August 30, 2020 17:09
@ericpre ericpre added this to the v1.6.1 milestone Aug 30, 2020
@ericpre ericpre mentioned this pull request Aug 30, 2020
6 tasks
TomSlater added a commit to TomSlater/hyperspy that referenced this pull request Sep 22, 2020
* Tidy docs to close hyperspy#1624

* Update changes

* More informative error, thanks @tjof2

* Skip test when sklearn not installed

* ml-poisson -> ML-poisson

* Update README for upcoming hyperspy#2467

* Fix label by moving it

* Remove duplication, fix label

* Rename 'z' to 'v' in autoscale.

* Add deprecation warning for saturated_pixels and remove it from documentation.

* Add description autoscale in user guide.

* Check value passed to autoscale is valid and add test.

* Fix user guide.

* Fix random states

as suggested by @tjof2 in hyperspy/hyperspy_gui_ipywidgets#28 (comment)

* Fix random state #2

* Fix random state #3

* Fix return peaks in find_peaks().

* Add test checking for the returned peaks is updated.

* Raise error when using arpack and scipy <1.2.

* Update scipy version

* Use pytest.importorskip as suggested by @tjof2.

* Split up test_tools.py

Tidy up Fourier transform and Hologram tests

Remove parallel from hologram tests since this is just passed straight to .map() anyway, which is tested elsewhere, and there is a risk of poor performance when parallel testing on CI VMs such as Travis/Azure

Bugfix

* Remove unnecessary duplication of None from test_cluster

No need to test MiniBatchKMeans - otherwise we just test external sklearn functionality

algorithm=None is just an alias for algorithm=kmeans which is already tested elsewhere in this file, so no need to loop over None AND kmeans

* Update DOI

* Fix changelog

* Back to dev

* Update version

* Add pragma: no cover and pragma: no branch to some obvious code branches that are never hit in testing

Replace warning with ValueError since the code immediately fails after the warning anyway

Speed up cluster tests by 3x

Speed up BSS tests

Speed up hologram tests

Speed up EDS model tests

Replace assert np.allclose with np.testing.assert_allclose

Tidy up np.testing.assert_allclose inconsistencies

Further consistency nt.assert.* to np.testing.assert.*

* Revert change to sklearn import

* Tidier check for sklearn

* Simpler file skip for USID and MRCZ tests

* Change elements from np.array to list, closes hyperspy#2429

* Replace rng.random by rng.random_sample

* Update test_hdf5.py

* Testing bins=int/array cases for hist

* Accomodate bins as int/array for hist, see hyperspy#2475

* Explicitely set metadata=None when exporting scale to fix failure with latest tifffile (2020.8.13).

* Add tests.

* Fix failure and simplify test.

* Add a build to travis to test with minimum version of a few libraries.

* Use a numba version compatible with numpy.

* Use numba 0.46 and old imagecodecs to work around libraries incompatibility.

* Increase numpy requirement to 1.15 because it will be difficult to get a working setup with older numpy (issues with numba).

* Remove signal_type='image' for velox emd and phenom

* thanks @tjof2

* Rename hdf5->hspy

* Fix bug closes hyperspy#2089, rebased to RELEASE_next_patch

* Add errors for missing metadata and tests for them

* Use the nightly merge action (https://github.com/marketplace/actions/nightly-merge) to merge RnP into RnM.

* Add github action

* Add the 3 different python versions.

* Use manylinux docker (prepare for manylinux wheel).

* Use auditwheel.

* Build on tag.

* check container

* Use RalfG/python-wheels-manylinux-build action.

* Create release on tag and prepare upload to pypi and to Github release.

* Rename build workflow file to release.

* Remove cython since it is already in pyproject.toml.

* Set upload to pypi from Github CI. Followed instructions at https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows

* Install and test distribution before upload to pypi.

* Specify 'language_level' to avoid cython FutureWarning.

* Don't try to upload to pypi when running on tag and from fork.

* Add comments and cleanup upload to github release, which is not necessary.

* Overhaul mpfit as implemented in HyperSpy to make it much cleaner and easier to maintain

Delete mpfitexpr.py as it is (a) unused and (b) contains a potentially unsafe eval()

Explicit test for iterations, success and errors in mpfit

* Support OptimizeResult return in m.fit()

* Small extension to hyperspy#2482

* Remove physical_constants.py and use scipy.constants instead

Add simple tests for uncovered file

Add pragma: no cover to branch never hit in CI

* missed a signal_type='image' being set

* Update dev-guide following hyperspy#2485

* Add nightly merge RnM into non_uniform_axes to run one hour after nightly merge RnP into RnM.

* move DOI to badges section and replace with latest DOI

* Add concept DOI to UG

* Fix typo

* Remove leftover, thanks @ericpre

* Add link to zenodo doi help, thanks @ericpre

* Take into account all lines on figure when setting y limits. Avoid redundant connection to `axes_manager.indices_changed`.

* Avoid flickering when plotting model.

* Display the remainder line on the right axis instead of being crop.

* Fix typo, thanks @tjof2.

* Add checks on axis calibrations, closes hyperspy#1570

Tidy-up broadcast_signals function

Tidy-up stack function

Add tests

* Fix broken test

* Move file

* Remove parallel argument from .as_signal, closes hyperspy#1604 and hyperspy#2443

* Fix warning

* Test warning

* Add back deprecation warning

* Test deprecation warning

* Move utils function as per @ericpre suggestion

Separate file

* Fix out_of_range_to_nan argument in model.as_signal.

* Tweak docstring.

* Increase coverage.

* Remove leftover debugging print.

* Fix set_signal_range with i2=None.

* Update baseline images.

* Make imagecodecs optional since it can cause binaries incompatibilities.

* Remove imagecodecs from the "oldest supported versions" build.

* Use pip resolver (as suggested by pip) and increase numpy requirement to 1.15.4 since a few dependencies have this requirement or similar.

* Update user guide.

* Add lowess function to remove statsmodels dependency. The function is taken from https://gist.github.com/agramfort/850437 by Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>.

* use numpy function

* @tjof2 fix (hyperspy#2510).

* Use numba to speed up the lowess function, which is now faster than the version using statsmodel.

* Bound smoothing_parameter in SmoothingLowess to avoid computation error when using GUI.

* Remove reference to googlegroup

Removes reference to google group based on the discussion at:
hyperspy#2252

* Add note about watching hspy on github to install

* Update install.rst

* Add link to rolling release linux dists

* Fix setup.py for missing .hspy extension; remove a few duplicates from package_data

* Fix setup.py for missing .hspy extension; remove a few duplicates from package_data

* Update link as AUR package is renamed

* fix: Live time change when summing along signal dimension

* Fix calculation and get tests to pass.

* Add test for the live_time when summing over signal_axis.

* change file loading mode for example signals

* PEP8 fixes

* Keep EDAX test data in cache to avoid downloading.

* Add "hyperspy/tests/io/edax_files.zip" to ignore file.

* Fix bug introduced in previous commit.

* Tidy up tiff reader

* Add support for multipage tiff which are not series. Read metadata and scale for Olympus SIS file.

* Mention Olympus SIS software in the user guide.

* Update AUR information in install instructions

* Prepare repo for pytest-xdist

Add pragma no cover to a few ImportError branches

Add tests for tv_denoise.py

Fix sklearn import in 2D peak-finding

Split test_hologram_image for cleaner parallel testing

Improve arraytools coverage

Replace jit with njit everywhere, and add pragma no cover since coverage can't measure jitted functions

Catch error calling canvas.restore_region() if self._background is None

Missed error message in try/except block

Update docstring

Fix differences depending on OS by setting explicit float64 and int32

Remove parallel mark from pytest (unclear what purpose it serves) and set conftest to use parallel=False by default

Update docs and add comment on why we use -n 2 for Travis/Azure

* Use togglebutton to hide prompt

* Add max 3 reruns for failed tests using pytest-rerunfailures as extra dependency

* Move -n auto --load distfile to setup.cfg

Update dev guide

* See if .travis.yml can override setup.cfg with n arg

* Update docs and add instafail

* Add comment thanks @ericpre

* Typo

* Allow loading of emi file with no Acquire date and add test to cover

* Ensure that .emi contains enough metadata for each .ser file before attempting
to read it

* Make emi metadata type coercion more defensive; add test to cover new lines

* Add test for olympus SIS tiff file.

* Skip test when imagecodecs is not installed.

* Update TIFF dtype documentation to close hyperspy#593

* Add ValueError and test to guard against hyperspy#2320

* Add docstring warning

* Add function_nd to ScalableFixedPattern component.

* Add test for SEE component.

* Fix SEE component and remove sigma parameter which was broken. Convert SEE component to expression.

* Add test for PESCoreLineShape.

* Add function_nd to PESCoreLineShape.

* Test that all components can re-created with export/import load cycle.

* Fix tests to increase coverage.

* Comments from @ericpre

* Missed import on windows

* Explicitly use gradient to increase test coverage.

* Add interpolate to _whitelist to fix re-creation of ScalableFixedPattern component. Set free=False when interpolation is False to enable the use of gradient.

* Support pathlib everywhere except io_plugins

* Add HDF5 reader plugin for Digital Micrograph to user guide.

* Fix docstring.

* Fix deprecation warning pyusid.

* Add badges Anaconda and download pypi to README.rst

* Fix azure pipeline badge.

* Add Monitoring version distribution section to dev guide.

* Remove download badge from README.rst.

* Increase coverage and simplify how the start_energy is determined.

* Fix bug with mask in quantification EDS TEM.

* Increase coverage.

* Fix test now that the `navigation_mask` argument in `quantification` is working!

* Use hs.preferences for progress bar, fixes hyperspy#1842

Co-authored-by: Tom Furnival <tjof2@cam.ac.uk>
Co-authored-by: Francisco de la Peña <francisco.de-la-pena-manchon@univ-lille.fr>
Co-authored-by: Francisco de la Peña <frandelapena@gmail.com>
Co-authored-by: Tom Furnival <6626247+tjof2@users.noreply.github.com>
Co-authored-by: Eric Prestat <eric.prestat@gmail.com>
Co-authored-by: phillip <pc494@cam.ac.uk>
Co-authored-by: Thomas Aarholt <thomasaarholt@gmail.com>
Co-authored-by: GitHub Nightly Merge Action <actions@github.com>
Co-authored-by: jlaehne <jonas@pdi-berlin.de>
Co-authored-by: Joshua Taillon <joshua.taillon@nist.gov>
Co-authored-by: Alexander Skorikov <alexander.skorikov@gmail.com>
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.

None yet

3 participants