Skip to content

Commit

Permalink
Merge branch 'master' into gh6496_sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
matusvalo authored Nov 15, 2024
2 parents 10c27c1 + 1c9dd6a commit ea60aab
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions docs/src/userguide/source_files_and_compilation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ directly to the ``Extension`` constructor in your setup file.

If you have a single Cython file that you want to turn into a compiled
extension, say with filename :file:`example.pyx` the associated :file:`setup.py`
would be::
would be:

.. code-block:: ini
:caption: setup.py
from setuptools import setup
from Cython.Build import cythonize
Expand All @@ -134,7 +137,7 @@ then you may also want to inform pip that :mod:`Cython` is required for
creating a :file:`pyproject.toml` file containing, at least:

.. code-block:: ini
:caption: pyproject.toml
[build-system]
requires = ["setuptools", "wheel", "Cython"]
Expand All @@ -146,6 +149,31 @@ documentation`_. To compile the extension for use in the current directory use:
$ python setup.py build_ext --inplace
.. note::

setuptools 74.1.0 adds experimental support for extensions in :file:`pyproject.toml` (instead of :file:`setup.py`):

.. code-block:: ini
:caption: pyproject.toml
[build-system]
requires = ["setuptools", "cython"]
build-backend = "setuptools.build_meta"
[project]
name = "mylib-foo"
version = "0.42"
[tool.setuptools]
ext-modules = [
{name = "example", sources = ["example.pyx"]}
]
In this case, you can use any build frontend - e.g. `build <https://pypi.org/project/build/>`_

.. code-block:: text
$ python -m build
Configuring the C-Build
------------------------
Expand Down

0 comments on commit ea60aab

Please sign in to comment.