Skip to content

Commit 3ab617b

Browse files
authored
Merge pull request #482 from oist/develop-main
import develop-main
2 parents 40bd530 + 5488cc2 commit 3ab617b

File tree

196 files changed

+4499
-2718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+4499
-2718
lines changed

.github/workflows/linters.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Python Linters
2+
on:
3+
pull_request:
4+
paths-ignore:
5+
- 'docs/**'
6+
- 'notebooks/**'
7+
- 'frontend/**'
8+
- 'sample_data/**'
9+
10+
jobs:
11+
flake8:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.8'
18+
- run: python -m pip install flake8
19+
- uses: liskin/gh-problem-matcher-wrap@d8afa2cfb66dd3f982b1950429e652bc14d0d7d2
20+
with:
21+
linters: flake8
22+
run: flake8
23+
isort:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: actions/setup-python@v4
28+
with:
29+
python-version: '3.8'
30+
- run: python -m pip install isort
31+
- uses: liskin/gh-problem-matcher-wrap@d8afa2cfb66dd3f982b1950429e652bc14d0d7d2
32+
with:
33+
linters: isort
34+
run: isort --check --diff optinist
35+
black:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v3
39+
- uses: psf/black@stable

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ __pycache__
33
.ipynb_checkpoints
44
.vscode/*
55
!.vscode/settings.json
6+
!.vscode/extensions.json
67
dist
78
/build
89
optinist/frontend

.vscode/extensions.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"ms-python.black-formatter",
4+
"ms-python.flake8",
5+
"ms-python.isort"
6+
]
7+
}

.vscode/settings.json

+11
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,16 @@
33
"frontend/build/**": true,
44
"build/**": true
55
},
6+
"[python]": {
7+
"editor.defaultFormatter": "ms-python.black-formatter",
8+
"editor.formatOnSave": true,
9+
"editor.codeActionsOnSave": {
10+
"source.organizeImports": true
11+
}
12+
},
13+
"python.linting.enabled": true,
14+
"python.linting.lintOnSave": true,
15+
"python.linting.pylintEnabled": false,
16+
"python.linting.flake8Enabled": true,
617
"esbonio.sphinx.confDir": ""
718
}

docs/conf.py

+34-33
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
import os
88
import sys
99
from datetime import datetime
10-
sys.path.insert(0, os.path.abspath('../'))
11-
from optinist.version import VERSION, VERSION_SHORT
10+
11+
sys.path.insert(0, os.path.abspath("../"))
12+
from optinist.version import VERSION, VERSION_SHORT # noqa: E402
1213

1314
# -- Path setup --------------------------------------------------------------
1415

@@ -20,17 +21,17 @@
2021

2122
# -- Project information -----------------------------------------------------
2223

23-
project = 'OptiNiSt'
24+
project = "OptiNiSt"
2425
copyright = f"{datetime.today().year}, OIST"
25-
author = ''
26+
author = ""
2627
version = VERSION_SHORT
2728
release = VERSION
2829

2930
# -- readthedocs -------------------------------------------------------------
30-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
31+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
3132

3233
# -- General configuration ---------------------------------------------------
33-
master_doc = 'index'
34+
master_doc = "index"
3435

3536
# Add any Sphinx extension module names here, as strings. They can be
3637
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -40,15 +41,15 @@
4041
"sphinx.ext.intersphinx",
4142
"sphinx.ext.mathjax",
4243
"sphinx.ext.viewcode",
43-
'sphinx.ext.napoleon',
44-
'sphinx.ext.coverage',
45-
'sphinxcontrib.apidoc',
46-
'sphinx_autodoc_typehints',
47-
'myst_parser',
48-
'sphinx.ext.autosectionlabel',
49-
'sphinx.ext.autosummary',
50-
'sphinx.ext.extlinks',
51-
'sphinx.ext.autodoc.typehints'
44+
"sphinx.ext.napoleon",
45+
"sphinx.ext.coverage",
46+
"sphinxcontrib.apidoc",
47+
"sphinx_autodoc_typehints",
48+
"myst_parser",
49+
"sphinx.ext.autosectionlabel",
50+
"sphinx.ext.autosummary",
51+
"sphinx.ext.extlinks",
52+
"sphinx.ext.autodoc.typehints",
5253
]
5354

5455
# Tell myst-parser to assign header anchors for h1-h3.
@@ -57,12 +58,12 @@
5758
suppress_warnings = ["myst.header"]
5859

5960
# Add any paths that contain templates here, relative to this directory.
60-
templates_path = ['_templates']
61+
templates_path = ["_templates"]
6162

6263
# List of patterns, relative to source directory, that match files and
6364
# directories to ignore when looking for source files.
6465
# This pattern also affects html_static_path and html_extra_path.
65-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'tests', '*test*']
66+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "tests", "*test*"]
6667

6768
source_suffix = [".rst", ".md"]
6869

@@ -71,31 +72,31 @@
7172
# The theme to use for HTML and HTML Help pages. See the documentation for
7273
# a list of builtin themes.
7374
#
74-
html_theme = 'sphinx_rtd_theme'
75+
html_theme = "sphinx_rtd_theme"
7576

7677
# Add any paths that contain custom static files (such as style sheets) here,
7778
# relative to this directory. They are copied after the builtin static files,
7879
# so a file named "default.css" will overwrite the builtin "default.css".
79-
html_static_path = ['_static']
80-
html_logo = '_static/optinist.png'
81-
html_favicon = '_static/favicon.ico'
80+
html_static_path = ["_static"]
81+
html_logo = "_static/optinist.png"
82+
html_favicon = "_static/favicon.ico"
8283

8384
# disable document page source link
8485
html_show_sourcelink = False
8586

8687
autosummary_generate = True
8788

8889
html_theme_options = {
89-
'canonical_url': '',
90-
'logo_only': False,
91-
'display_version': True,
92-
'prev_next_buttons_location': 'top',
93-
'style_external_links': False,
94-
'style_nav_header_background': '#C3EBE1',
90+
"canonical_url": "",
91+
"logo_only": False,
92+
"display_version": True,
93+
"prev_next_buttons_location": "top",
94+
"style_external_links": False,
95+
"style_nav_header_background": "#C3EBE1",
9596
# Toc options
96-
'collapse_navigation': True,
97-
'sticky_navigation': True,
98-
'navigation_depth': 4,
99-
'includehidden': True,
100-
'titles_only': False,
101-
}
97+
"collapse_navigation": True,
98+
"sticky_navigation": True,
99+
"navigation_depth": 4,
100+
"includehidden": True,
101+
"titles_only": False,
102+
}

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
contain the root `toctree` directive.
55
66
OptiNiSt - Calcium Imaging Pipeline Tool
7-
===================================
7+
==========================================
88

99
**OptiNiSt(Optical Neuroimage Studio)** helps researchers try multiple data analysis methods, visualize the results, and construct the data analysis pipelines easily and quickly. OptiNiSt's data-saving format follows NWB standards.
1010

docs/installation/docker_for_developer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Docker for Developer (recommended)
1+
Docker for Developer
22
=================
33

44
```{contents}

docs/installation/linux_for_developer.md docs/installation/each_platforms_for_developer.md

+18-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Linux for Developer (recommended)
1+
Each Platforms for Developer
22
=================
33

44
```{contents}
@@ -15,9 +15,15 @@ Please follow instructions below.
1515

1616
### Install Tools
1717

18-
#### Install Anaconda
19-
20-
Install [Anaconda for Windows](https://www.anaconda.com/products/individual)
18+
- Unix-like platforms
19+
- Linux
20+
- [Install Tools](linux.md#install-tools)
21+
- Windows WSL
22+
- [Install Tools](windows.md#install-tools-1)
23+
- Mac
24+
- [Install Tools](mac.md#install-tools)
25+
- Windows
26+
- [Install Tools](windows.md#install-tools)
2127

2228
### Clone repository
2329

@@ -29,8 +35,12 @@ cd ./optinist
2935
### Create anaconda environment
3036

3137
```
32-
conda create -n optinist python=3.8
33-
conda activate optinist
38+
conda create -n optinist_dev python=3.8
39+
conda activate optinist_dev
40+
```
41+
42+
```
43+
conda config --set channel_priority strict
3444
```
3545

3646
### Install requirements
@@ -42,12 +52,12 @@ pip install -r requirements.txt
4252
### Set saving directory
4353

4454
Optinist default saving directory is `/tmp/optinist`. If you reboot your PC, this repogitory content is deleted. And setting the saving directory in environment path.
45-
```bash
55+
```
4656
export OPTINIST_DIR="your_saving_dir"
4757
```
4858

4959
<!--
50-
## 2. Create virtualenv
60+
### 2. Create virtualenv
5161
5262
Under maintenance...
5363
-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
Each Platforms for Developer (Use Mamba)
2+
=================
3+
4+
```{contents}
5+
:depth: 4
6+
```
7+
8+
## Installation
9+
10+
We introduce how to install optinist for developer.
11+
We have developed optinist python(backend) and typescript(frontend), so you need to make both environment.
12+
Please follow instructions below.
13+
14+
## 1. Make backend environment
15+
16+
### Install Tools
17+
18+
- Unix-like platforms
19+
- Linux
20+
- [Install Tools](linux.md#install-tools)
21+
- Windows WSL
22+
- [Install Tools](windows.md#install-tools-1)
23+
- Mac
24+
- [Install Tools](mac.md#install-tools)
25+
- Windows
26+
- *Under construction.
27+
28+
#### Install Mamba
29+
30+
- Unix-like platforms
31+
- https://mamba.readthedocs.io/en/latest/installation.html
32+
- Use Mambaforge
33+
- https://github.com/conda-forge/miniforge#mambaforge
34+
- Install
35+
- for Linux
36+
```
37+
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
38+
bash Mambaforge-$(uname)-$(uname -m).sh
39+
40+
# restart shell, and check mamba installed. (show version)
41+
mamba --version
42+
```
43+
- for Mac (fixed with x86_64)
44+
```
45+
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-x86_64.sh"
46+
bash Mambaforge-$(uname)-x86_64.sh
47+
48+
# restart shell, and check mamba installed. (show version)
49+
mamba --version
50+
```
51+
- Windows
52+
- *Under construction.
53+
54+
### Clone repository
55+
56+
```
57+
git clone https://github.com/oist/optinist.git
58+
cd ./optinist
59+
```
60+
61+
### Create mamba(anaconda) environment
62+
63+
<!--
64+
mamba create -c conda-forge -c bioconda -n optinist_dev python=3.8 snakemake
65+
-->
66+
67+
```
68+
mamba create -n optinist_dev python=3.8
69+
conda activate optinist_dev
70+
```
71+
72+
```
73+
conda config --set channel_priority strict
74+
```
75+
76+
- Note:
77+
- If mamba is already installed, snakamake prefers to use mamba over conda.
78+
79+
80+
### Install requirements
81+
82+
```
83+
pip install -r requirements.txt
84+
```
85+
86+
### Set saving directory
87+
88+
Optinist default saving directory is `/tmp/optinist`. If you reboot your PC, this repogitory content is deleted. And setting the saving directory in environment path.
89+
```
90+
export OPTINIST_DIR="your_saving_dir"
91+
```
92+
93+
<!--
94+
## 2. Create virtualenv
95+
96+
Under maintenance...
97+
-->
98+
99+
## 2. Run backend
100+
101+
```
102+
python main.py
103+
```
104+
- `python main.py` log is as blow:
105+
```
106+
$ run_optinist
107+
INFO: Will watch for changes in these directories: ['/home/oist/optinist/backend']
108+
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
109+
INFO: Started reloader process [6520] using statreload
110+
INFO: Started server process [6557]
111+
INFO: Waiting for application startup.
112+
INFO: Application startup complete.
113+
```
114+
- Launch browser, and go to http://localhost:8000
115+
116+
It opens correctly!
117+
118+
Done!

docs/installation/index.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ Installation
1616
:caption: Installation (for Developer)
1717

1818
docker_for_developer
19-
linux_for_developer
20-
windows_for_developer
21-
mac_for_developer
19+
each_platforms_for_developer
20+
.. each_platforms_for_developer_use_mamba

0 commit comments

Comments
 (0)