Skip to content

Commit

Permalink
Merge pull request #81 from diegoferigo/devcontainer
Browse files Browse the repository at this point in the history
Add GitHub Codespaces support
  • Loading branch information
diegoferigo committed Feb 8, 2024
2 parents 9ba607b + a2257f6 commit f4d8318
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 28 deletions.
26 changes: 26 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu
COPY environment.yml /opt/environment.yml

# Enable by default the conda environment for all users.
# The prefix is the one used by the micromamba feature.
ENV CONDA_PREFIX_JAXSIM=/opt/conda/envs/jaxsim
RUN echo 'function activate_conda() {' >> /etc/bash.bashrc &&\
echo ' eval "$(micromamba shell hook -s bash)"' >> /etc/bash.bashrc &&\
echo ' micromamba activate ${CONDA_PREFIX_JAXSIM-$CONDA_PREFIX}' >> /etc/bash.bashrc &&\
echo '}' >> /etc/bash.bashrc &&\
echo '[[ -x $(which micromamba) && -d ${CONDA_PREFIX_JAXSIM-$CONDA_PREFIX} ]] && activate_conda' >> /etc/bash.bashrc &&\
echo '[[ -x $(which micromamba) && ! -x $(which mamba) ]] && alias mamba="$(which micromamba)"' >> /etc/bash.bashrc &&\
echo '[[ -x $(which micromamba) && ! -x $(which conda) ]] && alias conda="$(which micromamba)"' >> /etc/bash.bashrc

# Provide libGL.so.1 from the host OS
RUN sudo apt-get update &&\
sudo apt-get install -y --no-install-recommends libgl1 &&\
rm -rf /var/lib/apt/lists/*

# The Python extension in VSCode is not able to detect the interpreter installed with micromamba.
# As documented as follows, we provide a suggestion through an environment variable.
# https://code.visualstudio.com/docs/python/environments#_where-the-extension-looks-for-environments
ENV WORKON_HOME=$CONDA_PREFIX_JAXSIM

# Specify the workdir of the container
WORKDIR /workspace/jaxsim
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"context": "..",
"dockerfile": "Dockerfile",
},

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/mamba-org/devcontainer-features/micromamba:1": {
"envFile": "/opt/environment.yml",
},
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"

// VSCode extensions
"extensions": [
"ms-python.python",
],
}
8 changes: 4 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ build:
os: ubuntu-22.04
tools:
python: "mambaforge-22.9"

conda:
environment: docs/jaxsim_conda_env.yml
environment: environment.yml

python:
install:
- method: pip
path: .

sphinx:
configuration: docs/conf.py

formats: all
formats: all
24 changes: 0 additions & 24 deletions docs/jaxsim_conda_env.yml

This file was deleted.

39 changes: 39 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: jaxsim
channels:
- conda-forge
dependencies:
# Dependencies from setup.cfg
- python=3.11
- coloredlogs
- jax >= 0.4.13
- jaxlib
- jaxlie >= 1.3.0
- jax-dataclasses >= 1.4.0
- pptree
- rod
# Optional dependencies from setup.cfg
- black
- isort
- idyntree
- pytest
- pytest-forked
- pytest-icdiff
- robot_descriptions
# System dependencies to run the tests
- gz-sim7
# Other packages
- ipython
# Documentation dependencies
- cachecontrol
- enum_tools
- filecache
- filelock
- jinja2
- sphinx
- sphinx-autodoc-typehints
- sphinx-copybutton
- sphinx_fontawesome
- sphinx-jinja2-compat
- sphinx-multiversion
- sphinx_rtd_theme
- sphinx-toolbox

0 comments on commit f4d8318

Please sign in to comment.