diff --git a/.devcontainer.json b/.devcontainer.json index 8bea96aea29c1..e84133383847e 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -4,13 +4,13 @@ "name": "pandas", "context": ".", "dockerFile": "Dockerfile", - + "postCreateCommand": "bash container_create.sh", // Use 'settings' to set *default* container specific settings.json values on container create. // You can edit these settings after create using File > Preferences > Settings > Remote. "settings": { - "terminal.integrated.shell.linux": "/bin/bash", + "terminal.integrated.defaultProfile.linux": "/bin/bash", "python.condaPath": "/opt/conda/bin/conda", - "python.pythonPath": "/opt/conda/bin/python", + "python.pythonPath": "/workspaces/pandas/.venv/bin/python", "python.formatting.provider": "black", "python.linting.enabled": true, "python.linting.flake8Enabled": true, @@ -21,10 +21,12 @@ "pandas" ] }, - // Add the IDs of extensions you want installed when the container is created in the array below. "extensions": [ "ms-python.python", "ms-vscode.cpptools" + ], + "runArgs": [ + "--privileged" ] -} +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b682d93efbd04..f80a11449a19a 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,6 @@ doc/build/html/index.html doc/tmp.sv env/ doc/source/savefig/ + +# container +.venv \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index de1c564921de9..66bb233dea9ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,29 +20,4 @@ RUN apt-get update \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* -# Switch back to dialog for any ad-hoc use of apt-get -ENV DEBIAN_FRONTEND=dialog -# Clone pandas repo -RUN mkdir "$pandas_home" \ - && git clone "https://github.com/$gh_username/pandas.git" "$pandas_home" \ - && cd "$pandas_home" \ - && git remote add upstream "https://github.com/pandas-dev/pandas.git" \ - && git pull upstream master - -# Because it is surprisingly difficult to activate a conda environment inside a DockerFile -# (from personal experience and per https://github.com/ContinuumIO/docker-images/issues/89), -# we just update the base/root one from the 'environment.yml' file instead of creating a new one. -# -# Set up environment -RUN conda install -y mamba -RUN mamba env update -n base -f "$pandas_home/environment.yml" - -# Build C extensions and pandas -SHELL ["/bin/bash", "-c"] -RUN . /opt/conda/etc/profile.d/conda.sh \ - && conda activate base \ - && cd "$pandas_home" \ - && export \ - && python setup.py build_ext -j 4 \ - && python -m pip install -e . diff --git a/container_create.sh b/container_create.sh new file mode 100644 index 0000000000000..559600ca95c36 --- /dev/null +++ b/container_create.sh @@ -0,0 +1,12 @@ +# Switch back to dialog for any ad-hoc use of apt-get +export DEBIAN_FRONTEND=dialog + +# Set up environment +conda install -y mamba +mamba env update -p .venv -f "environment.yml" + +source activate /workspaces/pandas/.venv + +# build + install pandas +python setup.py build_ext -j 4 +python -m pip install -e . \ No newline at end of file