Skip to content

mike-huls/cythonbuilder

Repository files navigation

CythonBuilder: automated compiling and packaging of Cython code

coverage Tests version dependencies PyPI Downloads versions
tweet xfollow

CythonBuilder makes it easy to use Cython in your Python project by automating the building process. You can use CythonBuilder from the commandline or import it as a package in Python. Generated files can be imported in Python directly

pip install cythonbuilder

Use CythonBuilder via the CLI

Add -v (verbose) for more information

  1. Listing files with and without filter
cybuilder list
cybuilder list --files file1 file2.pyx
  1. Build with and without optional build arguments
cybuilder build
cybuilder build --include-numpy --no-annotation --no-cleanup
  1. Clean
cybuilder clean 
cybuilder clean --no-cleanup

Use CythonBuilder via Python

  1. Listing files with and without filter
import cythonbuilder

print(cythonbuilder.cy_list())  # without a filter
print(cythonbuilder.cy_list(target_files=['some_name.pyx']))  # with a filter
  1. Build with and without optional build arguments (cleans automatically afterwards)
import cythonbuilder

cythonbuilder.cy_build()

found_files = cythonbuilder.cy_build(target_files=['some_name'])
cythonbuilder.cy_build(target_files=found_files, include_numpy=False, create_annotations=False)
  1. Clean
import cythonbuilder

cythonbuilder.cy_clean()

found_files = cythonbuilder.cy_build(target_files=['some_name'])
cythonbuilder.cy_clean(target_files=['some_name'])
  1. Setting debug level for verbose logging
import logging
from . import logger

logger.setLevel(logging.DEBUG)

In-depth, step by step Explanation

I've written a few articles that explain why Python is slow, why Cython can be a solution and how CythonBuilder helps us develop fast code easily:

About

CythonBuilder; automated compilation of Cython code

Resources

License

Stars

Watchers

Forks

Packages

No packages published