Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.6.0: Use sorted(glob()) in example setup.py #2561

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions docs/compiling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ An example of a ``setup.py`` using pybind11's helpers:

.. code-block:: python

from glob import glob
from setuptools import setup
from pybind11.setup_helpers import Pybind11Extension

ext_modules = [
Pybind11Extension(
"python_example",
["src/main.cpp"],
sorted(glob("src/*.cpp")), # Sort source files for reproducibility
),
]

Expand All @@ -52,13 +53,14 @@ that is supported via a ``build_ext`` command override; it will only affect

.. code-block:: python

from glob import glob
from setuptools import setup
from pybind11.setup_helpers import Pybind11Extension, build_ext

ext_modules = [
Pybind11Extension(
"python_example",
["src/main.cpp"],
sorted(glob("src/*.cpp")),
),
]

Expand All @@ -71,12 +73,14 @@ that is supported via a ``build_ext`` command override; it will only affect
Since pybind11 does not require NumPy when building, a light-weight replacement
for NumPy's parallel compilation distutils tool is included. Use it like this:

.. code-block:: python

from pybind11.setup_helpers import ParallelCompile

# Optional multithreaded build
ParallelCompile("NPY_NUM_BUILD_JOBS").install()

setup(...
setup(...)

The argument is the name of an environment variable to control the number of
threads, such as ``NPY_NUM_BUILD_JOBS`` (as used by NumPy), though you can set
Expand Down