Skip to content

Commit a7f973a

Browse files
committed
Update docs
1 parent 320a64b commit a7f973a

File tree

2 files changed

+51
-59
lines changed

2 files changed

+51
-59
lines changed

doc/source/development/contributing_environment.rst

Lines changed: 49 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -92,28 +92,6 @@ Option 1: using mamba (recommended)
9292
mamba env create --file environment.yml
9393
mamba activate pandas-dev
9494
95-
# Build and install pandas
96-
python setup.py build_ext -j 4
97-
python -m pip install -e . --no-build-isolation --no-use-pep517
98-
99-
# Alternatively, if you would like to try out our new build system
100-
# based on meson
101-
pip install . --no-build-isolation --config-settings="builddir=builddir"
102-
103-
At this point you should be able to import pandas from your locally built version::
104-
105-
$ python
106-
>>> import pandas
107-
>>> print(pandas.__version__) # note: the exact output may differ
108-
1.5.0.dev0+1355.ge65a30e3eb.dirty
109-
110-
This will create the new environment, and not touch any of your existing environments,
111-
nor any existing Python installation.
112-
113-
To return to your root environment::
114-
115-
mamba deactivate
116-
11795
Option 2: using pip
11896
~~~~~~~~~~~~~~~~~~~
11997

@@ -135,15 +113,6 @@ You also need to have ``setuptools`` 51.0.0 or later to build pandas.
135113
# Install the build dependencies
136114
python -m pip install -r requirements-dev.txt
137115
138-
# Build and install pandas
139-
python setup.py build_ext -j 4
140-
python setup.py develop
141-
142-
# Alternatively, if you would like to try out our new build system
143-
# based on meson
144-
pip install . --no-build-isolation --config-settings="builddir=builddir"
145-
146-
147116
**Unix**/**macOS with pyenv**
148117

149118
Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
@@ -163,14 +132,6 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
163132
# Now install the build dependencies in the cloned pandas repo
164133
python -m pip install -r requirements-dev.txt
165134
166-
# Build and install pandas
167-
python setup.py build_ext -j 4
168-
python setup.py develop
169-
170-
# Alternatively, if you would like to try out our new build system
171-
# based on meson
172-
pip install . --no-build-isolation --config-settings="builddir=builddir"
173-
174135
**Windows**
175136

176137
Below is a brief overview on how to set-up a virtual environment with Powershell
@@ -193,16 +154,8 @@ should already exist.
193154
# Install the build dependencies
194155
python -m pip install -r requirements-dev.txt
195156
196-
# Build and install pandas
197-
python setup.py build_ext -j 4
198-
python setup.py develop
199-
200-
# Alternatively, if you would like to try out our new build system
201-
# based on meson
202-
pip install . --no-build-isolation --config-settings="builddir=builddir"
203-
204-
Option 2: creating an environment using Docker
205-
----------------------------------------------
157+
Option 3: using Docker
158+
~~~~~~~~~~~~~~~~~~~~~~
206159

207160
pandas provides a ``DockerFile`` in the root directory to build a Docker image
208161
with a full pandas development environment.
@@ -238,11 +191,51 @@ See https://www.jetbrains.com/help/pycharm/docker.html for details.
238191
Step 3: build and install pandas
239192
--------------------------------
240193

241-
You can now run::
194+
There are currently two supported ways of building pandas, pip/meson and setuptools(setup.py).
195+
Historically, pandas has only supported using setuptools to build pandas. However, this method
196+
requires a lot of convoluted code in setup.py and also has many issues in compiling pandas in parallel
197+
due to limitations in setuptools.
198+
199+
The newer build system, invokes the meson backend through pip (via a `PEP 517 <https://peps.python.org/pep-0517/>`_ build).
200+
It automatically uses all available cores on your CPU, and also avoids the need for manual rebuilds by
201+
rebuilding automatically whenever pandas is imported(with an editable install).
202+
203+
For these reasons, you should compile pandas with meson.
204+
Because the meson build system is newer, you may find bugs/minor issues as it matures. You can report these bugs
205+
`here <https://github.com/pandas-dev/pandas/issues/49683>`_.
206+
207+
To compile pandas with meson, run::
242208

243209
# Build and install pandas
244-
python setup.py build_ext -j 4
245-
python -m pip install -e . --no-build-isolation --no-use-pep517
210+
python -m pip install -ve . --no-build-isolation
211+
212+
** Build options **
213+
214+
It is possible to pass options from the pip frontend to the meson backend if you would like to configure your
215+
install. Occasionally, you'll want to use this to adjust the build directory, and/or toggle debug/optimization levels.
216+
217+
You can pass a build directory to pandas by appending ``--config-settings builddir="your builddir here"`` to your pip command.
218+
This option allows you to configure where meson stores your built C extensions, and allows for fast rebuilds.
219+
220+
Sometimes, it might be useful to compile pandas with debugging symbols, when debugging C extensions.
221+
Appending ``--config-settings setup-args="-Ddebug=true"`` will do the trick.
222+
223+
With pip, it is possible to chain together multiple config settings (for example specifying both a build directory
224+
and building with debug symbols would look like
225+
``--config-settings builddir="your builddir here" --config-settings setup-args="-Ddebug=true"``.
226+
227+
**Compiling pandas with setup.py**
228+
229+
.. note::
230+
This method of compiling pandas will be deprecated and removed very soon, as the meson backend matures.
231+
232+
To compile pandas with setuptools, run::
233+
234+
python setup.py develop
235+
236+
.. note::
237+
You will also need to repeat this step each time the C extensions change,
238+
for example if you modified any file in ``pandas/_libs`` or if you did a fetch and merge from ``upstream/main``.
246239

247240
At this point you should be able to import pandas from your locally built version::
248241

@@ -251,9 +244,7 @@ At this point you should be able to import pandas from your locally built versio
251244
>>> print(pandas.__version__) # note: the exact output may differ
252245
2.0.0.dev0+880.g2b9e661fbb.dirty
253246

254-
This will create the new environment, and not touch any of your existing environments,
255-
nor any existing Python installation.
256-
257-
.. note::
258-
You will need to repeat this step each time the C extensions change, for example
259-
if you modified any file in ``pandas/_libs`` or if you did a fetch and merge from ``upstream/main``.
247+
.. tip::
248+
If you ever find yourself wondering whether setuptools or meson was used to build your pandas,
249+
you can check the value of ``pandas._built_with_meson``, which will be true if meson was used
250+
to compile pandas.

doc/source/development/debugging_extensions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ First, be sure to compile the extensions with the appropriate flags to generate
1212

1313
.. code-block:: sh
1414
15+
# If you're compiling pandas with setuptools, this would be
1516
python setup.py build_ext --inplace -j4 --with-debugging-symbols
1617
1718
# If using meson, this would be
18-
pip install . --no-build-isolation --config-settings builddir="builddir" --config-settings setup-args="-Ddebug=true"
19+
pip install -ve . --no-build-isolation --config-settings setup-args="-Ddebug=true"
1920
2021
Using a debugger
2122
================

0 commit comments

Comments
 (0)