-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Do not require on pkg_resources as it drastically increases import time. #5676
Comments
Looks like it is still required to retrieve the version number at runtime for python versions < 3.8, unless we agree to temporarily depend on the importlib_metada backport.
It is also used for the backend entry-points and for loading a couple of static css/html files for the html reprs. I don't know if there are better approaches for this, though. |
we had a lengthy discussion about a related topic in #4295. Long story short: we will be able to switch to For the backends, we could use the separate For reference, NEP29 allows dropping support for |
Fixes pydata#5676 Now depends on importlib-metadata for Python major version < 3.8
* remove requirement for setuptools.pkg_resources Fixes #5676 Now depends on importlib-metadata for Python major version < 3.8 * doh * doh2 * doh3, no reraise for fallback version number * black formatting * ordering * all this lifetime wasted by fucking linting tools * precommit * remove python 3.7 as min supported version * remove 3.7 from min_deps * Update ci-additional.yaml * test increasing dask * test increasing numba * Update ci-additional.yaml * remove setuptools from CI * undo dask/numba tests * Remove importlib_metadata * remove 3.7 compats * Remove 3.7 compat * remove sys * Update options.py * Update whats-new.rst * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Run flaky/all but dask with latest python version * fix all_but_dask file as well * Update dataarray.py * Update dataarray.py * Update doc/whats-new.rst Co-authored-by: keewis <[email protected]> * update the install guide * remove py37 only dependencies * don't install importlib-metadata and typing_extensions into min-deps envs * update the requirements file * add back the optional typing_extensions dependency Co-authored-by: Martin K. Scherer <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: keewis <[email protected]> Co-authored-by: Keewis <[email protected]>
Is your feature request related to a problem? Please describe.
Most of the import time of xarray is wasted by importing pkg_resources. As far as I could see, the module is used to set the version number of xarray. So importing xarray takes like 0.275s (old machine) and of this 0.17s are just spent in importing pkg_resources.
Describe the solution you'd like
There are better approaches to set the version number than to use this heavy weight module. For instance
setuptools_scm
.Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
xarray-version 0.19.0
The text was updated successfully, but these errors were encountered: