Repository navigation
Avoid importing packaging or pkg_resources for version validation - #948
Conversation
|
The concern I have, and the reason for running the validation, is that someone might provide bad data in I wonder if perhaps we should run the validation in |
|
Thanks for taking a look!
Understood.
Is it viable to do it in the test suite? If all modifications to Doing it in the tests seems preferable to me, but I can also do it in setup.py if the tests don't work. |
|
In case you move this check to tests or setup.py, please also remove setuptools from |
|
Yeah, I suppose we could test that the value set in |
a3a332e to
b923df2
Compare
|
I pushed an updated version:
|
Importing the `pkg_resources` module has high memory and startup time cost. A recent change `102e01c2462f20fdd29073bc0b1fe2252b517add` already avoided it for loading extensions, but it's still used for validating __version__ has correct format. It is possible to avoid it by installing the `packaging` package, but that adds a dependency for something quite trivial. Instead, remove the validation and add tests which check the output is as expected. Since `setuptools` is no longer required at runtime, remove it from `install_required`.
b923df2 to
d8ac41a
Compare
|
Looks good. Thank you. I was going to suggest that perhaps we should list
Just recording that here to document it for future reference. |
Importing the
pkg_resourcesmodule has high memory and startup time cost. A recent change 102e01c already avoided it for loading extensions, but it's still used for validating__version__has correct format.It is possible to avoid it by installing the
packagingpackage, but that adds a dependency for something quite trivial.Instead, remove the validation and add tests which check the output is as expected (they pass before and after).