Makes entry_points specified in setup.py load more quickly
Using entry_points in your setup.py makes scripts that start really slowly because it imports pkg_resources, which is a horrible thing to do if you want your trivial script to execute more or less instantly. check it out: https://github.com/pypa/setuptools/issues/510
importing fastentrypoints in your setup.py file produces scripts that look like this:
import sys from package.module import entry_function sys.exit(entry_function())
This is faster than whatever the heck the normal console scripts do.
This bug in setuptools only affects packages built with the normal setup.py method. Building wheels avoids the problem and has many other benefits as well. fastentrypoints simply ensures that your user scripts will not automatically import pkg_resources, no matter how they are built.
To use fastentrypoints, simply copy fastentrypoints.py into your project folder in the same directory as setup.py, and import fastentrypoints in your setup.py file. This monkey-patches setuptools.command.easy_install.ScriptWriter.get_args() in the background, which, in turn, produces wonderfully simple entry scripts (like the one above) when you install the package.
If you install fastentrypoints as a module, you have the fastep executable, which will copy fastentrypoints.py into the working directory (or into a list of directories you give it as arguments) and append include fastentrypoints.py to the MANIFEST.in file, and add an import statement to setup.py. It is available from PyPI.
You can’t really make it a proper dependency because setuptools has to import it to work, so chicken-egg. right? Luckily, the script is trivial and will not hurt you project much to copy this 60-line file into the folder. Be sure to add it to MANIFEST.ini if you want to distributie it on PyPI.
Let me know if there are places where this doesn’t work well. I’ve mostly tested it with console_scripts so far, since I don’t write the other thing.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size fastentrypoints-0.5-py3-none-any.whl (6.0 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size fastentrypoints-0.5.tar.gz (3.3 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for fastentrypoints-0.5-py3-none-any.whl