Add binder and devcontainer

This commit is contained in:
Dmitri Soshnikov 2022-05-24 20:41:31 +03:00
parent e6ae6a9a87
commit eab705b0c1
7 changed files with 182 additions and 0 deletions

20
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM mcr.microsoft.com/vscode/devcontainers/miniconda:0-3
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
# Copy environment.yml (if found) to a temp location so we update the environment. Also
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
COPY .devcontainer/environment.yml* .devcontainer/requirements.txt /tmp/conda-tmp/
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
&& rm -rf /tmp/conda-tmp
# [Optional] Uncomment to install a different version of Python than the default
# RUN conda install -y python=3.6 \
# && pip install --no-cache-dir pipx \
# && pipx reinstall-all
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

View File

@ -0,0 +1,19 @@
# Display a notice when not running in GitHub Codespaces
cat << 'EOF' > /usr/local/etc/vscode-dev-containers/conda-notice.txt
When using "conda" from outside of GitHub Codespaces, note the Anaconda repository
contains restrictions on commercial use that may impact certain organizations. See
https://aka.ms/vscode-remote/conda/miniconda
EOF
notice_script="$(cat << 'EOF'
if [ -t 1 ] && [ "${IGNORE_NOTICE}" != "true" ] && [ "${TERM_PROGRAM}" = "vscode" ] && [ "${CODESPACES}" != "true" ] && [ ! -f "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed" ]; then
cat "/usr/local/etc/vscode-dev-containers/conda-notice.txt"
mkdir -p "$HOME/.config/vscode-dev-containers"
((sleep 10s; touch "$HOME/.config/vscode-dev-containers/conda-notice-already-displayed") &)
fi
EOF
)"
echo "${notice_script}" | tee -a /etc/bash.bashrc >> /etc/zsh/zshrc

View File

@ -0,0 +1,47 @@
{
"name": "Miniconda (Python 3)",
"build": {
"context": "..",
"dockerfile": "Dockerfile",
"args": {
"NODE_VERSION": "lts/*"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/opt/conda/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
// 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": "python --version",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}

View File

@ -0,0 +1,21 @@
name: py38
channels:
- pytorch
- conda-forge
- defaults
dependencies:
- ipykernel
- ipython
- ipython_genutils
- ipywidgets
- jupyter
- matplotlib=3.4.2
- numpy=1.22.3
- python=3.8.12
- requests=2.26.0
- scikit-learn=0.24.2
- scipy=1.6.2
- setuptools=58.0.4
- tensorflow-base=2.3.0
- pip:
- -r requirements.txt

View File

@ -0,0 +1,27 @@
gensim==3.8.3
gym==0.23.1
huggingface==0.0.1
imageio==2.16.2
keras==2.8.0
nltk==3.5
opencv-python==4.5.1.48
pandas==1.4.2
pillow==9.1.0
pygame==2.1.2
scikit-image==0.19.2
seaborn==0.11.2
smart-open==5.2.1
tensorboard==2.8.0
tensorboard-data-server==0.6.1
tensorflow==2.8.0
tensorflow-datasets==4.4.0
tensorflow-hub==0.12.0
tensorflow-text==2.8.2
tokenizers==0.10.3
torch==1.11.0
torchaudio
torchinfo
torchtext
torchvision
tqdm==4.62.3
transformers==4.3.3

21
binder/environment.yml Normal file
View File

@ -0,0 +1,21 @@
name: py38
channels:
- pytorch
- conda-forge
- defaults
dependencies:
- ipykernel
- ipython
- ipython_genutils
- ipywidgets
- jupyter
- matplotlib=3.4.2
- numpy=1.22.3
- python=3.8.12
- requests=2.26.0
- scikit-learn=0.24.2
- scipy=1.6.2
- setuptools=58.0.4
- tensorflow-base=2.3.0
- pip:
- -r requirements.txt

27
binder/requirements.txt Normal file
View File

@ -0,0 +1,27 @@
gensim==3.8.3
gym==0.23.1
huggingface==0.0.1
imageio==2.16.2
keras==2.8.0
nltk==3.5
opencv-python==4.5.1.48
pandas==1.4.2
pillow==9.1.0
pygame==2.1.2
scikit-image==0.19.2
seaborn==0.11.2
smart-open==5.2.1
tensorboard==2.8.0
tensorboard-data-server==0.6.1
tensorflow==2.8.0
tensorflow-datasets==4.4.0
tensorflow-hub==0.12.0
tensorflow-text==2.8.2
tokenizers==0.10.3
torch==1.11.0
torchaudio
torchinfo
torchtext
torchvision
tqdm==4.62.3
transformers==4.3.3