Skip to content

Commit 140384e

Browse files
Merge pull request #173 from kushalbakshi/codespace
Add DevContainers + Codespaces tutorial
2 parents 3b8efe5 + 733d2b1 commit 140384e

32 files changed

+3603
-124
lines changed

.devcontainer/Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM python:3.9-slim@sha256:5f0192a4f58a6ce99f732fe05e3b3d00f12ae62e183886bca3ebe3d202686c7f
2+
3+
ENV PATH /usr/local/bin:$PATH
4+
ENV PYTHON_VERSION 3.9.17
5+
6+
RUN \
7+
adduser --system --disabled-password --shell /bin/bash vscode && \
8+
# install docker
9+
apt-get update && \
10+
apt-get install ca-certificates curl gnupg lsb-release -y && \
11+
mkdir -m 0755 -p /etc/apt/keyrings && \
12+
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
13+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
14+
apt-get update && \
15+
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y && \
16+
usermod -aG docker vscode && \
17+
apt-get clean
18+
19+
RUN \
20+
# dev setup
21+
apt update && \
22+
apt-get install sudo git bash-completion graphviz default-mysql-client s3fs procps -y && \
23+
usermod -aG sudo vscode && \
24+
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
25+
pip install --no-cache-dir --upgrade black pip nbconvert && \
26+
echo '. /etc/bash_completion' >> /home/vscode/.bashrc && \
27+
echo 'export PS1="\[\e[32;1m\]\u\[\e[m\]@\[\e[34;1m\]\H\[\e[m\]:\[\e[33;1m\]\w\[\e[m\]$ "' >> /home/vscode/.bashrc && \
28+
apt-get clean
29+
30+
COPY ./ /tmp/element-array-ephys/
31+
32+
RUN \
33+
# pipeline dependencies
34+
apt-get install gcc g++ ffmpeg libsm6 libxext6 -y && \
35+
pip install --no-cache-dir -e /tmp/element-array-ephys[elements,tests] && \
36+
# clean up
37+
rm -rf /tmp/element-array-ephys && \
38+
apt-get clean
39+
40+
ENV DJ_HOST fakeservices.datajoint.io
41+
ENV DJ_USER root
42+
ENV DJ_PASS simple
43+
44+
ENV EPHYS_ROOT_DATA_DIR /workspaces/element-array-ephys/example_data
45+
ENV DATABASE_PREFIX neuro_
46+
47+
USER vscode
48+
CMD bash -c "sudo rm /var/run/docker.pid; sudo dockerd"

.devcontainer/devcontainer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "Environment + Data",
3+
"dockerComposeFile": "docker-compose.yaml",
4+
"service": "app",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
"remoteEnv": {
7+
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
8+
},
9+
"onCreateCommand": "mkdir -p ${EPHYS_ROOT_DATA_DIR} && pip install -e .",
10+
"postStartCommand": "docker volume prune -f && s3fs ${DJ_PUBLIC_S3_LOCATION} ${EPHYS_ROOT_DATA_DIR} -o nonempty,multipart_size=530,endpoint=us-east-1,url=http://s3.amazonaws.com,public_bucket=1",
11+
"hostRequirements": {
12+
"cpus": 4,
13+
"memory": "8gb",
14+
"storage": "32gb"
15+
},
16+
"forwardPorts": [
17+
3306
18+
],
19+
"customizations": {
20+
"settings": {
21+
"python.pythonPath": "/usr/local/bin/python"
22+
},
23+
"vscode": {
24+
"extensions": [
25+
"ms-python.python@2023.8.0",
26+
"ms-toolsai.jupyter@2023.3.1201040234"
27+
]
28+
}
29+
}
30+
}

.devcontainer/docker-compose.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: "3"
2+
services:
3+
app:
4+
cpus: 4
5+
mem_limit: 8g
6+
build:
7+
context: ..
8+
dockerfile: ./.devcontainer/Dockerfile
9+
# image: datajoint/element_array_ephys:latest
10+
extra_hosts:
11+
- fakeservices.datajoint.io:127.0.0.1
12+
environment:
13+
- DJ_PUBLIC_S3_LOCATION=djhub.vathes.datapub.elements:/workflow-array-ephys-benchmark/v2
14+
devices:
15+
- /dev/fuse
16+
cap_add:
17+
- SYS_ADMIN
18+
security_opt:
19+
- apparmor:unconfined
20+
volumes:
21+
- ..:/workspaces/element-array-ephys:cached
22+
- docker_data:/var/lib/docker # persist docker images
23+
privileged: true # only because of dind
24+
volumes:
25+
docker_data:

.github/workflows/release.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
uses: datajoint/.github/.github/workflows/mkdocs_release.yaml@main
1717
permissions:
1818
contents: write
19-
# devcontainer-build:
20-
# uses: datajoint/.github/.github/workflows/devcontainer-build.yaml@main
21-
# devcontainer-publish:
22-
# needs:
23-
# - devcontainer-build
24-
# uses: datajoint/.github/.github/workflows/devcontainer-publish.yaml@main
25-
# secrets:
26-
# DOCKERHUB_USERNAME: ${{secrets.DOCKERHUB_USERNAME}}
27-
# DOCKERHUB_TOKEN: ${{secrets.DOCKERHUB_TOKEN_FOR_ELEMENTS}}
19+
devcontainer-build:
20+
uses: datajoint/.github/.github/workflows/devcontainer-build.yaml@main
21+
devcontainer-publish:
22+
needs:
23+
- devcontainer-build
24+
uses: datajoint/.github/.github/workflows/devcontainer-publish.yaml@main
25+
secrets:
26+
DOCKERHUB_USERNAME: ${{secrets.DOCKERHUB_USERNAME}}
27+
DOCKERHUB_TOKEN: ${{secrets.DOCKERHUB_TOKEN_FOR_ELEMENTS}}

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
pull_request:
55
workflow_dispatch:
66
jobs:
7-
# devcontainer-build:
8-
# uses: datajoint/.github/.github/workflows/devcontainer-build.yaml@main
7+
devcontainer-build:
8+
uses: datajoint/.github/.github/workflows/devcontainer-build.yaml@main
99
tests:
1010
runs-on: ubuntu-latest
1111
strategy:

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,15 @@ dj_local_conf_old.json
116116
**/#*#
117117
**/.#*
118118

119-
docker-compose.y*ml
120119

121120
# include
122121
!docs/docker-compose.yaml
123122

124123
# vscode settings
125-
.vscode
126124
*.code-workspace
127125

128126
# exports/notes
129127
temp*
128+
129+
# Codespaces
130+
example_data/

.markdownlint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ MD030: false # Number of spaces after a list
1111
MD033: # HTML elements allowed
1212
allowed_elements:
1313
- "br"
14+
- "figure"
15+
- "figcaption"
1416
MD034: false # Permit bare URLs
1517
MD031: false # Spacing w/code blocks. Conflicts with `??? Note` and code tab styling
1618
MD046: false # Spacing w/code blocks. Conflicts with `??? Note` and code tab styling

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Current File",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal",
13+
"justMyCode": false
14+
}
15+
]
16+
}

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"editor.formatOnPaste": false,
3+
"editor.formatOnSave": true,
4+
"editor.rulers": [
5+
88
6+
],
7+
"python.formatting.provider": "black",
8+
"[python]": {
9+
"editor.defaultFormatter": null
10+
},
11+
"[markdown]": {
12+
"editor.defaultFormatter": "disable"
13+
},
14+
"files.autoSave": "off"
15+
}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
44
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
55

6+
## [0.3.0] - 2023-10-25
7+
8+
+ Add - DevContainer for codespaces
9+
+ Add - `tutorial_pipeline.py`
10+
+ Add - 60 min tutorial using Jupyter Notebooks, short demo notebook
11+
+ Update - General improvements to increase consistency with other DataJoint Elements
12+
613
## [0.2.11] - 2023-06-29
714

815
+ Update - Improve kilosort triggering routine - better logging, remove temporary files, robust resumable processing
@@ -126,6 +133,8 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
126133
+ Add - Probe table supporting: Neuropixels probes 1.0 - 3A, 1.0 - 3B, 2.0 - SS,
127134
2.0 - MS
128135

136+
[0.3.0]: https://github.com/datajoint/element-array-ephys/releases/tag/0.3.0
137+
[0.2.11]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.11
129138
[0.2.10]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.10
130139
[0.2.9]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.9
131140
[0.2.8]: https://github.com/datajoint/element-array-ephys/releases/tag/0.2.8

0 commit comments

Comments
 (0)