Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Check dependencies at runtime as declared in setup.py. #9638

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

Closed
wants to merge 1 commit into from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Oct 31, 2017

The goal is to list the requirements exactly once in code (in
setupext.py) and once in the docs (in INSTALL.rst).

Instead of manually importing and checking that (python) dependencies
are installed with the correct versions, rely on pkg_resources, which
allows automatically keeping things in sync with setupext, as well as
correctly check e.g. the complex version requirements on pyparsing.

Remove the overly complex way to specify the minimum numpy version.

Add comments reminding to update INSTALL.rst when the requirements are
changed in setupext.py; reorder dependencies in INSTALL.rst in a more
logical order.

Remove unneeded reference to MATLAB being a registered trademark.

Note that if you are running Matplotlib from source by manipulating
PYTHONPATH, then it will not appear to pkg_resources. In this case,
there is no check for other dependencies (you are assumed to be
responsible enough for that). Conversely, Matplotlib will fail to
import if it is installed into site-packages but some dependency (six,
etc.) is only available in PYTHONPATH instead of being correctly
installed. I think this is acceptable (or we could just completely drop
the import checks and let bad installs fail with normal ImportErrors,
like most other packages do...).

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@QuLogic
Copy link
Member

QuLogic commented Oct 31, 2017

I don't know what the effect is here, but the trouble with pkg_resources is that it seems very slow, e.g., pandas may be facing an import problem due to it pandas-dev/pandas#7282.

@anntzer
Copy link
Contributor Author

anntzer commented Oct 31, 2017

Humpf :/
I'll just let people comment on whether we should bother with the import-time check, then (as stated above, I think not).

@dstansby dstansby added this to the v2.2 milestone Oct 31, 2017
The goal is to list the requirements exactly once in code (in
setupext.py) and once in the docs (in INSTALL.rst).

Instead of manually importing and checking that (python) dependencies
are installed with the correct versions, rely on pkg_resources, which
allows automatically keeping things in sync with setupext, as well as
correctly check e.g. the complex version requirements on pyparsing.

Remove the overly complex way to specify the minimum numpy version.

Add comments reminding to update INSTALL.rst when the requirements are
changed in setupext.py; reorder dependencies in INSTALL.rst in a more
logical order.

Remove unneeded reference to MATLAB being a registered trademark.

Note that if you are running Matplotlib from source by manipulating
PYTHONPATH, then it will not appear to pkg_resources.  In this case,
there is no check for other dependencies (you are assumed to be
responsible enough for that).  Conversely, Matplotlib will fail to
import if it is installed into site-packages but some dependency (six,
etc.) is only available in PYTHONPATH instead of being correctly
installed.  I think this is acceptable (or we could just completely drop
the import checks and let bad installs fail with normal ImportErrors).
@anntzer
Copy link
Contributor Author

anntzer commented Jan 18, 2019

Superseded (mostly) by #11980.

@anntzer anntzer closed this Jan 18, 2019
@anntzer anntzer deleted the depcheck branch January 18, 2019 13:34
@story645 story645 removed this from the future releases milestone Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants