mirror of https://github.com/pyodide/pyodide.git
Add devcontainer configurations (#4402)
Adds two devcontainer configurations: * configuration "Docker": the default, equivalent to using run_docker * configuration "Conda" Codespaces and VS Code allow users to select the configuration.
This commit is contained in:
parent
fde32e9d8b
commit
a505bd5215
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "Conda",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
|
||||||
|
|
||||||
|
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
|
||||||
|
// Setup conda environment
|
||||||
|
"onCreateCommand": ".devcontainer/onCreate-conda.sh",
|
||||||
|
|
||||||
|
// Install additional features.
|
||||||
|
"features": {
|
||||||
|
// For config options, see https://github.com/devcontainers/features/tree/main/src/conda
|
||||||
|
"ghcr.io/devcontainers/features/conda": {
|
||||||
|
"version": "latest",
|
||||||
|
"addCondaForge": "true"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "Docker",
|
||||||
|
// keep in sync with "run_docker"
|
||||||
|
"image": "pyodide/pyodide-env:20230506-chrome112-firefox112-py311",
|
||||||
|
"remoteUser": "root",
|
||||||
|
"onCreateCommand": ".devcontainer/onCreate-docker.sh"
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Do not keep running on errors
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
# from https://pyodide.org/en/stable/development/building-from-sources.html#using-make:
|
||||||
|
# - build-essential
|
||||||
|
# we install pkg-config with apt because it is commented out in environment.yml
|
||||||
|
sudo apt-get update && sudo apt-get install --yes build-essential pkg-config
|
||||||
|
|
||||||
|
conda env create -n pyodide-env -f environment.yml
|
||||||
|
conda init bash
|
||||||
|
echo "conda activate pyodide-env" >> ~/.bashrc
|
||||||
|
|
||||||
|
# conda run -n pyodide-env make -C emsdk clean
|
||||||
|
# conda run -n pyodide-env make -C cpython clean
|
||||||
|
|
||||||
|
# https://pyodide.org/en/stable/development/building-from-sources.html#using-docker
|
||||||
|
export EMSDK_NUM_CORE=12 EMCC_CORES=12 PYODIDE_JOBS=12
|
||||||
|
echo "export EMSDK_NUM_CORE=12 EMCC_CORES=12 PYODIDE_JOBS=12" >> ~/.bashrc
|
||||||
|
echo "export PYODIDE_BUILD_TMP=/tmp/pyodide-build" >> ~/.bashrc
|
||||||
|
|
||||||
|
conda run -n pyodide-env --live-stream pip install -r requirements.txt
|
||||||
|
|
||||||
|
# https://pyodide.org/en/stable/development/new-packages.html#prerequisites
|
||||||
|
conda run -n pyodide-env --live-stream pip install -e ./pyodide-build
|
||||||
|
|
||||||
|
# Building emsdk and cpython takes a few minutes to run, so we do not run it here.
|
||||||
|
#
|
||||||
|
# conda run -n pyodide-env --live-stream make -C emsdk
|
||||||
|
# conda run -n pyodide-env --live-stream make -C cpython
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Do not keep running on errors
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# https://pyodide.org/en/stable/development/new-packages.html#prerequisites
|
||||||
|
pip install -e ./pyodide-build
|
||||||
|
|
||||||
|
# Building emsdk and cpython takes a few minutes to run, so we do not run it here.
|
||||||
|
#
|
||||||
|
# make -C emsdk
|
||||||
|
# make -C cpython
|
|
@ -60,6 +60,20 @@ You can edit the files in the shared `pyodide` source folder on your host
|
||||||
machine (outside of Docker), and then repeatedly run `make` inside the Docker
|
machine (outside of Docker), and then repeatedly run `make` inside the Docker
|
||||||
environment to test your changes.
|
environment to test your changes.
|
||||||
|
|
||||||
|
### Using the "Docker" dev container
|
||||||
|
|
||||||
|
We provide a dev container configuration that is equivalent to the use of
|
||||||
|
`./run_docker` script. It can be used in [Visual Studio Code](https://code.visualstudio.com/docs/devcontainers/containers) and
|
||||||
|
on [GitHub Codespaces](https://docs.github.com/en/codespaces/overview).
|
||||||
|
When prompted, select "Docker".
|
||||||
|
|
||||||
|
### Using the "Conda" dev container
|
||||||
|
|
||||||
|
We provide another dev container configuration that corresponds to
|
||||||
|
the "Linux with conda" method described below. When [Visual Studio Code](https://code.visualstudio.com/docs/devcontainers/containers) or
|
||||||
|
[GitHub Codespaces](https://docs.github.com/en/codespaces/overview)
|
||||||
|
prompts for the dev container configuration, select "Conda".
|
||||||
|
|
||||||
## Using `make`
|
## Using `make`
|
||||||
|
|
||||||
Make sure the prerequisites for
|
Make sure the prerequisites for
|
||||||
|
@ -185,8 +199,8 @@ The following environment variables additionally impact the build:
|
||||||
with a trailing `/`. Default: `./` to load Pyodide packages from the same
|
with a trailing `/`. Default: `./` to load Pyodide packages from the same
|
||||||
base URL path as where `pyodide.js` is located. Example:
|
base URL path as where `pyodide.js` is located. Example:
|
||||||
`{{PYODIDE_CDN_URL}}`
|
`{{PYODIDE_CDN_URL}}`
|
||||||
- `EXTRA_CFLAGS` : Add extra compilation flags.
|
- `EXTRA_CFLAGS`: Add extra compilation flags.
|
||||||
- `EXTRA_LDFLAGS` : Add extra linker flags.
|
- `EXTRA_LDFLAGS`: Add extra linker flags.
|
||||||
|
|
||||||
Setting `EXTRA_CFLAGS="-D DEBUG_F"` provides detailed diagnostic information
|
Setting `EXTRA_CFLAGS="-D DEBUG_F"` provides detailed diagnostic information
|
||||||
whenever error branches are taken inside the Pyodide core code. These error
|
whenever error branches are taken inside the Pyodide core code. These error
|
||||||
|
|
Loading…
Reference in New Issue