pax_global_header00006660000000000000000000000064135162753670014531gustar00rootroot0000000000000052 comment=b5b662ed04fd7d09fc0d67a2d8522aeb9f57c15e fastentrypoints-0.12/000077500000000000000000000000001351627536700147275ustar00rootroot00000000000000fastentrypoints-0.12/PKG-INFO000066400000000000000000000066551351627536700160400ustar00rootroot00000000000000Metadata-Version: 1.0 Name: fastentrypoints Version: 0.12 Summary: Makes entry_points specified in setup.py load more quickly Home-page: https://github.com/ninjaaron/fast-entry_points Author: Aaron Christianson Author-email: ninjaaron@gmail.com License: BSD Description: Fast entry_points ================= 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: .. code:: python # -*- coding: utf-8 -*- import re import sys from package.module import entry_function if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(entry_function()) This is ripped directly from the way wheels do it and is faster than whatever the heck the normal console scripts do. Note: 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. Usage ----- 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 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. Alternatively, if you don't want to vendor the code, it is possible to install it from pypi with easy_install in the setup script: .. code:: python try: import fastentrypoints except ImportError: from setuptools.command import easy_install import pkg_resources easy_install.main(['fastentrypoints']) pkg_resources.require('fastentrypoints') import fastentrypoint 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. Platform: UNKNOWN fastentrypoints-0.12/README.rst000066400000000000000000000051231351627536700164170ustar00rootroot00000000000000Fast entry_points ================= 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: .. code:: python # -*- coding: utf-8 -*- import re import sys from package.module import entry_function if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(entry_function()) This is ripped directly from the way wheels do it and is faster than whatever the heck the normal console scripts do. Note: 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. Usage ----- 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 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. Alternatively, if you don't want to vendor the code, it is possible to install it from pypi with easy_install in the setup script: .. code:: python try: import fastentrypoints except ImportError: from setuptools.command import easy_install import pkg_resources easy_install.main(['fastentrypoints']) pkg_resources.require('fastentrypoints') import fastentrypoint 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. fastentrypoints-0.12/fastentrypoints.egg-info/000077500000000000000000000000001351627536700216755ustar00rootroot00000000000000fastentrypoints-0.12/fastentrypoints.egg-info/PKG-INFO000066400000000000000000000066551351627536700230060ustar00rootroot00000000000000Metadata-Version: 1.0 Name: fastentrypoints Version: 0.12 Summary: Makes entry_points specified in setup.py load more quickly Home-page: https://github.com/ninjaaron/fast-entry_points Author: Aaron Christianson Author-email: ninjaaron@gmail.com License: BSD Description: Fast entry_points ================= 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: .. code:: python # -*- coding: utf-8 -*- import re import sys from package.module import entry_function if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(entry_function()) This is ripped directly from the way wheels do it and is faster than whatever the heck the normal console scripts do. Note: 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. Usage ----- 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 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. Alternatively, if you don't want to vendor the code, it is possible to install it from pypi with easy_install in the setup script: .. code:: python try: import fastentrypoints except ImportError: from setuptools.command import easy_install import pkg_resources easy_install.main(['fastentrypoints']) pkg_resources.require('fastentrypoints') import fastentrypoint 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. Platform: UNKNOWN fastentrypoints-0.12/fastentrypoints.egg-info/SOURCES.txt000066400000000000000000000003541351627536700235630ustar00rootroot00000000000000README.rst fastentrypoints.py setup.py fastentrypoints.egg-info/PKG-INFO fastentrypoints.egg-info/SOURCES.txt fastentrypoints.egg-info/dependency_links.txt fastentrypoints.egg-info/entry_points.txt fastentrypoints.egg-info/top_level.txtfastentrypoints-0.12/fastentrypoints.egg-info/dependency_links.txt000066400000000000000000000000011351627536700257430ustar00rootroot00000000000000 fastentrypoints-0.12/fastentrypoints.egg-info/entry_points.txt000066400000000000000000000000611351627536700251700ustar00rootroot00000000000000[console_scripts] fastep = fastentrypoints:main fastentrypoints-0.12/fastentrypoints.egg-info/top_level.txt000066400000000000000000000000201351627536700244170ustar00rootroot00000000000000fastentrypoints fastentrypoints-0.12/fastentrypoints.py000066400000000000000000000077121351627536700205640ustar00rootroot00000000000000# noqa: D300,D400 # Copyright (c) 2016, Aaron Christianson # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' Monkey patch setuptools to write faster console_scripts with this format: import sys from mymodule import entry_function sys.exit(entry_function()) This is better. (c) 2016, Aaron Christianson http://github.com/ninjaaron/fast-entry_points ''' from setuptools.command import easy_install import re TEMPLATE = '''\ # -*- coding: utf-8 -*- # EASY-INSTALL-ENTRY-SCRIPT: '{3}','{4}','{5}' __requires__ = '{3}' import re import sys from {0} import {1} if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit({2}())''' @classmethod def get_args(cls, dist, header=None): # noqa: D205,D400 """ Yield write_script() argument tuples for a distribution's console_scripts and gui_scripts entry points. """ if header is None: # pylint: disable=E1101 header = cls.get_header() spec = str(dist.as_requirement()) for type_ in 'console', 'gui': group = type_ + '_scripts' for name, ep in dist.get_entry_map(group).items(): # ensure_safe_name if re.search(r'[\\/]', name): raise ValueError("Path separators not allowed in script names") script_text = TEMPLATE.format( ep.module_name, ep.attrs[0], '.'.join(ep.attrs), spec, group, name) # pylint: disable=E1101 args = cls._get_script_args(type_, name, header, script_text) for res in args: yield res # pylint: disable=E1101 easy_install.ScriptWriter.get_args = get_args def main(): import os import re import shutil import sys dests = sys.argv[1:] or ['.'] filename = re.sub('\.pyc$', '.py', __file__) for dst in dests: shutil.copy(filename, dst) manifest_path = os.path.join(dst, 'MANIFEST.in') setup_path = os.path.join(dst, 'setup.py') # Insert the include statement to MANIFEST.in if not present with open(manifest_path, 'a+') as manifest: manifest.seek(0) manifest_content = manifest.read() if 'include fastentrypoints.py' not in manifest_content: manifest.write(('\n' if manifest_content else '') + 'include fastentrypoints.py') # Insert the import statement to setup.py if not present with open(setup_path, 'a+') as setup: setup.seek(0) setup_content = setup.read() if 'import fastentrypoints' not in setup_content: setup.seek(0) setup.truncate() setup.write('import fastentrypoints\n' + setup_content) fastentrypoints-0.12/setup.cfg000066400000000000000000000000461351627536700165500ustar00rootroot00000000000000[egg_info] tag_build = tag_date = 0 fastentrypoints-0.12/setup.py000066400000000000000000000007551351627536700164500ustar00rootroot00000000000000from setuptools import setup import fastentrypoints setup( name='fastentrypoints', version='0.12', py_modules=['fastentrypoints'], description='Makes entry_points specified in setup.py load more quickly', long_description=open('README.rst').read(), url='https://github.com/ninjaaron/fast-entry_points', author='Aaron Christianson', author_email='ninjaaron@gmail.com', license='BSD', entry_points={'console_scripts': ['fastep=fastentrypoints:main']}, )