cython

The most widely used Python to C compiler

https://github.com/cython/cython

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    33 of 552 committers (6.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.6%) to scientific vocabulary

Keywords

big-data c cpp cpython cpython-extensions cython performance python

Keywords from Contributors

closember alignment flexible qt gtk tk wx repl notebook spec-0
Last synced: 6 months ago · JSON representation

Repository

The most widely used Python to C compiler

Basic Info
  • Host: GitHub
  • Owner: cython
  • License: apache-2.0
  • Language: Python
  • Default Branch: master
  • Homepage: https://cython.org
  • Size: 73.4 MB
Statistics
  • Stars: 10,243
  • Watchers: 236
  • Forks: 1,553
  • Open Issues: 1,467
  • Releases: 43
Topics
big-data c cpp cpython cpython-extensions cython performance python
Created over 15 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing Funding License Code of conduct

README.rst

Welcome to Cython!
==================

Cython is an optimising Python compiler that makes writing C extensions for
Python as easy as Python itself.

Cython translates Python code to C/C++ code, but additionally supports calling
C functions and declaring C types on variables and class attributes.
This allows broad to fine-grained manual tuning that lets the compiler
generate very efficient C code from Cython code.

This makes Cython the ideal language for wrapping external C libraries, and
for fast C modules that speed up the execution of Python code.

* Official website: https://cython.org/
* Documentation: https://docs.cython.org/
* Github repository: https://github.com/cython/cython
* Wiki: https://github.com/cython/cython/wiki

Cython has `more than 70 million downloads `_
per month on PyPI.  You can **support the Cython project** via
`Github Sponsors `_ or
`Tidelift `_.


Installation:
-------------

If you already have a C compiler, just run following command::

   pip install Cython

otherwise, see `the installation page `_.


License:
--------

The original Pyrex program, which Cython is based on, was licensed "free of restrictions" (see below).
Cython itself is licensed under the permissive **Apache License**.

See `LICENSE.txt `_.


Contributing:
-------------

Want to contribute to the Cython project?
Here is some `help to get you started `_.


Differences to other Python compilers
-------------------------------------

Started as a project in the early 2000s, Cython has outlived
`most other attempts `_
at producing static compilers for the Python language.

Similar projects that have a relevance today include:

* `PyPy `_, a Python implementation with a JIT compiler.

  * Pros: JIT compilation with runtime optimisations, fully language compliant,
    good integration with external C/C++ code
  * Cons: non-CPython runtime, relatively large resource usage of the runtime,
    limited compatibility with CPython extensions, non-obvious performance results

* `Numba `_, a Python extension that features a
  JIT compiler for a subset of the language, based on the LLVM compiler
  infrastructure (probably best known for its ``clang`` C compiler).
  It mostly targets numerical code that uses NumPy.

  * Pros: JIT compilation with runtime optimisations
  * Cons: limited language support, relatively large runtime dependency (LLVM),
    non-obvious performance results

* `Pythran `_, a static Python-to-C++
  extension compiler for a subset of the language, mostly targeted
  at numerical computation.  Pythran can be (and is probably best) used
  as an additional
  `backend for NumPy code `_
  in Cython.

* `mypyc `_, a static Python-to-C extension
  compiler, based on the `mypy `_ static Python
  analyser.  Like Cython's
  `pure Python mode `_,
  mypyc can make use of PEP-484 type annotations to optimise code for static types.

  * Pros: good support for language and PEP-484 typing, good type inference,
    reasonable performance gains
  * Cons: no support for low-level optimisations and typing,
    opinionated Python type interpretation, reduced Python compatibility
    and introspection after compilation

* `Nuitka `_, a static Python-to-C extension compiler.

  * Pros: highly language compliant, reasonable performance gains,
    support for static application linking (similar to
    `cython_freeze `_
    but with the ability to bundle library dependencies into a self-contained
    executable)
  * Cons: no support for low-level optimisations and typing

In comparison to the above, Cython provides

* fast, efficient and highly compliant support for almost all
  Python language features, including dynamic features and introspection
* full runtime compatibility with all still-in-use and future versions
  of CPython
* "generate once, compile everywhere" C code generation that allows for
  reproducible performance results and testing
* C compile time adaptation to the target platform and Python version
* support for other C-API implementations, including PyPy and Pyston
* seamless integration with C/C++ code
* broad support for manual optimisation and tuning down to the C level
* a large user base with thousands of libraries, packages and tools
* more than two decades of bug fixing and static code optimisations


The following is from Pyrex:
------------------------------------------------------
Cython was originally based on `Pyrex `_
by Greg Ewing, with the following written in the Pyrex readme document:

This is a development version of Pyrex, a language
for writing Python extension modules.

For more info, take a look at:

* Doc/About.html for a description of the language
* INSTALL.txt    for installation instructions
* USAGE.txt      for usage instructions
* Demos          for usage examples

Comments, suggestions, bug reports, etc. are most
welcome!

Copyright stuff: Pyrex is free of restrictions. You
may use, redistribute, modify and distribute modified
versions.

The latest version of Pyrex can be found `here `_.

| Greg Ewing, Computer Science Dept
| University of Canterbury
| Christchurch, New Zealand

 A citizen of NewZealandCorp, a wholly-owned subsidiary of USA Inc.

Owner

  • Name: cython
  • Login: cython
  • Kind: organization

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 16,945
  • Total Committers: 552
  • Avg Commits per committer: 30.697
  • Development Distribution Score (DDS): 0.427
Past Year
  • Commits: 724
  • Committers: 49
  • Avg Commits per committer: 14.776
  • Development Distribution Score (DDS): 0.449
Top Committers
Name Email Commits
Stefan Behnel s****l@b****e 9,708
Robert Bradshaw r****b@g****m 2,212
da-woods d****t@d****k 814
Mark Florisson m****8@g****m 488
Dag Sverre Seljebotn d****s@s****o 449
Lisandro Dalcin d****l@g****m 340
Vitja Makarov v****v@g****m 294
gabrieldemarmiesse g****e@t****m 209
Jeroen Demeyer j****r@c****e 120
Matus Valo m****o 120
Matti Picus m****s@g****m 109
ggellner@encolpuis n****e@n****e 84
Lars Buitinck l****s@g****m 60
Kurt Smith k****1@w****u 50
Ian Henriksen i****e@g****m 46
Craig Citro c****o@g****m 39
William Stein w****n@g****m 37
Max Bachmann k****t@m****e 37
0dminnimda 0****a@g****m 30
gabrieldemarmiesse g****e@g****m 29
Nikita Nemkin n****a@n****u 29
Mark Lodato l****m@g****m 27
Haoyu Bai b****u@g****m 27
Christoph Gohlke c****e@u****u 27
Zackery Spytz z****z@g****m 25
Charles Blake c****e@c****u 19
John Kirkham k****j@j****g 19
Yury V. Zaytsev y****y@s****m 17
serge-sans-paille s****n@t****u 16
Matthias BUSSONNIER b****s@g****m 16
and 522 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 924
  • Total pull requests: 1,459
  • Average time to close issues: 8 months
  • Average time to close pull requests: 3 months
  • Total issue authors: 435
  • Total pull request authors: 143
  • Average comments per issue: 3.1
  • Average comments per pull request: 2.46
  • Merged pull requests: 1,037
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 311
  • Pull requests: 676
  • Average time to close issues: 8 days
  • Average time to close pull requests: 8 days
  • Issue authors: 159
  • Pull request authors: 52
  • Average comments per issue: 1.18
  • Average comments per pull request: 1.58
  • Merged pull requests: 453
  • Bot issues: 0
  • Bot pull requests: 5
Top Authors
Issue Authors
  • da-woods (96)
  • scoder (73)
  • matusvalo (32)
  • user202729 (30)
  • vyasr (21)
  • bbb23exposed (16)
  • jakirkham (12)
  • Source61 (12)
  • YoSTEALTH (11)
  • axeldavy (11)
  • robertwb (8)
  • pitrou (8)
  • oscarbenjamin (8)
  • hroncok (6)
  • mattip (6)
Pull Request Authors
  • da-woods (749)
  • scoder (174)
  • matusvalo (114)
  • dalcinl (32)
  • mattip (29)
  • bbb23exposed (17)
  • lysnikolaou (16)
  • ngoldbaum (12)
  • EwoutH (11)
  • alexandrasp (10)
  • user202729 (9)
  • vyasr (9)
  • kentslaney (8)
  • zyv (8)
  • jpe (7)
Top Labels
Issue Labels
defect (161) Code Generation (98) Type Analysis (37) support question (30) feature (28) enhancement (27) Documentation (25) Python Semantics (23) R: duplicate (20) limited api (19) Build System (19) Cython Language Feature (17) cleanup (15) Pure Python Mode (15) Testing (15) Optimization (13) help wanted (13) Error Reporting (12) R: third party (12) C++ (11) good first issue (9) R: worksforme (9) nogil CPython (7) P: blocker (7) performance (7) R: wontfix (6) numpy (5) Library (5) freethreading CPython (5) Parsing (4)
Pull Request Labels
Code Generation (342) defect (318) cleanup (173) limited api (136) Testing (130) enhancement (116) Documentation (99) freethreading CPython (73) C++ (72) Type Analysis (63) Library (49) Error Reporting (40) Build System (38) Pure Python Mode (30) Cython Language Feature (29) feature (28) Optimization (27) nogil CPython (27) Python Semantics (26) performance (26) PyPy (18) Tools (17) numpy (9) github_actions (5) dependencies (5) Coverage (4) Debugger (4) Parsing (3) sharedlib (3) Pythran (2)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 70,440,562 last-month
  • Total docker downloads: 1,267,277,045
  • Total dependent packages: 1,345
    (may contain duplicates)
  • Total dependent repositories: 21,510
    (may contain duplicates)
  • Total versions: 275
  • Total maintainers: 4
pypi.org: cython

The Cython compiler for writing C extensions in the Python language.

  • Versions: 149
  • Dependent Packages: 1,019
  • Dependent Repositories: 18,920
  • Downloads: 70,440,562 Last month
  • Docker Downloads: 1,267,277,045
Rankings
Dependent packages count: 0.0%
Downloads: 0.0%
Dependent repos count: 0.1%
Docker downloads count: 0.1%
Average: 0.4%
Stargazers count: 0.6%
Forks count: 1.5%
Maintainers (3)
Last synced: 6 months ago
spack.io: py-cython

The Cython compiler for writing C extensions for the Python language.

  • Versions: 35
  • Dependent Packages: 179
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.4%
Average: 1.0%
Stargazers count: 1.3%
Forks count: 2.4%
Maintainers (1)
Last synced: about 1 year ago
conda-forge.org: cython

Cython is an optimising static compiler for both the Python programming language and the extended Cython programming language. It makes writing C extensions for Python as easy as Python itself.

  • Versions: 49
  • Dependent Packages: 136
  • Dependent Repositories: 1,295
Rankings
Dependent packages count: 0.5%
Dependent repos count: 0.5%
Average: 2.2%
Stargazers count: 3.6%
Forks count: 4.1%
Last synced: 6 months ago
anaconda.org: cython

Cython is an optimising static compiler for both the Python programming language and the extended Cython programming language. It makes writing C extensions for Python as easy as Python itself.

  • Homepage: https://cython.org
  • License: Apache-2.0
  • Latest release: 3.1.3
    published 6 months ago
  • Versions: 42
  • Dependent Packages: 11
  • Dependent Repositories: 1,295
Rankings
Dependent repos count: 3.3%
Dependent packages count: 3.8%
Average: 6.5%
Stargazers count: 9.2%
Forks count: 9.5%
Last synced: 6 months ago

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/checkout v2 composite
  • actions/setup-python v3 composite
  • actions/setup-python v2 composite
  • actions/upload-artifact v3 composite
  • actions/upload-artifact v2 composite
  • hendrikmuhs/ccache-action v1.2 composite
.github/workflows/wheels.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • actions/upload-artifact v3 composite
  • docker/setup-qemu-action v1 composite
  • pypa/cibuildwheel v2.11.4 composite
  • softprops/action-gh-release v1 composite
doc-requirements.txt pypi
  • Jinja2 ==3.0.3
  • jupyter *
  • sphinx ==3.5.3
  • sphinx-issues ==1.2.0
  • sphinx-tabs ==3.0.0
test-requirements-312.txt pypi
  • coverage * test
  • numpy * test
  • pycodestyle * test
  • setuptools * test
test-requirements-cpython.txt pypi
  • jupyter * test
  • line_profiler <4 test
  • pytest * test
  • setuptools <60 test
test-requirements.txt pypi
  • coverage * test
  • numpy * test
  • pycodestyle * test
  • setuptools <60 test
Demos/benchmarks/setup.py pypi
Demos/libraries/setup.py pypi
Demos/setup.py pypi
docs/examples/quickstart/build/setup.py pypi
docs/examples/tutorial/external/setup.py pypi
docs/examples/tutorial/parallelization/setup.py pypi
docs/examples/userguide/wrapping_CPlusPlus/setup.py pypi
setup.py pypi