File tree Expand file tree Collapse file tree 7 files changed +125
-0
lines changed Expand file tree Collapse file tree 7 files changed +125
-0
lines changed Original file line number Diff line number Diff line change
1
+ version : 2.0
2
+
3
+ jobs :
4
+ deploy_to_playground :
5
+ docker :
6
+ - image : circleci/python:3.6-stretch
7
+ steps :
8
+ - checkout
9
+ - run :
10
+ name : Add plotly remote
11
+ command : git remote add playground https://dash-playground.plotly.host/GIT/slicer-$CIRCLE_BRANCH
12
+ - run :
13
+ name : Create helper-script
14
+ command : printf '#!/bin/bash\necho username=$PLAYGROUND_DEPLOY_USERNAME\necho password=$PLAYGROUND_DEPLOY_PASSWORD' >> /home/circleci/helper-script.sh
15
+ - run :
16
+ name : Set up git config
17
+ command : |
18
+ git config --global credential.helper "/bin/bash /home/circleci/helper-script.sh"
19
+ git config --global user.email '<>' # Leave email blank
20
+ git config --global user.name "Circle MonoRepo Automatic Deployer"
21
+ - run :
22
+ name : Install curl
23
+ command : |
24
+ sudo apt update
25
+ sudo apt install -y -qq curl
26
+ - run :
27
+ name : Install dds-client
28
+ command : |
29
+ curl -sSL -o dds-client.tgz https://github.com/plotly/dds-client/releases/download/v0.3.0/dds-client_0.3.0_linux_x86_64.tgz
30
+ mkdir $HOME/bin
31
+ tar xzf dds-client.tgz -C $HOME/bin
32
+ chmod +x $HOME/bin/dds-client
33
+ - run :
34
+ name : Deploy
35
+ command : |
36
+ if ! DASH_ENTERPRISE_URL="$DASH_PLAYGROUND_ENTERPRISE_URL" DASH_ENTERPRISE_API_KEY="$DASH_PLAYGROUND_ENTERPRISE_API_KEY" DASH_ENTERPRISE_USERNAME="$PLAYGROUND_DEPLOY_USERNAME" dds-client apps:exists --name "slicer-$CIRCLE_BRANCH" >/dev/null 2>&1; then
37
+ DASH_ENTERPRISE_URL="$DASH_PLAYGROUND_ENTERPRISE_URL" DASH_ENTERPRISE_API_KEY="$DASH_PLAYGROUND_ENTERPRISE_API_KEY" DASH_ENTERPRISE_USERNAME="$PLAYGROUND_DEPLOY_USERNAME" dds-client apps:create --name "slicer-$CIRCLE_BRANCH"
38
+ fi
39
+ # We force push since branches can diverge and playground is a
40
+ # sandbox
41
+ git push --force playground $CIRCLE_BRANCH:master
42
+
43
+ workflows :
44
+ version : 2
45
+ test-and-deploy :
46
+ jobs :
47
+ - deploy_to_playground :
48
+ filters :
49
+ branches :
50
+ ignore :
51
+ - main
Original file line number Diff line number Diff line change
1
+ web : gunicorn test_deploy.app:server
Original file line number Diff line number Diff line change @@ -45,3 +45,7 @@ This code is distributed under MIT license.
45
45
* Use ` black . ` to autoformat.
46
46
* Use ` flake8 . ` to lint.
47
47
* Use ` pytest . ` to run the tests.
48
+
49
+ On every PR, an app with the same name as your branch is deployed to the Dash
50
+ playground instance so that you can change whether your changes did not break
51
+ the package.
Original file line number Diff line number Diff line change
1
+ {
2
+ "scripts" : {
3
+ "dokku" : {
4
+ "predeploy" : " python test_deploy/predeploy.py"
5
+ }
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ """
2
+ An example with two slicers on the same volume.
3
+ """
4
+
5
+ import dash
6
+ import dash_html_components as html
7
+ from dash_slicer import VolumeSlicer
8
+ import imageio
9
+
10
+
11
+ app = dash .Dash (__name__ )
12
+ server = app .server
13
+
14
+ vol = imageio .volread ("imageio:stent.npz" )
15
+ slicer1 = VolumeSlicer (app , vol , axis = 1 )
16
+ slicer2 = VolumeSlicer (app , vol , axis = 2 )
17
+
18
+ app .layout = html .Div (
19
+ style = {
20
+ "display" : "grid" ,
21
+ "gridTemplateColumns" : "40% 40%" ,
22
+ },
23
+ children = [
24
+ html .Div (
25
+ [
26
+ html .H1 ("Coronal" ),
27
+ slicer1 .graph ,
28
+ html .Br (),
29
+ slicer1 .slider ,
30
+ * slicer1 .stores ,
31
+ ]
32
+ ),
33
+ html .Div (
34
+ [
35
+ html .H1 ("Sagittal" ),
36
+ slicer2 .graph ,
37
+ html .Br (),
38
+ slicer2 .slider ,
39
+ * slicer2 .stores ,
40
+ ]
41
+ ),
42
+ ],
43
+ )
44
+
45
+
46
+ if __name__ == "__main__" :
47
+ app .run_server (debug = True )
Original file line number Diff line number Diff line change
1
+ import shutil
2
+ import subprocess
3
+
4
+ # Install dash-slicer from dev version
5
+ subprocess .run ("python -m pip install -e ." .split (" " ))
6
+ # Use requirements of app
7
+ shutil .copy ("test_deploy/requirements.txt" , "requirements.txt" )
8
+ subprocess .run ("python -m pip install -r requirements.txt" .split (" " ))
Original file line number Diff line number Diff line change
1
+ pillow
2
+ numpy
3
+ plotly
4
+ dash
5
+ dash_core_components
6
+ imageio
7
+ gunicorn
You can’t perform that action at this time.
0 commit comments