setuptools的扩展,通过nuitka运行包以生成编译的、更快的、模糊的二进制模块。

nuitka-setuptools的Python项目详细描述


setuptools的扩展,通过nuitka运行包以生成编译的、更快的、模糊的二进制模块。

nuitka[http://nuitka.net/pages/overview.html]是一个具有完全语言支持和cpython兼容性的python编译器。

It’s fully compatible with Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, and 3.6.

You feed it your Python app, it does a lot of clever things, and spits out an executable or extension module.

此模块提供了一些钩子,可以添加到python packages setup.py中,以自动运行部分/全部代码 在构建二进制dist时通过nuitka。这通常是通过python setup.py bdist戋wheel完成的 创建用于分发的控制盘。

有了nuitka setuptools,这个控制盘就没有纯python了,只包含编译后的代码,不仅速度更快 (引用:nuitka的速度是cpython的2倍以上)但是代码安全性相对较高。

基本用法:setup.py:

import sys
from setuptools import setup

# Get the long description from the README file
with open(path.join(path.dirname(__file__), 'README.rst'), 'r') as f:
    long_description = f.read()

packages = ['mod', 'pkg']

if any('bdist' in arg for arg in sys.argv):
    from nuitka_setuptools import Nuitka, Compile

    build_settings = dict(
        # Compile module
        cmdclass={'build_ext': Nuitka},
        ext_modules=Compile(packages),
    )
else:
    build_settings = {}


setup(
    name='nuitka_setuptools',
    py_modules=['nuitka_setuptools'],
    description='Extension to setuptools to run your package through nuitka to '
                'produce compiled, faster, obfuscated binary modules.',
    long_description=long_description,
    author='Andrew Leech',
    author_email='andrew@alelec.net',
    url='https://gitlab.com/alelec/nuitka-setuptools',
    use_scm_version=True,
    include_package_data=True,
    install_requires=['setuptools_scm'],
    setup_requires=['setuptools_scm'],
    cmdclass={'build_ext': Nuitka},
    ext_modules=Compile(['nuitka_setuptools']),
    **build_settings
)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用jackson序列化/反序列化具有不同属性的子属性   javascript驱动程序。getTitle()从错误页面获取数据   java web应用程序的增量部署   java字符引用“&#x10”是无效的XML字符   java MyEclipse+Hibernate不按ID排序属性集?   找不到IBM Filenet P8更改预处理器Java实现   java比较器,用于按浮点参数对对象arraylist排序   java如何调试。来自eclipse或其他版本的bsh文件   不允许使用java rest api post方法   java如何在Servlet中打开弹出窗口,然后重定向页面   java的replaceAll方法对我不起作用我做错了什么?   我收到了javax。网ssl。SSLHandshakeException:握手期间远程主机关闭连接