Skip to content

Commit

Permalink
Merge pull request #482 from oist/develop-main
Browse files Browse the repository at this point in the history
import develop-main
  • Loading branch information
ReiHashimoto authored May 8, 2023
2 parents 40bd530 + 5488cc2 commit 3ab617b
Show file tree
Hide file tree
Showing 196 changed files with 4,499 additions and 2,718 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Python Linters
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'notebooks/**'
- 'frontend/**'
- 'sample_data/**'

jobs:
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- run: python -m pip install flake8
- uses: liskin/gh-problem-matcher-wrap@d8afa2cfb66dd3f982b1950429e652bc14d0d7d2
with:
linters: flake8
run: flake8
isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- run: python -m pip install isort
- uses: liskin/gh-problem-matcher-wrap@d8afa2cfb66dd3f982b1950429e652bc14d0d7d2
with:
linters: isort
run: isort --check --diff optinist
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__
.ipynb_checkpoints
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
dist
/build
optinist/frontend
Expand Down
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort"
]
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,16 @@
"frontend/build/**": true,
"build/**": true
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"esbonio.sphinx.confDir": ""
}
67 changes: 34 additions & 33 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import os
import sys
from datetime import datetime
sys.path.insert(0, os.path.abspath('../'))
from optinist.version import VERSION, VERSION_SHORT

sys.path.insert(0, os.path.abspath("../"))
from optinist.version import VERSION, VERSION_SHORT # noqa: E402

# -- Path setup --------------------------------------------------------------

Expand All @@ -20,17 +21,17 @@

# -- Project information -----------------------------------------------------

project = 'OptiNiSt'
project = "OptiNiSt"
copyright = f"{datetime.today().year}, OIST"
author = ''
author = ""
version = VERSION_SHORT
release = VERSION

# -- readthedocs -------------------------------------------------------------
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

# -- General configuration ---------------------------------------------------
master_doc = 'index'
master_doc = "index"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand All @@ -40,15 +41,15 @@
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
'sphinx.ext.napoleon',
'sphinx.ext.coverage',
'sphinxcontrib.apidoc',
'sphinx_autodoc_typehints',
'myst_parser',
'sphinx.ext.autosectionlabel',
'sphinx.ext.autosummary',
'sphinx.ext.extlinks',
'sphinx.ext.autodoc.typehints'
"sphinx.ext.napoleon",
"sphinx.ext.coverage",
"sphinxcontrib.apidoc",
"sphinx_autodoc_typehints",
"myst_parser",
"sphinx.ext.autosectionlabel",
"sphinx.ext.autosummary",
"sphinx.ext.extlinks",
"sphinx.ext.autodoc.typehints",
]

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

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

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

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

Expand All @@ -71,31 +72,31 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

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

# disable document page source link
html_show_sourcelink = False

autosummary_generate = True

html_theme_options = {
'canonical_url': '',
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'top',
'style_external_links': False,
'style_nav_header_background': '#C3EBE1',
"canonical_url": "",
"logo_only": False,
"display_version": True,
"prev_next_buttons_location": "top",
"style_external_links": False,
"style_nav_header_background": "#C3EBE1",
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False,
}
"collapse_navigation": True,
"sticky_navigation": True,
"navigation_depth": 4,
"includehidden": True,
"titles_only": False,
}
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
contain the root `toctree` directive.
OptiNiSt - Calcium Imaging Pipeline Tool
===================================
==========================================

**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.

Expand Down
2 changes: 1 addition & 1 deletion docs/installation/docker_for_developer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Docker for Developer (recommended)
Docker for Developer
=================

```{contents}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Linux for Developer (recommended)
Each Platforms for Developer
=================

```{contents}
Expand All @@ -15,9 +15,15 @@ Please follow instructions below.

### Install Tools

#### Install Anaconda

Install [Anaconda for Windows](https://www.anaconda.com/products/individual)
- Unix-like platforms
- Linux
- [Install Tools](linux.md#install-tools)
- Windows WSL
- [Install Tools](windows.md#install-tools-1)
- Mac
- [Install Tools](mac.md#install-tools)
- Windows
- [Install Tools](windows.md#install-tools)

### Clone repository

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

```
conda create -n optinist python=3.8
conda activate optinist
conda create -n optinist_dev python=3.8
conda activate optinist_dev
```

```
conda config --set channel_priority strict
```

### Install requirements
Expand All @@ -42,12 +52,12 @@ pip install -r requirements.txt
### Set saving directory

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.
```bash
```
export OPTINIST_DIR="your_saving_dir"
```

<!--
## 2. Create virtualenv
### 2. Create virtualenv
Under maintenance...
-->
Expand Down
118 changes: 118 additions & 0 deletions docs/installation/each_platforms_for_developer_use_mamba.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
Each Platforms for Developer (Use Mamba)
=================

```{contents}
:depth: 4
```

## Installation

We introduce how to install optinist for developer.
We have developed optinist python(backend) and typescript(frontend), so you need to make both environment.
Please follow instructions below.

## 1. Make backend environment

### Install Tools

- Unix-like platforms
- Linux
- [Install Tools](linux.md#install-tools)
- Windows WSL
- [Install Tools](windows.md#install-tools-1)
- Mac
- [Install Tools](mac.md#install-tools)
- Windows
- *Under construction.

#### Install Mamba

- Unix-like platforms
- https://mamba.readthedocs.io/en/latest/installation.html
- Use Mambaforge
- https://github.com/conda-forge/miniforge#mambaforge
- Install
- for Linux
```
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-$(uname)-$(uname -m).sh
# restart shell, and check mamba installed. (show version)
mamba --version
```
- for Mac (fixed with x86_64)
```
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-x86_64.sh"
bash Mambaforge-$(uname)-x86_64.sh
# restart shell, and check mamba installed. (show version)
mamba --version
```
- Windows
- *Under construction.
### Clone repository
```
git clone https://github.com/oist/optinist.git
cd ./optinist
```
### Create mamba(anaconda) environment
<!--
mamba create -c conda-forge -c bioconda -n optinist_dev python=3.8 snakemake
-->
```
mamba create -n optinist_dev python=3.8
conda activate optinist_dev
```
```
conda config --set channel_priority strict
```
- Note:
- If mamba is already installed, snakamake prefers to use mamba over conda.
### Install requirements
```
pip install -r requirements.txt
```
### Set saving directory
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.
```
export OPTINIST_DIR="your_saving_dir"
```
<!--
## 2. Create virtualenv
Under maintenance...
-->
## 2. Run backend
```
python main.py
```
- `python main.py` log is as blow:
```
$ run_optinist
INFO: Will watch for changes in these directories: ['/home/oist/optinist/backend']
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: Started reloader process [6520] using statreload
INFO: Started server process [6557]
INFO: Waiting for application startup.
INFO: Application startup complete.
```
- Launch browser, and go to http://localhost:8000
It opens correctly!
Done!
5 changes: 2 additions & 3 deletions docs/installation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ Installation
:caption: Installation (for Developer)

docker_for_developer
linux_for_developer
windows_for_developer
mac_for_developer
each_platforms_for_developer
.. each_platforms_for_developer_use_mamba
Loading

0 comments on commit 3ab617b

Please sign in to comment.