Skip to main content
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(
    ...
)

To speedup files compilation, the cythonization can be performed in parallel by setting the parallel option. The number of CPUs availbale can be retrived using the multiprocessing module. For instance:

import multiprocessing
from setuptools import setup
from setuptools_cythonize import get_cmdclass

setup(
    cmdclass=get_cmdclass(),
    name="my_package",
    ...
    options={
        'build_ext':
            {'parallel': multiprocessing.cpu_count()}
    },
    ...
)

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

Metadata

Release files for setuptools-cythonize 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for setuptools-cythonize 1.0.7
File Size Uploaded Provenance Actions
setuptools-cythonize-1.0.7.tar.gz 5.5 kB Without provenance Details for setuptools-cythonize-1.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for setuptools-cythonize 1.0.7
File Interpreter ABI Platform Actions
setuptools_cythonize-1.0.7-py2.py3-none-any.whl Python 3, Python 2 none any Details for setuptools_cythonize-1.0.7-py2.py3-none-any.whl

Total release size: 11.1 kB

Release files / setuptools-cythonize-1.0.7.tar.gz

Download URL setuptools-cythonize-1.0.7.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5a44e3ef90d3be6ae4cdf49c910fc6d70e0a3e29d55b165f5eb8f34ac0e1109f
BLAKE2b-256 checksum
How to use checksums
5c207100ed9836f2ef507fa45f1e77f0efe02eb0887708ab5df92baa352d545f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / setuptools_cythonize-1.0.7-py2.py3-none-any.whl

Download URL setuptools_cythonize-1.0.7-py2.py3-none-any.whl
Size 5.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
42fbff2ac71213e49faf533ac19b3469c273e7f0c401237129265f52e48491d9
BLAKE2b-256 checksum
How to use checksums
1d152918fd272c42cb6d753750f5152a038e42ccaafed2b104a357a9a6c57196
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Security for setuptools-cythonize 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page