Skip to content

Commit 3a3ed66

Browse files
authored
WEB: Use mambaforge for the getting started installation instructions? (#48220)
* recommend mamba * replace conda with mamba * use mamba reference * remove unnecessary -f environment.yml
1 parent 654c4c0 commit 3a3ed66

File tree

2 files changed

+73
-77
lines changed

2 files changed

+73
-77
lines changed

doc/source/development/contributing_codebase.rst

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ If you want to run checks on all recently committed files on upstream/main you c
7575

7676
without needing to have done ``pre-commit install`` beforehand.
7777

78+
.. note::
79+
80+
You may want to periodically run ``pre-commit gc``, to clean up repos
81+
which are no longer used.
82+
7883
.. note::
7984

8085
If you have conflicting installations of ``virtualenv``, then you may get an

doc/source/development/contributing_environment.rst

+68-77
Original file line numberDiff line numberDiff line change
@@ -16,53 +16,8 @@ locally before pushing your changes.
1616
:local:
1717

1818

19-
Creating an environment using Docker
20-
--------------------------------------
21-
22-
Instead of manually setting up a development environment, you can use `Docker
23-
<https://docs.docker.com/get-docker/>`_ to automatically create the environment with just several
24-
commands. pandas provides a ``DockerFile`` in the root directory to build a Docker image
25-
with a full pandas development environment.
26-
27-
**Docker Commands**
28-
29-
Build the Docker image::
30-
31-
# Build the image pandas-yourname-env
32-
docker build --tag pandas-yourname-env .
33-
# Or build the image by passing your GitHub username to use your own fork
34-
docker build --build-arg gh_username=yourname --tag pandas-yourname-env .
35-
36-
Run Container::
37-
38-
# Run a container and bind your local repo to the container
39-
docker run -it -w /home/pandas --rm -v path-to-local-pandas-repo:/home/pandas pandas-yourname-env
40-
41-
.. note::
42-
If you bind your local repo for the first time, you have to build the C extensions afterwards.
43-
Run the following command inside the container::
44-
45-
python setup.py build_ext -j 4
46-
47-
You need to rebuild the C extensions anytime the Cython code in ``pandas/_libs`` changes.
48-
This most frequently occurs when changing or merging branches.
49-
50-
*Even easier, you can integrate Docker with the following IDEs:*
51-
52-
**Visual Studio Code**
53-
54-
You can use the DockerFile to launch a remote session with Visual Studio Code,
55-
a popular free IDE, using the ``.devcontainer.json`` file.
56-
See https://code.visualstudio.com/docs/remote/containers for details.
57-
58-
**PyCharm (Professional)**
59-
60-
Enable Docker support and use the Services tool window to build and manage images as well as
61-
run and interact with containers.
62-
See https://www.jetbrains.com/help/pycharm/docker.html for details.
63-
64-
Creating an environment without Docker
65-
---------------------------------------
19+
Option 1: creating an environment without Docker
20+
------------------------------------------------
6621

6722
Installing a C compiler
6823
~~~~~~~~~~~~~~~~~~~~~~~
@@ -72,9 +27,9 @@ operations. To install pandas from source, you need to compile these C
7227
extensions, which means you need a C compiler. This process depends on which
7328
platform you're using.
7429

75-
If you have setup your environment using ``conda``, the packages ``c-compiler``
30+
If you have setup your environment using :ref:`mamba <contributing.mamba>`, the packages ``c-compiler``
7631
and ``cxx-compiler`` will install a fitting compiler for your platform that is
77-
compatible with the remaining conda packages. On Windows and macOS, you will
32+
compatible with the remaining mamba packages. On Windows and macOS, you will
7833
also need to install the SDKs as they have to be distributed separately.
7934
These packages will automatically be installed by using the ``pandas``
8035
``environment.yml`` file.
@@ -107,16 +62,16 @@ To setup the right paths on the commandline, call
10762

10863
**macOS**
10964

110-
To use the ``conda``-based compilers, you will need to install the
65+
To use the :ref:`mamba <contributing.mamba>`-based compilers, you will need to install the
11166
Developer Tools using ``xcode-select --install``. Otherwise
11267
information about compiler installation can be found here:
11368
https://devguide.python.org/setup/#macos
11469

11570
**Linux**
11671

117-
For Linux-based ``conda`` installations, you won't have to install any
118-
additional components outside of the conda environment. The instructions
119-
below are only needed if your setup isn't based on conda environments.
72+
For Linux-based :ref:`mamba <contributing.mamba>` installations, you won't have to install any
73+
additional components outside of the mamba environment. The instructions
74+
below are only needed if your setup isn't based on mamba environments.
12075

12176
Some Linux distributions will come with a pre-installed C compiler. To find out
12277
which compilers (and versions) are installed on your system::
@@ -142,14 +97,15 @@ compiler installation instructions.
14297

14398
Let us know if you have any difficulties by opening an issue or reaching out on `Gitter <https://gitter.im/pydata/pandas/>`_.
14499

145-
Creating a Python environment
146-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100+
.. _contributing.mamba:
101+
102+
Option 1a: using mamba (recommended)
103+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
147104

148105
Now create an isolated pandas development environment:
149106

150-
* Install either `Anaconda <https://www.anaconda.com/products/individual>`_, `miniconda
151-
<https://docs.conda.io/en/latest/miniconda.html>`_, or `miniforge <https://github.com/conda-forge/miniforge>`_
152-
* Make sure your conda is up to date (``conda update conda``)
107+
* Install `mamba <https://mamba.readthedocs.io/en/latest/installation.html>`_
108+
* Make sure your mamba is up to date (``mamba update mamba``)
153109
* Make sure that you have :any:`cloned the repository <contributing.forking>`
154110
* ``cd`` to the pandas source directory
155111

@@ -162,11 +118,8 @@ We'll now kick off a three-step process:
162118
.. code-block:: none
163119
164120
# Create and activate the build environment
165-
conda env create -f environment.yml
166-
conda activate pandas-dev
167-
168-
# or with older versions of Anaconda:
169-
source activate pandas-dev
121+
mamba env create
122+
mamba activate pandas-dev
170123
171124
# Build and install pandas
172125
python setup.py build_ext -j 4
@@ -176,27 +129,20 @@ At this point you should be able to import pandas from your locally built versio
176129

177130
$ python
178131
>>> import pandas
179-
>>> print(pandas.__version__)
180-
0.22.0.dev0+29.g4ad6d4d74
132+
>>> print(pandas.__version__) # note: the exact output may differ
133+
1.5.0.dev0+1355.ge65a30e3eb.dirty
181134

182135
This will create the new environment, and not touch any of your existing environments,
183136
nor any existing Python installation.
184137

185-
To view your environments::
186-
187-
conda info -e
188-
189138
To return to your root environment::
190139

191-
conda deactivate
192-
193-
See the full conda docs `here <https://conda.io/projects/conda/en/latest/>`__.
194-
140+
mamba deactivate
195141

196-
Creating a Python environment (pip)
197-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142+
Option 1b: using pip
143+
~~~~~~~~~~~~~~~~~~~~
198144

199-
If you aren't using conda for your development environment, follow these instructions.
145+
If you aren't using mamba for your development environment, follow these instructions.
200146
You'll need to have at least the :ref:`minimum Python version <install.version>` that pandas supports.
201147
You also need to have ``setuptools`` 51.0.0 or later to build pandas.
202148

@@ -247,7 +193,7 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
247193

248194
Below is a brief overview on how to set-up a virtual environment with Powershell
249195
under Windows. For details please refer to the
250-
`official virtualenv user guide <https://virtualenv.pypa.io/en/latest/user_guide.html#activators>`__
196+
`official virtualenv user guide <https://virtualenv.pypa.io/en/latest/user_guide.html#activators>`__.
251197

252198
Use an ENV_DIR of your choice. We'll use ~\\virtualenvs\\pandas-dev where
253199
'~' is the folder pointed to by either $env:USERPROFILE (Powershell) or
@@ -268,3 +214,48 @@ should already exist.
268214
# Build and install pandas
269215
python setup.py build_ext -j 4
270216
python -m pip install -e . --no-build-isolation --no-use-pep517
217+
218+
Option 2: creating an environment using Docker
219+
----------------------------------------------
220+
221+
Instead of manually setting up a development environment, you can use `Docker
222+
<https://docs.docker.com/get-docker/>`_ to automatically create the environment with just several
223+
commands. pandas provides a ``DockerFile`` in the root directory to build a Docker image
224+
with a full pandas development environment.
225+
226+
**Docker Commands**
227+
228+
Build the Docker image::
229+
230+
# Build the image pandas-yourname-env
231+
docker build --tag pandas-yourname-env .
232+
# Or build the image by passing your GitHub username to use your own fork
233+
docker build --build-arg gh_username=yourname --tag pandas-yourname-env .
234+
235+
Run Container::
236+
237+
# Run a container and bind your local repo to the container
238+
docker run -it -w /home/pandas --rm -v path-to-local-pandas-repo:/home/pandas pandas-yourname-env
239+
240+
.. note::
241+
If you bind your local repo for the first time, you have to build the C extensions afterwards.
242+
Run the following command inside the container::
243+
244+
python setup.py build_ext -j 4
245+
246+
You need to rebuild the C extensions anytime the Cython code in ``pandas/_libs`` changes.
247+
This most frequently occurs when changing or merging branches.
248+
249+
*Even easier, you can integrate Docker with the following IDEs:*
250+
251+
**Visual Studio Code**
252+
253+
You can use the DockerFile to launch a remote session with Visual Studio Code,
254+
a popular free IDE, using the ``.devcontainer.json`` file.
255+
See https://code.visualstudio.com/docs/remote/containers for details.
256+
257+
**PyCharm (Professional)**
258+
259+
Enable Docker support and use the Services tool window to build and manage images as well as
260+
run and interact with containers.
261+
See https://www.jetbrains.com/help/pycharm/docker.html for details.

0 commit comments

Comments
 (0)