def main() -> None: setup( name='math_mypyc', version='1.0.0', packages=['math_mypyc'], ext_modules=mypycify([ 'math_mypyc/__init__.py', ]), )
def build(setup_kwargs): modules = list( filter( lambda path: path.replace("\\", "/") not in ( "baize/asgi.py", "baize/wsgi.py", # because compile delete_cookies is not supported in python 3.6-3.8 # and I don't know how to fix it "baize/responses.py" if sys.version_info[:2] < (3, 9) else "", ), map(str, Path("baize").glob("**/*.py")), )) setup_kwargs.update({ "ext_modules": mypycify(["--ignore-missing-imports", *modules]), })
# This bit is super unfortunate: we want to use the mypy packaged # with mypyc. It will arrange for the path to be setup so it can # find it, but we've already imported parts, so we remove the # modules that we've imported already, which will let the right # versions be imported by mypyc. del sys.modules['mypy'] del sys.modules['mypy.version'] del sys.modules['mypy.git'] from mypyc.build import mypycify, MypycifyBuildExt opt_level = os.getenv('MYPYC_OPT_LEVEL', '3') ext_modules = mypycify( mypyc_targets, ['--config-file=mypy_bootstrap.ini'], opt_level=opt_level, # Use multi-file compliation mode on windows because without it # our Appveyor builds run out of memory sometimes. multi_file=sys.platform == 'win32', ) cmdclass['build_ext'] = MypycifyBuildExt description += " (mypyc-compiled version)" else: ext_modules = [] classifiers = [ 'Development Status :: 3 - Alpha', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3',
from distutils.core import setup from mypyc.build import mypycify setup( name='mypyc_output', ext_modules=mypycify(['-m', 'build'], opt_level="3"), )
from mypyc.build import mypycify from setuptools import setup setup(name='mavlink-influxdb', version='1.0', description="Upload MAVLink dataflash logs to InfluxDB", author="Ben Wolsieffer", author_email='*****@*****.**', license='MIT', ext_modules=mypycify(['mavlink_influxdb.py']), entry_points={ 'console_scripts': ['mavlink-influxdb=mavlink_influxdb:main'], }, setup_requires=['mypy'], install_requires=['pymavlink', 'influxdb'])
# This bit is super unfortunate: we want to use a different # mypy/mypyc version, but we've already imported parts, so we # remove the modules that we've imported already, which will # let the right versions be imported by mypyc. del sys.modules['mypy'] del sys.modules['mypy.version'] del sys.modules['mypy.git'] sys.path.insert(0, use_other_mypyc) from mypyc.build import mypycify opt_level = os.getenv('MYPYC_OPT_LEVEL', '3') force_multifile = os.getenv('MYPYC_MULTI_FILE', '') == '1' ext_modules = mypycify( mypyc_targets + ['--config-file=mypy_bootstrap.ini'], opt_level=opt_level, # Use multi-file compilation mode on windows because without it # our Appveyor builds run out of memory sometimes. multi_file=sys.platform == 'win32' or force_multifile, ) else: ext_modules = [] classifiers = [ 'Development Status :: 4 - Beta', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7',
# Breaks the test suite when compiled (and is also useless): "black/debug.py", # Compiled modules can't be run directly and that's a problem here: "black/__main__.py", ] discovered = [] # black-primer and blackd have no good reason to be compiled. discovered.extend(find_python_files(src / "black")) discovered.extend(find_python_files(src / "blib2to3")) mypyc_targets = [ str(p) for p in discovered if p.relative_to(src).as_posix() not in blocklist ] opt_level = os.getenv("MYPYC_OPT_LEVEL", "3") ext_modules = mypycify(mypyc_targets, opt_level=opt_level, verbose=True) else: ext_modules = [] setup( name="tan", use_scm_version={ "write_to": "src/_black_version.py", "write_to_template": 'version = "{version}"\n', }, description="The compromising code formatter.", long_description=get_long_description(), long_description_content_type="text/markdown", keywords="automation formatter yapf autopep8 pyfmt gofmt rustfmt", author="Łukasz Langa", author_email="*****@*****.**",
import mypyc from mypyc.build import mypycify mypycify(['module.py'])
"pre-commit", "pylint", "black", "mypy", ] ext_modules = [] if os.environ.get("MYPYC_COMPILE", False): from mypyc.build import mypycify ext_modules = mypycify( [ "src/flupy/fluent.py", "src/flupy/cli/utils.py", "src/flupy/cli/cli.py", ], opt_level="3", ) setuptools.setup( name=read_package_variable("__project__"), version=read_package_variable("__version__"), description="Method chaining built on generators", url="https://github.com/olirice/flupy", author="Oliver Rice", author_email="*****@*****.**", ext_modules=ext_modules, packages=setuptools.find_packages("src", exclude=("src/tests",)), package_dir={"": "src"}, # include_package_data=True,
from mypyc.build import mypycify from setuptools import setup setup( name='nk-bin', version='0.1', description=" Generate WinCE boot images to run custom code", author="Ben Wolsieffer", author_email='*****@*****.**', license='GPLv3', ext_modules=mypycify(['nk_bin.py', 'patch_nk_bin.py']), entry_points={ 'console_scripts': [ 'nk-bin=nk_bin:main', 'patch-nk-bin=patch_nk_bin:main' ], }, setup_requires=['mypy'], )
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], extras_require={ "mongo": [ "pymongo", ], "mecab": ["MeCab"], }, ext_modules=mypycify([ 'simstring/__init__.py', 'simstring/searcher.py', 'simstring/feature_extractor/base.py', 'simstring/feature_extractor/character_ngram.py', 'simstring/feature_extractor/word_ngram.py', 'simstring/database/base.py', 'simstring/database/dict.py', # 'simstring/database/mongo.py', 'simstring/measure/base.py', 'simstring/measure/overlap.py', 'simstring/measure/cosine.py', 'simstring/measure/dice.py', 'simstring/measure/jaccard.py', ]), )
from setuptools import setup, Extension from Cython.Build import cythonize from mypyc.build import mypycify # Cython ext_modules = cythonize([ Extension('cyfibonacci', ['cyfibonacci.pyx']), ], gdb_debug=True) # mypyc ext_modules += mypycify(['myfibonacci.py']) # C extension ext_modules.append( Extension('fibonacci', ['fibonacci.c'], extra_compile_args=["-g", "-O0"], extra_link_args=["-g"])) setup( name='fibonacci', ext_modules=ext_modules, )
"pytest", "pytest-cov", "pre-commit", "pylint", "black", "mkdocs", ] ext_modules = [] if os.environ.get("MYPYC_COMPILE", False): from mypyc.build import mypycify ext_modules = mypycify( [], opt_level="3", ) setuptools.setup( name=read_package_variable("__project__"), version=read_package_variable("__version__"), description="Postgres Statement Builder/Parser ", url="https://github.com/olirice/pgtonic", author="Oliver Rice", author_email="*****@*****.**", ext_modules=ext_modules, packages=setuptools.find_packages("src", exclude=("src/tests",)), package_dir={"": "src"}, long_description=build_description(), tests_require=["pytest", "coverage"], license="MIT",
from setuptools import Extension with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() build_with_mypyc = "--with-mypyc" in sys.argv if build_with_mypyc: version = subprocess.check_output(['mypyc','--version']) print("mypyc:",version) sys.argv.remove("--with-mypyc") if mypycify is not None and build_with_mypyc: files = glob.glob("soso/**/*.py",recursive=True) files = [f for f in files if f.find("__init__.py") == -1] ext_modules = mypycify(files) else: ext_modules = [] setuptools.setup( name="soso-state", version="0.0.1", author="Sohail Somani", author_email="*****@*****.**", description="Python 3.8+ application state container", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/sohailsomani/soso-state", packages=['soso', 'soso.state'], namespace_packages=['soso'], package_data={
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). # Note that we don't want to infer a dep on mypyc, as it's provided by the dist build system due # to uses_mypyc=True in the BUILD file. We therefore also ignore typechecking in this file. # type: ignore from mypyc.build import mypycify # pants: no-infer-dep from setuptools import setup setup( name="mypyc_fib", version="2.3.4", packages=["mypyc_fib"], ext_modules=mypycify(["mypyc_fib/__init__.py", "mypyc_fib/fib.py"]), description="Proof that mypyc compilation works", )
from mypyc.build import mypycify from setuptools import setup setup(name='nixos-secrets', version='0.2', description='Encrypted secrets management for NixOS', url='http://github.com/lopsided98/nixos-secrets', author='Ben Wolsieffer', author_email='*****@*****.**', license='MIT', ext_modules=mypycify(['nixos_secrets.py']), entry_points={ 'console_scripts': ['nixos-secrets=nixos_secrets:main'], }, install_requires=['python-gnupg'])
# Fix the paths to be full mypyc_targets = [os.path.join('mypy', x) for x in mypyc_targets] # This bit is super unfortunate: we want to use the mypy packaged # with mypyc. It will arrange for the path to be setup so it can # find it, but we've already imported parts, so we remove the # modules that we've imported already, which will let the right # versions be imported by mypyc. del sys.modules['mypy'] del sys.modules['mypy.version'] del sys.modules['mypy.git'] from mypyc.build import mypycify, MypycifyBuildExt opt_level = os.getenv('MYPYC_OPT_LEVEL', '3') ext_modules = mypycify(mypyc_targets, ['--config-file=mypy_bootstrap.ini'], opt_level) cmdclass['build_ext'] = MypycifyBuildExt description += " (mypyc-compiled version)" else: ext_modules = [] classifiers = [ 'Development Status :: 3 - Alpha', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Topic :: Software Development',
from setuptools import setup import os, re with open(os.path.join('treelog', '__init__.py')) as f: version = next( filter(None, map(re.compile("^version = '([a-zA-Z0-9.]+)'$").match, f))).group(1) if os.getenv('TREELOG_USE_MYPYC', None) == '1': from mypyc.build import mypycify import pathlib ext_modules = mypycify([ str(p) for p in pathlib.Path('treelog').glob('*.py') if p.name not in {'__init__.py', 'proto.py'} ]) else: ext_modules = [] setup( name='treelog', version=version, description='Logging framework that organizes messages in a tree structure', author='Evalf', author_email='*****@*****.**', url='https://github.com/evalf/treelog', packages=['treelog'], package_data={'treelog': ['py.typed']}, ext_modules=ext_modules, license='MIT', python_requires='>=3.5', install_requires=['typing_extensions'],
def _mypycify(self, module_name, code, lib_dir, args, quiet=True): py_file = os.path.join(lib_dir, module_name + ".py") with io.open(py_file, "w", encoding="utf-8") as f: f.write(code) return mypycify([py_file], verbose=not quiet, opt_level="3")
def extensions(): # None of these are required for operating any of the utilities found in this repo. # They are all present for speed. If you cannot compile arbitrary code or cython, # run setup.py with "PURE_PYTHON=1" environment variable defined to skip compiling # extensions. Note that the pure python code will run slower. if 'PURE_PYTHON' in os.environ: # We've been asked not to compile extensions. with open("MANIFEST.in", "w") as wfp: with open("MANIFEST.assets", "r") as rfp: wfp.write(rfp.read()) return [] from setuptools import Extension from Cython.Build import cythonize cython_only_code = [ # Alternative, orders of magnitude faster, memory-unsafe version of # LZ77 which drastically speeds up packet processing time. Extension( "bemani.protocol.lz77cpp", [ "bemani/protocol/lz77cpp.cxx", ], language="c++", extra_compile_args=["-std=c++14"], extra_link_args=["-std=c++14"], ), # This is a memory-unsafe, orders of magnitude faster threaded implementation # of the pure python blend code which takes rendering rough animations down # from over an hour to around a minute. Extension( "bemani.format.afp.blend.blendcpp", [ "bemani/format/afp/blend/blendcpp.pyx", "bemani/format/afp/blend/blendcppimpl.cxx", ], language="c++", extra_compile_args=["-std=c++14"], extra_link_args=["-std=c++14"], ), ] with open("MANIFEST.in", "w") as wfp: with open("MANIFEST.assets", "r") as rfp: wfp.write(rfp.read()) with open("MANIFEST.cython", "r") as rfp: wfp.write(rfp.read()) if 'EXPERIMENTAL_MYPYC_COMPILER' in os.environ: from mypyc.build import mypycify return [ *mypycify( [ # List of modules that works as compiled mypyc code. "bemani/protocol", "bemani/common", ], ), *cythonize( [ # Always include code that must be compiled with cython. *cython_only_code, # The format module is not ready for mypyc compilation yet, there are some bugs in # the compiler that prevent us from using it. Extension("bemani.format.dxt", [ "bemani/format/dxt.py", ]), # The types module is not ready for mypyc compilation yet, there are some bugs in # the compiler that prevent us from using it. Extension("bemani.format.afp.types.generic", [ "bemani/format/afp/types/generic.py", ]), ], language_level=3, ), ] else: return [ *cythonize( [ # Always include code that must be compiled with cython. *cython_only_code, # Hot code for anything constructing or parsing a remote game packet. Extension("bemani.protocol.binary", [ "bemani/protocol/binary.py", ]), # Even though we have a C++ implementation of this, some of the code # is still used as a wrapper to the C++ implementation and it is very # hot code (almost every packet touches this). Extension("bemani.protocol.lz77", [ "bemani/protocol/lz77.py", ]), # Every single backend service uses this class for construction and # parsing, so compiling this makes sense. Extension("bemani.protocol.node", [ "bemani/protocol/node.py", ]), # This is the top-level protocol marshall which gets touched at least # once per packet, so its worth it to squeeze more speed out of this. Extension("bemani.protocol.protocol", [ "bemani/protocol/protocol.py", ]), # This is used to implement a convenient way of parsing/creating binary # data and it is memory-safe accessses of bytes so it is necessarily # a bottleneck. Extension("bemani.protocol.stream", [ "bemani/protocol/stream.py", ]), # This gets used less frequently (only on the oldest games) but it is # still worth it to get a bit of a speed boost by compiling. Extension("bemani.protocol.xml", [ "bemani/protocol/xml.py", ]), # These types include operations such as matrix math and color conversion so # it is worth it to speed this up when rendering animations. Extension("bemani.format.afp.types.generic", [ "bemani/format/afp/types/generic.py", ]), # DXT is slow enough that it might be worth it to write a C++ implementation of # this at some point, but for now we squeeze a bit of speed out of this by compiling. Extension("bemani.format.dxt", [ "bemani/format/dxt.py", ]), ], language_level=3, ), ]
else: raise Exception("Can't find version in __init__.py") setup( name=package_name, version=package_version, author="Mahdi Ghanea.g", description="Rijndael algorithm library for Python3.", long_description=open("README.rst").read(), url="https://github.com/meyt/py3rijndael", packages=find_packages(), license="MIT License", ext_modules=mypycify([ "--strict", "py3rijndael/__init__.py", "py3rijndael/constants.py", "py3rijndael/paddings.py", "py3rijndael/rijndael.py", ]), setup_requires=["mypy"], classifiers=[ "Environment :: Console", "Topic :: Security :: Cryptography", "Intended Audience :: Developers", "Natural Language :: English", "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Topic :: Software Development",
from setuptools import setup # from setuptools_rust import Binding, RustExtension from mypyc.build import mypycify setup( # rust_extensions=[ # RustExtension( # "jkFontGeometry.fastgeometry", # binding=Binding.PyO3 # ) # ], ext_modules=mypycify([ "Lib/jkFontGeometry/__init__.py", ]), )
if USE_MYPYC: mypyc_targets = [ "src/black/__init__.py", "src/blib2to3/pytree.py", "src/blib2to3/pygram.py", "src/blib2to3/pgen2/parse.py", "src/blib2to3/pgen2/grammar.py", "src/blib2to3/pgen2/token.py", "src/blib2to3/pgen2/driver.py", "src/blib2to3/pgen2/pgen.py", ] from mypyc.build import mypycify opt_level = os.getenv("MYPYC_OPT_LEVEL", "3") ext_modules = mypycify(mypyc_targets, opt_level=opt_level) else: ext_modules = [] setup( name="black", use_scm_version={ "write_to": "src/_black_version.py", "write_to_template": 'version = "{version}"\n', }, description="The uncompromising code formatter.", long_description=get_long_description(), long_description_content_type="text/markdown", keywords="automation formatter yapf autopep8 pyfmt gofmt rustfmt", author="Łukasz Langa", author_email="*****@*****.**",
# ... and add back in the one test module we need mypy_targets.append(os.path.join(mypy_dir + 'test', 'visitors.py')) # Add refined mypy targets to mypyc targets mypyc_targets.extend(mypy_targets) # Fix the paths to be full mypyc_targets = [os.path.join('mypyc', x) for x in mypyc_targets] # The targets come out of file system apis in an unspecified # order. Sort them so that the mypyc output is deterministic. mypyc_targets.sort() opt_level = os.getenv('MYPYC_OPT_LEVEL', '3') from mypyc.build import mypycify ext_modules = mypycify(mypyc_targets, ['--config-file=mypyc_bootstrap.ini'], opt_level=opt_level, multi_file=sys.platform == 'win32') else: ext_modules = [] classifiers = [ 'Development Status :: 3 - Alpha', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Topic :: Software Development', ]