Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

entry_points['console_scripts'] are really slow for what they do. #711

Closed
ninjaaron opened this issue Aug 2, 2016 · 2 comments
Closed

Comments

@ninjaaron
Copy link

ninjaaron commented Aug 2, 2016

I write a lot of shell utilities in python that I expect to execute more or less instantly if they are doing something trivial. On my main, albeit underpowered laptop, I can cut about 0.4 seconds off startup time just by putting a script like this in my path instead of using the script generated by entry_points:

import my_module
my_module.my_entry_function()

In many cases, that 0.4 seconds added by entry_points is longer than the execution time of the entire script without it. I'm not sure what entry_points does, but the speed might be improved by doing less! I'm sure whatever entry_points does, it does for a reason, but would it be possible to add a simpler, faster way to execute scripts as an alternative similar (or not) to the above? I've never peeked under the hood of setuptools, but I'd be happy to work on a patch if I thought it would be accepted.

@jaraco
Copy link
Member

jaraco commented Aug 2, 2016

Just add import pkg_resources to your script and it will be slow too. See #510.

@jaraco jaraco closed this as completed Aug 2, 2016
@ninjaaron
Copy link
Author

Oh. Great news.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants