Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace setuptools to poetry #132

Merged
merged 6 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- .:/app
ports:
- "127.0.0.1:8000:8000"
command: python main.py --reload --host 0.0.0.0 --port 8000
command: bash -c "poetry install --no-root --with dev && poetry run python main.py --reload --host 0.0.0.0 --port 8000"
environment:
PYTHONPATH: /app/
TZ: Asia/Tokyo
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ services:
environment:
PYTHONPATH: .
TZ: Asia/Tokyo
command: bash -c "poetry install --no-root --with test && poetry run python3 -m pytest -s ."
volumes:
- ./studio:/app/studio
- ./conda/yaml:/app/conda/yaml
- ./studio/test_data:/tmp/studio
- ./frontend/build:/app/frontend/build
- .:/app

test_studio_frontend:
image: test_studio_frontend
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- ../optinist-docker-volumes/studio_data/:/app/studio_data
ports:
- "127.0.0.1:8000:8000"
command: python main.py --host 0.0.0.0 --port 8000
command: poetry run python main.py --host 0.0.0.0 --port 8000
environment:
PYTHONPATH: /app/
TZ: Asia/Tokyo
Expand Down
5 changes: 1 addition & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import os
from datetime import datetime

from sphinx_pyproject import SphinxConfig

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

# If extensions (or modules to document with autodoc) are in another directory,
Expand All @@ -18,11 +16,10 @@


# -- Project information -----------------------------------------------------
config = SphinxConfig("../pyproject.toml", globalns=globals())
project = "OptiNiSt"
copyright = f"{datetime.today().year}, OIST"
author = ""
release = ".".join(config.version.split(".")[:2])
release = "1.0.1"

# -- readthedocs -------------------------------------------------------------
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
Expand Down
4 changes: 2 additions & 2 deletions docs/installation/each_platforms_for_developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cd ./optinist
### Create anaconda environment

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

Expand All @@ -60,7 +60,7 @@ conda config --set channel_priority strict
### Install requirements

```
pip install -e '.[dev]'
poetry install --no-root --with dev
```

If you will make PRs, please see the [](Contributing) section.
Expand Down
4 changes: 2 additions & 2 deletions docs/installation/each_platforms_for_developer_use_mamba.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ mamba create -c conda-forge -c bioconda -n optinist_dev python=3.8 snakemake
-->

```
mamba create -n optinist_dev python=3.8
mamba create -n optinist_dev python=3.8 poetry
conda activate optinist_dev
```

Expand All @@ -93,7 +93,7 @@ conda config --set channel_priority strict
### Install requirements

```
pip install -e '.[dev]'
poetry install --no-root --with dev
```

### Set saving directory
Expand Down
2 changes: 0 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ sphinx-autodoc-typehints
sphinx-copybutton==0.5.2
sphinx-autobuild==2021.3.14
myst-parser
sphinx-pyproject
pre-commit
4,412 changes: 4,412 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

180 changes: 86 additions & 94 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
[tool.poetry]
name = "optinist"
description = "Calcium Imaging Pipeline Tool"
version = "1.0.1"
license = "GPL-3.0"
authors = ["OIST <email@example.com>"]
readme = "README.md"
requires-python = "==3.8.*"
license = {file = "LICENSE"}
authors = [
{name = "OIST"},
]
classifiers=[
documentation = "https://optinist.readthedocs.io"
repository = "https://github.com/oist/optinist"
keywords = ["optinist"]
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
Expand All @@ -24,102 +20,98 @@ classifiers=[
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
]
dependencies = [
"fastapi==0.99.*",
"uvicorn==0.22.*",
"numpy>=1.23,<1.26",
"aiofiles",
"tqdm",
"pyyaml",
"imageio",
"tifffile",
"python-multipart",
"future",
"pynwb==2.2.0",
"psutil",
"nbstripout",
"snakemake>=7.24,<7.31",
"jinja2==3.1.*",
"httpx",
"firebase_admin",
"pyrebase4==4.7.1",
"pydantic[email]",
"pydantic[dotenv]",
"python-jose[cryptography]",
"alembic==1.9.2",
"sqlmodel==0.0.8",
"pymysql==1.0.2",
"fastapi_pagination==0.12.5",
"plotly==5.15.0",
"kaleido==0.2.1",
"filelock",
]
packages = [{ include = "studio" }]

[project.optional-dependencies]
dev = [
"black",
"flake8==6.1.*",
"isort",
"build",
"twine",
"pre-commit",
"codespell",
]
doc = [
"sphinx==7.1.2",
"sphinxcontrib-apidoc",
"sphinx_rtd_theme",
"sphinx-prompt",
"sphinx-pyproject",
"sphinx-autodoc-typehints",
"sphinx-copybutton==0.5.2",
"sphinx-autobuild==2021.3.14",
"myst-parser",
]
test = [
"pytest",
"pytest-env",
include = [
"frontend/build/*",
"frontend/build/static/*",
"frontend/build/static/css/*",
"frontend/build/static/js/*",
"frontend/build/static/media/*",
"studio/app/optinist/core/nwb/nwb.yaml",
"studio/app/common/core/snakemake/snakemake.yaml",
"studio/app/*/wrappers/**/*.yaml",
"studio/app/Snakefile",
"studio/config/*.yaml",
]
exclude = ["studio/tests/*", "conda.env.*"]

[project.urls]
Documentation = "https://optinist.readthedocs.io"
Repository = "https://github.com/oist/optinist"
[tool.poetry.dependencies]
python = "^3.8.1"
fastapi = "0.99.*"
uvicorn = "0.22.*"
numpy = { version = ">=1.23, <1.26" }
aiofiles = "*"
tqdm = "*"
pyyaml = "*"
imageio = "*"
tifffile = "*"
python-multipart = "*"
future = "*"
pynwb = "2.2.0"
psutil = "*"
nbstripout = "*"
snakemake = { version = ">=7.24, <7.31" }
jinja2 = "3.1.*"
httpx = "*"
firebase_admin = "*"
pyrebase4 = "4.7.1"
pydantic = { version = "1.10.13", extras = ["email", "dotenv"] }
python-jose = { version = "*", extras = ["cryptography"] }
alembic = "1.9.2"
sqlmodel = "0.0.8"
pymysql = "1.0.2"
fastapi_pagination = "0.12.5"
plotly = "5.15.0"
kaleido = "0.2.1"
filelock = "*"
ruamel-yaml = "^0.18.5"

[project.scripts]
run_optinist = "studio.__main__:main"
[tool.poetry.group.dev]
optional = true

[tool.setuptools]
include-package-data = true
zip-safe = false
py-modules = ["Snakefile"]
[tool.poetry.group.dev.dependencies]
black = "*"
flake8 = "6.1.*"
isort = "*"
build = "<0.11.0,>=0.10.0"
twine = "*"
pre-commit = "*"
codespell = "*"

[tool.setuptools.packages.find]
exclude = ["studio.tests.*", "conda.env.*"]
[tool.poetry.group.doc]
optional = true

[tool.setuptools.package-data]
frontend = [
"build/*",
"build/static/*",
"build/static/css/*",
"build/static/js/*",
"build/static/media/*",
]
studio = [
"app/optinist/core/nwb/nwb.yaml",
"app/common/core/snakemake/snakemake.yaml",
"app/*/wrappers/**/*.yaml",
"app/Snakefile",
"config/*.yaml",
]
[tool.poetry.group.doc.dependencies]
sphinx = "7.1.2"
sphinxcontrib-apidoc = "*"
sphinx-rtd-theme = "*"
sphinx-prompt = "*"
sphinx-autodoc-typehints = "*"
sphinx-copybutton = "0.5.2"
sphinx-autobuild = "2021.3.14"
myst-parser = "*"

[tool.poetry.group.test]
optional = true

[tool.poetry.group.test.dependencies]
pytest = "*"
pytest-env = "*"

[tool.poetry.scripts]
run_optinist = "studio.__main__:main"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.isort]
profile = "black"

[tool.pytest.ini_options]
pythonpath = "."
env = [
"OPTINIST_DIR=studio/test_data",
]
env = ["OPTINIST_DIR=studio/test_data"]

[tool.codespell]
skip = './frontend/build,./frontend/node_modules,./docs/_build,*.lock,*log,*.egg-info'
Expand Down
10 changes: 7 additions & 3 deletions studio/config/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ RUN mkdir -p /root/miniconda3 && \
ENV PATH $PATH:/root/miniconda3/bin

COPY frontend/build /app/frontend/build
COPY studio /app/studio
COPY main.py pyproject.toml ./

RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -e .
pip3 install poetry

COPY main.py pyproject.toml poetry.lock ./

RUN poetry install --no-root

COPY studio /app/studio

RUN echo 'alias ll="ls -la"' >> ~/.bashrc
RUN echo 'set nu ic hls nowrap ts=4 sw=4 | syntax on' >> ~/.vimrc
Expand Down
6 changes: 3 additions & 3 deletions studio/config/docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ RUN mkdir -p /root/miniconda3 && \

ENV PATH $PATH:/root/miniconda3/bin

COPY pyproject.toml .

RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -e '.[dev]'
pip3 install poetry

COPY pyproject.toml poetry.lock ./

RUN echo 'alias ll="ls -la"' >> ~/.bashrc
RUN echo 'set nu ic hls nowrap ts=4 sw=4 | syntax on' >> ~/.vimrc
Expand Down
6 changes: 3 additions & 3 deletions studio/config/docker/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ RUN apt-get --allow-releaseinfo-change update && \
apt-get install --no-install-recommends -y git gcc g++ libgl1 && \
apt-get purge git -y && apt-get autoremove -y && apt-get clean

COPY pyproject.toml .

RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -e '.[test]'
pip3 install poetry

ENTRYPOINT ["python3", "-m", "pytest", "-s", "."]
COPY pyproject.toml poetry.lock ./