Skip to main content

cython-setuptools

Build Status

Easier distribution and development of Cython modules.

Features:

  • Two distribution models: with C/C++ files included in the package, and without
  • Cython modules are defined in setup.cfg
  • Install directly from Cython sources, without installing Cython in the target environment (Cython is only included in install_requires)

Installation

$ pip install cython-setuptools

Usage

Here is an example Python package using the default distribution model (only Cython files are included in the source package).

First install the cython-setuptools vendor module in the package, next to setup.py.

$ cd your-python-project/
$ cython-setuptools install

Then use cython-setuptools' setup() in your setup.py:

from cysetuptools import setup

setup()

Note that we keep the default cythonize=True argument of setup() here, meaning that C files are compiled from Cython files automatically. setup(cythonize=False) would mean we would need to distribute the C/C++ files compiled from Cython in the source package.

Define your Cython modules in setup.cfg.

[metadata]
name = your-python-project
version = 1.0

[options]
packages = find:
install_requires = cython

[options.extras_require]
dev = cython

[cython-defaults]
include_dirs = include/

[cython-module: foo.bar]
sources = foo.pyx
          bar.cpp
include_dirs = eval(__import__('numpy').get_include())
language = c++
pkg_config_packages = opencv

Then your Cython modules can be compiled and tested in-place with:

$ python setup.py build_ext --inplace

This automatically compile outdated Cython files. If setup(cythonize=False) is used, you have to specifically tell the setup to recompile outdated Cython files:

$ CYTHONIZE=1 python setup.py build_ext --inplace

Metadata

Release files for cython-setuptools 0.2.3

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

Source distribution (sdist)

Source distribution for cython-setuptools 0.2.3
File Size Uploaded Provenance
cython-setuptools-0.2.3.tar.gz 6.9 kB Without provenance Details

Release files / cython-setuptools-0.2.3.tar.gz

Download URL cython-setuptools-0.2.3.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0f83b74f3d2743e29a709e52ff04dccb776dbf0c332f9b3ca2b2150f4adb0940
BLAKE2b-256 checksum
How to use checksums
60916b6e15cfc3aef2f963bf3e9ef10266e849f67f3101fc0e1d5e3176e8a140
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/2.7.17

Security for cython-setuptools 0.2.3

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