Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 6411aac

Browse files
authored
Merge pull request #104 from kabilar/main
Add GitHub Codespace environment
2 parents 4904022 + 887b53c commit 6411aac

16 files changed

+117
-1945
lines changed

.devcontainer/Dockerfile

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1-
# Note: You can use any Debian/Ubuntu based image you want.
2-
FROM mcr.microsoft.com/devcontainers/python:3.7-bullseye
1+
FROM mcr.microsoft.com/devcontainers/python:3.9-bullseye
32

3+
COPY ./requirements.txt /tmp/
44
RUN \
5+
# dev setup
56
apt update && \
67
apt-get install bash-completion graphviz default-mysql-client s3fs procps -y && \
7-
pip install flake8 black faker ipykernel pytest pytest-cov datajoint
8+
pip install --no-cache-dir --upgrade pip && \
9+
pip install --no-cache-dir flake8 black pre-commit && \
10+
# workflow dependencies
11+
apt-get install gcc ffmpeg libsm6 libxext6 -y && \
12+
# Commented out CaImAn installation due to Docker image size limits on Codespace
13+
# pip install --no-cache-dir Pygments==2.14.0 && \
14+
# git clone https://github.com/datajoint/CaImAn.git && \
15+
# pip install --no-cache-dir -r ./CaImAn/requirements.txt && \
16+
# pip install --no-cache-dir ./CaImAn && \
17+
pip install --no-cache-dir -r /tmp/requirements.txt && \
18+
# clean up
19+
# rm -rf /tmp/CaImAn && \
20+
rm /tmp/requirements.txt && \
21+
apt-get clean
822

923
ENV DJ_HOST fakeservices.datajoint.io
1024
ENV DJ_USER root
11-
ENV DJ_PASS simple
25+
ENV DJ_PASS simple
26+
27+
ENV DJ_PUBLIC_S3_MOUNT_PATH /workspaces/workflow-calcium-imaging/example_data

.devcontainer/devcontainer.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
1+
// For format details, see https://aka.ms/devcontainer.json.
22
{
3-
"name": "Development",
3+
"name": "Remote Demo",
44
"dockerComposeFile": "docker-compose.yaml",
55
"service": "app",
66
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
@@ -15,15 +15,14 @@
1515
"ghcr.io/eitsupi/devcontainer-features/jq-likes:1": {},
1616
"ghcr.io/guiyomh/features/vim:0": {}
1717
},
18-
// "onCreateCommand": "pip install -e .",
19-
"postStartCommand": "mkdir -p example_data && s3fs djhub.vathes.datapub.elements:/workflow-calcium-imaging-data-v2 example_data -o multipart_size=530,endpoint=us-east-1,url=http://s3.amazonaws.com,public_bucket=1 && MYSQL_VER=8.0 docker compose down && MYSQL_VER=8.0 docker compose up --build --wait",
18+
"onCreateCommand": "mkdir -p ${DJ_PUBLIC_S3_MOUNT_PATH} && pip install -e .",
19+
"postStartCommand": "docker volume prune -f && s3fs ${DJ_PUBLIC_S3_LOCATION} ${DJ_PUBLIC_S3_MOUNT_PATH} -o nonempty,multipart_size=530,endpoint=us-east-1,url=http://s3.amazonaws.com,public_bucket=1 && MYSQL_VER=8.0 docker compose down && MYSQL_VER=8.0 docker compose up --build --wait",
2020
"hostRequirements": {
21-
"cpus": 2,
22-
"memory": "4gb"
21+
"cpus": 4,
22+
"memory": "8gb"
2323
},
2424
"forwardPorts": [
25-
3306,
26-
8080
25+
3306
2726
],
2827
"customizations": {
2928
"vscode": {

.devcontainer/docker-compose.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
version: "3"
22
services:
33
app:
4-
build: .
5-
extra_hosts:
6-
- fakeservices.datajoint.io:127.0.0.1
7-
volumes:
8-
- ../..:/workspaces:cached
9-
entrypoint: /usr/local/share/docker-init.sh
10-
command: tail -f /dev/null
4+
extends:
5+
file: ./local/docker-compose.yaml
6+
service: app
7+
environment:
8+
- DJ_PUBLIC_S3_LOCATION=djhub.vathes.datapub.elements:/workflow-calcium-imaging-data-v2
119
devices:
1210
- /dev/fuse
1311
cap_add:
1412
- SYS_ADMIN
1513
security_opt:
16-
- apparmor:unconfined
14+
- apparmor:unconfined
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// For format details, see https://aka.ms/devcontainer.json.
2+
{
3+
"name": "Local Demo",
4+
"dockerComposeFile": "docker-compose.yaml",
5+
"service": "app",
6+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
7+
// Use this environment variable if you need to bind mount your local source code into a new container.
8+
"remoteEnv": {
9+
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
10+
},
11+
// https://containers.dev/features
12+
"features": {
13+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
14+
"ghcr.io/devcontainers/features/git:1": {},
15+
"ghcr.io/eitsupi/devcontainer-features/jq-likes:1": {},
16+
"ghcr.io/guiyomh/features/vim:0": {}
17+
},
18+
"onCreateCommand": "pip install -e .",
19+
"postStartCommand": "docker volume prune -f && MYSQL_VER=8.0 docker compose down && MYSQL_VER=8.0 docker compose up --build --wait",
20+
"hostRequirements": {
21+
"cpus": 4,
22+
"memory": "8gb"
23+
},
24+
"forwardPorts": [
25+
3306
26+
],
27+
"customizations": {
28+
"vscode": {
29+
"extensions": [
30+
"ms-python.python"
31+
]
32+
}
33+
}
34+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3"
2+
services:
3+
app:
4+
cpus: 4
5+
mem_limit: 8g
6+
build:
7+
context: ../..
8+
dockerfile: ./.devcontainer/Dockerfile
9+
extra_hosts:
10+
- fakeservices.datajoint.io:127.0.0.1
11+
volumes:
12+
- ../../..:/workspaces:cached
13+
entrypoint: /usr/local/share/docker-init.sh
14+
command: tail -f /dev/null

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"editor.formatOnPaste": false,
33
"editor.formatOnSave": true,
44
"editor.rulers": [
5-
94
5+
88
66
],
77
"python.formatting.provider": "black",
88
"[python]": {

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,31 @@
33
DataJoint Workflow for functional calcium imaging combines multiple DataJoint Elements to process data acquired with [ScanImage](http://scanimage.vidriotechnologies.com), [Scanbox](https://scanbox.org), `Nikon
44
NIS`, or `PrairieView` acquisition software, using [Suite2p](https://github.com/MouseLand/suite2p) or [CaImAn](https://github.com/flatironinstitute/CaImAn) analysis software. DataJoint Elements collectively standardize and automate data collection and analysis for neuroscience experiments. Each Element is a modular pipeline for data storage and processing with corresponding database tables that can be combined with other Elements to assemble a fully functional pipeline.
55

6-
Installation and usage instructions can be found at the
7-
[Element documentation](https://datajoint.com/docs/elements/element-calcium-imaging).
6+
To get started, see below for an [interactive tutorial](#interactive-tutorial) on GitHub Codespaces. More information can be found at the
7+
[Element documentation page](https://datajoint.com/docs/elements/element-calcium-imaging).
88

99
![diagram](https://raw.githubusercontent.com/datajoint/element-calcium-imaging/main/images/diagram_flowchart.svg)
10+
11+
## Interactive tutorial
12+
13+
The easiest way to learn about DataJoint Elements is to use the tutorial notebook within a [GitHub Codespace](https://docs.github.com/en/codespaces/overview). Please follow the steps below for the best experience:
14+
15+
1. Fork this repository to your GitHub account.
16+
17+
2. Select the green `Code` button.
18+
19+
3. Within the dropdown menu, select the `Codespaces` tab.
20+
21+
4. Select the green `Create codespace on main` button.
22+
23+
5. The environment is ready when a Visual Studio Code window is rendered within your browser. This takes ~5 minutes the first time being launched, and ~1 minute if you revisit this Codespace.
24+
25+
6. Navigate to the `notebooks` directory on the left panel and open the `tutorial.ipynb` Jupyter notebook. Execute the cells in this notebook to begin your walk through the tutorial.
26+
27+
7. Once you are done, GitHub will automatically terminate the Codespace after 30 minutes of inactivity or you can manually terminate the Codespace.
28+
29+
+ If you are new to GitHub and run into any errors, please contact us via email at [email protected]. If you are experienced with GitHub, please create an issue on the upstream repository or issue a pull request with a thorough explanantion of the error and proposed solution.
30+
31+
**Please Note:**
32+
33+
+ GitHub Codespaces are limited to 120 core-hours per month for free users. Once you exceed this limit, you will have to wait for the hours to reset or pay to use Codespaces.

docker-compose.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
version: "2.4"
33
services:
44
db:
5+
restart: always
56
image: datajoint/mysql:${MYSQL_VER}
67
environment:
78
- MYSQL_ROOT_PASSWORD=${DJ_PASS}
89
ports:
910
- "3306:3306"
10-
# To persist MySQL data
11-
# volumes:
12-
# - ./mysql/data:/var/lib/mysql
1311
healthcheck:
1412
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
1513
timeout: 15s
16-
retries: 5
17-
interval: 15s
14+
retries: 10
15+
interval: 15s

0 commit comments

Comments
 (0)