Skip to main content

Distribute python modules/packages as binary files (compilation based on Cython)

Project description

setuptools-cythonize

Python 2.7+/3.5+ PyPi package PyPi downloads

The setuptools-cythonize provides distutils classes to compile Python source code into C code using Cython. The generated code is packaged into a platform dependent archive.

cythonization

Install

$> pip install setuptools-cythonize

Setup configuration

Add the cmdclass keyword to the setup:

from setuptools import setup
from setuptools_cythonize import get_cmdclass

setup(
    cmdclass=get_cmdclass(),
    name="my_package",
    version="2.0.5",
    description="My custom library",
    ...
)

Some packages can be excluded from the cythonization by setting the exclude_cythonize option. The module names matching is done using the function fnmatch.fnmatchcase .

from setuptools import setup
from setuptools_cythonize import get_cmdclass

setup(
    cmdclass=get_cmdclass(),
    name="my_package",
    ...
    options={
        'build_py':
            {'exclude_cythonize': ['my_package.subpack*']}
    },
    ...
)

The Cython compiler options can also be customized before running the setup:

from setuptools import setup

from Cython.Compiler import Options

Options.docstrings = False

setup(
    ...
)

Packaging

Generate your package by executing the setup.py file, all Python modules (except the ones defined in exclude_cythonize) will be compiled and packaged:

$> python setup.py bdist --cythonize

A source package can still be generated by removing the --cythonize option:

$> python setup.py bdist

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuptools-cythonize-1.0.5.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

setuptools_cythonize-1.0.5-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file setuptools-cythonize-1.0.5.tar.gz.

File metadata

  • Download URL: setuptools-cythonize-1.0.5.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for setuptools-cythonize-1.0.5.tar.gz
Algorithm Hash digest
SHA256 b3691c8ccdb971ed65e131adf267edc01011554097e7e81910c11ea08a24695e
MD5 b578adcfcbb172a47e1e954b67980607
BLAKE2b-256 4a40cda43158902ddbd3cfee1ccbe4019aaf6b4237c01724c81b7893cf6c9025

See more details on using hashes here.

File details

Details for the file setuptools_cythonize-1.0.5-py2.py3-none-any.whl.

File metadata

  • Download URL: setuptools_cythonize-1.0.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for setuptools_cythonize-1.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b68a5136704429555f1af57df21c501da20293625b0a6b907e53c75525c59901
MD5 a4f518e12c308c82b33e29803199b511
BLAKE2b-256 7dcdf6bd411ef7e8888e53ef3948be22091ef51c86134c356685a3265d84e846

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page