Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into integer_points_w…
Browse files Browse the repository at this point in the history
…ithout_flint
  • Loading branch information
Matthias Koeppe committed Feb 15, 2023
2 parents 9a8b269 + fbb4127 commit 118a408
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 26 deletions.
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/debian
{
"name": "Conda",
"image": "mcr.microsoft.com/vscode/devcontainers/base:0-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"
}
},
"customizations": {
"vscode": {
"extensions": [
"guyskk.language-cython",
"ms-python.isort",
"ms-toolsai.jupyter",
"ms-python.vscode-pylance",
"ms-python.pylint",
"ms-python.python",
"lextudio.restructuredtext",
"trond-snekvik.simple-rst"
]
}
}
}
14 changes: 14 additions & 0 deletions .devcontainer/onCreate-conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Do not keep running on errors
set -e

# Create conda environment
./bootstrap-conda
conda install mamba -n base -c conda-forge -y
mamba env create --file src/environment-dev.yml || mamba env update --file src/environment-dev.yml
conda init bash

# Build sage
conda run -n sage-dev ./bootstrap
conda run -n sage-dev ./configure --with-python=/opt/conda/envs/sage-dev/bin/python --prefix=/opt/conda/envs/sage-dev
conda run -n sage-dev pip install --no-build-isolation -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup
conda run -n sage-dev pip install --no-build-isolation -v -v -e ./src
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ src/ENV/
src/env.bak/
src/venv.bak/

# devcontainer
/.devcontainer/devcontainer.json

# mypy
**/.mypy_cache/

Expand Down
35 changes: 12 additions & 23 deletions src/doc/en/developer/portability_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1164,23 +1164,7 @@ provides sample ``devcontainer.json`` configuration files
<https://github.com/sagemath/sage/tree/develop/.devcontainer/>`_ for this
purpose.

To get started, symlink (or copy) one of the sample files to
``$SAGE_ROOT/.devcontainer/devcontainer.json``. For example, choose
`$SAGE_ROOT/.devcontainer/portability-ubuntu-jammy-standard/devcontainer.json
<https://github.com/sagemath/sage/tree/develop/.devcontainer/portability-ubuntu-jammy-standard/devcontainer.json>`_, which uses the Docker image based on ``ubuntu-jammy-standard``,
the most recent
development version of Sage (``dev`` tag), and a full installation of
the Sage distribution (``with-targets``).

In macOS for example, you can do this using the shell as follows::

[mkoeppe@sage sage] $ (cd .devcontainer && ln -s portability-ubuntu-jammy-standard/devcontainer.json .)

Now start VS Code::

[mkoeppe@sage sage] $ code .

Then VS Code may prompt you whether you would like to open the current
If you open the sage folder in VS Code, it may prompt you whether you would like to open the current
directory in the dev container (yes). If it does not, use the command palette
(:kbd:`Ctrl` + :kbd:`Shift` + :kbd:`P`), enter the command "Remote-Containers:
Reopen Folder in Container" , and hit :kbd:`Enter`.
Expand All @@ -1190,6 +1174,14 @@ application, then in the command palette of VS Code, enter "Remote-Containers:
Open Folder in Container", and hit :kbd:`Enter`, and choose the directory
``$SAGE_ROOT`` of your local Sage repository.

VS Code then prompts you to choose a dev container configuration.
For example, choose "Ubuntu jammy" `.devcontainer/portability-ubuntu-jammy-standard/devcontainer.json
<https://github.com/sagemath/sage/tree/develop/.devcontainer/portability-ubuntu-jammy-standard/devcontainer.json>`_,
which uses the Docker image based on ``ubuntu-jammy-standard``, the most recent
development version of Sage (``dev`` tag), and a full installation of
the Sage distribution (``with-targets``). Other dev container configurations
are described below.

Once VS Code starts configuring the dev container, by clicking on "show log",
you can see what it does:

Expand Down Expand Up @@ -1225,8 +1217,7 @@ in a terminal, `open a new terminal in VS Code
``configure`` script.

You can edit a copy of the configuration file to change to a different platform, another
version, or build stage. After editing the configuration file (or changing the
symlink), run "Remote-Containers: Rebuild Container" from the command
version, or build stage. After editing the configuration file, run "Remote-Containers: Rebuild Container" from the command
palette. See the `VS Code devcontainer.json reference
<https://code.visualstudio.com/docs/remote/devcontainerjson-reference>`_
and the `GitHub introduction to dev containers
Expand All @@ -1248,8 +1239,7 @@ installation of SageMath in this container by building from the current source t
project <https://hub.docker.com/r/computop/sage/>`_, providing
SnapPy, Regina, PHCPack, etc.

If you want to use one of these ``devcontainer.json`` files, symlink (or copy)
it and start VS Code as explained above. After VS Code finished configuring the
After VS Code finished configuring the
dev container, to use Sage in a terminal, `open a new terminal in VS Code
<https://code.visualstudio.com/docs/terminal/basics>`_, type ``./sage`` and hit
:kbd:`Enter`.
Expand Down Expand Up @@ -1284,8 +1274,7 @@ work without change) or to adapt them to your needs.
project <https://hub.docker.com/r/computop/sage/>`_, providing
SnapPy, Regina, PHCPack, etc.

If you want to use one of these ``devcontainer.json`` files, symlink (or copy)
it and start VS Code as explained above. After VS Code finished configuring the
After VS Code finished configuring the
dev container, to use Sage in a terminal, `open a new terminal in VS Code
<https://code.visualstudio.com/docs/terminal/basics>`_, type ``sage`` and hit
:kbd:`Enter`. (Do not use ``./sage``; this will not work because the source
Expand Down

0 comments on commit 118a408

Please sign in to comment.