@@ -16,63 +16,8 @@ locally before pushing your changes.
16
16
:local:
17
17
18
18
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
- Then a ``pandas-dev `` virtual environment will be available with all the development dependencies.
42
-
43
- .. code-block :: shell
44
-
45
- root@... :/home/pandas# conda env list
46
- # conda environments:
47
- #
48
- base * /opt/conda
49
- pandas-dev /opt/conda/envs/pandas-dev
50
-
51
- .. note ::
52
- If you bind your local repo for the first time, you have to build the C extensions afterwards.
53
- Run the following command inside the container::
54
-
55
- python setup.py build_ext -j 4
56
-
57
- You need to rebuild the C extensions anytime the Cython code in ``pandas/_libs `` changes.
58
- This most frequently occurs when changing or merging branches.
59
-
60
- *Even easier, you can integrate Docker with the following IDEs: *
61
-
62
- **Visual Studio Code **
63
-
64
- You can use the DockerFile to launch a remote session with Visual Studio Code,
65
- a popular free IDE, using the ``.devcontainer.json `` file.
66
- See https://code.visualstudio.com/docs/remote/containers for details.
67
-
68
- **PyCharm (Professional) **
69
-
70
- Enable Docker support and use the Services tool window to build and manage images as well as
71
- run and interact with containers.
72
- See https://www.jetbrains.com/help/pycharm/docker.html for details.
73
-
74
- Creating an environment without Docker
75
- ---------------------------------------
19
+ Option 1: creating an environment without Docker
20
+ ------------------------------------------------
76
21
77
22
Installing a C compiler
78
23
~~~~~~~~~~~~~~~~~~~~~~~
@@ -82,9 +27,9 @@ operations. To install pandas from source, you need to compile these C
82
27
extensions, which means you need a C compiler. This process depends on which
83
28
platform you're using.
84
29
85
- 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 ``
86
31
and ``cxx-compiler `` will install a fitting compiler for your platform that is
87
- 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
88
33
also need to install the SDKs as they have to be distributed separately.
89
34
These packages will automatically be installed by using the ``pandas ``
90
35
``environment.yml `` file.
@@ -117,16 +62,16 @@ To setup the right paths on the commandline, call
117
62
118
63
**macOS **
119
64
120
- 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
121
66
Developer Tools using ``xcode-select --install ``. Otherwise
122
67
information about compiler installation can be found here:
123
68
https://devguide.python.org/setup/#macos
124
69
125
70
**Linux **
126
71
127
- For Linux-based `` conda ` ` installations, you won't have to install any
128
- additional components outside of the conda environment. The instructions
129
- 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.
130
75
131
76
Some Linux distributions will come with a pre-installed C compiler. To find out
132
77
which compilers (and versions) are installed on your system::
@@ -153,14 +98,15 @@ compiler installation instructions.
153
98
Let us know if you have any difficulties by opening an issue or reaching out on our contributor
154
99
community :ref: `Slack <community.slack >`.
155
100
156
- Creating a Python environment
157
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101
+ .. _contributing.mamba :
102
+
103
+ Option 1a: using mamba (recommended)
104
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158
105
159
106
Now create an isolated pandas development environment:
160
107
161
- * Install either `Anaconda <https://www.anaconda.com/products/individual >`_, `miniconda
162
- <https://docs.conda.io/en/latest/miniconda.html> `_, or `miniforge <https://github.com/conda-forge/miniforge >`_
163
- * Make sure your conda is up to date (``conda update conda ``)
108
+ * Install `mamba <https://mamba.readthedocs.io/en/latest/installation.html >`_
109
+ * Make sure your mamba is up to date (``mamba update mamba ``)
164
110
* Make sure that you have :any: `cloned the repository <contributing.forking> `
165
111
* ``cd `` to the pandas source directory
166
112
@@ -173,11 +119,8 @@ We'll now kick off a three-step process:
173
119
.. code-block :: none
174
120
175
121
# Create and activate the build environment
176
- conda env create -f environment.yml
177
- conda activate pandas-dev
178
-
179
- # or with older versions of Anaconda:
180
- source activate pandas-dev
122
+ mamba env create
123
+ mamba activate pandas-dev
181
124
182
125
# Build and install pandas
183
126
python setup.py build_ext -j 4
@@ -187,27 +130,20 @@ At this point you should be able to import pandas from your locally built versio
187
130
188
131
$ python
189
132
>>> import pandas
190
- >>> print(pandas.__version__)
191
- 0.22 .0.dev0+29.g4ad6d4d74
133
+ >>> print(pandas.__version__) # note: the exact output may differ
134
+ 1.5 .0.dev0+1355.ge65a30e3eb.dirty
192
135
193
136
This will create the new environment, and not touch any of your existing environments,
194
137
nor any existing Python installation.
195
138
196
- To view your environments::
197
-
198
- conda info -e
199
-
200
139
To return to your root environment::
201
140
202
- conda deactivate
203
-
204
- See the full conda docs `here <https://conda.io/projects/conda/en/latest/ >`__.
141
+ mamba deactivate
205
142
143
+ Option 1b: using pip
144
+ ~~~~~~~~~~~~~~~~~~~~
206
145
207
- Creating a Python environment (pip)
208
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209
-
210
- If you aren't using conda for your development environment, follow these instructions.
146
+ If you aren't using mamba for your development environment, follow these instructions.
211
147
You'll need to have at least the :ref: `minimum Python version <install.version >` that pandas supports.
212
148
You also need to have ``setuptools `` 51.0.0 or later to build pandas.
213
149
@@ -258,7 +194,7 @@ Consult the docs for setting up pyenv `here <https://github.com/pyenv/pyenv>`__.
258
194
259
195
Below is a brief overview on how to set-up a virtual environment with Powershell
260
196
under Windows. For details please refer to the
261
- `official virtualenv user guide <https://virtualenv.pypa.io/en/latest/user_guide.html#activators >`__
197
+ `official virtualenv user guide <https://virtualenv.pypa.io/en/latest/user_guide.html#activators >`__.
262
198
263
199
Use an ENV_DIR of your choice. We'll use ~\\ virtualenvs\\ pandas-dev where
264
200
'~' is the folder pointed to by either $env:USERPROFILE (Powershell) or
@@ -279,3 +215,58 @@ should already exist.
279
215
# Build and install pandas
280
216
python setup.py build_ext - j 4
281
217
python - m pip install - e . -- no- build-isolation -- no- use-pep517
218
+
219
+ Option 2: creating an environment using Docker
220
+ ----------------------------------------------
221
+
222
+ Instead of manually setting up a development environment, you can use `Docker
223
+ <https://docs.docker.com/get-docker/> `_ to automatically create the environment with just several
224
+ commands. pandas provides a ``DockerFile `` in the root directory to build a Docker image
225
+ with a full pandas development environment.
226
+
227
+ **Docker Commands **
228
+
229
+ Build the Docker image::
230
+
231
+ # Build the image pandas-yourname-env
232
+ docker build --tag pandas-yourname-env .
233
+ # Or build the image by passing your GitHub username to use your own fork
234
+ docker build --build-arg gh_username=yourname --tag pandas-yourname-env .
235
+
236
+ Run Container::
237
+
238
+ # Run a container and bind your local repo to the container
239
+ docker run -it -w /home/pandas --rm -v path-to-local-pandas-repo:/home/pandas pandas-yourname-env
240
+
241
+ Then a ``pandas-dev `` virtual environment will be available with all the development dependencies.
242
+
243
+ .. code-block :: shell
244
+
245
+ root@... :/home/pandas# conda env list
246
+ # conda environments:
247
+ #
248
+ base * /opt/conda
249
+ pandas-dev /opt/conda/envs/pandas-dev
250
+
251
+ .. note ::
252
+ If you bind your local repo for the first time, you have to build the C extensions afterwards.
253
+ Run the following command inside the container::
254
+
255
+ python setup.py build_ext -j 4
256
+
257
+ You need to rebuild the C extensions anytime the Cython code in ``pandas/_libs `` changes.
258
+ This most frequently occurs when changing or merging branches.
259
+
260
+ *Even easier, you can integrate Docker with the following IDEs: *
261
+
262
+ **Visual Studio Code **
263
+
264
+ You can use the DockerFile to launch a remote session with Visual Studio Code,
265
+ a popular free IDE, using the ``.devcontainer.json `` file.
266
+ See https://code.visualstudio.com/docs/remote/containers for details.
267
+
268
+ **PyCharm (Professional) **
269
+
270
+ Enable Docker support and use the Services tool window to build and manage images as well as
271
+ run and interact with containers.
272
+ See https://www.jetbrains.com/help/pycharm/docker.html for details.
0 commit comments