Skip to content
Snippets Groups Projects
Commit b4280853 authored by Alán Muñoz's avatar Alán Muñoz
Browse files

style(precommit): apply precommit changes and tomlock

parent 3522485d
No related branches found
No related tags found
No related merge requests found
.flake8 0 → 100644
[flake8]
ignore = E203, E266, E501, W503, F403, F401
max-line-length = 79
select = B,C,E,F,W,T4,B9
exclude =
# No need to traverse our git directory
.git,
# There's no value in checking cache directories
__pycache__,
# Ignore virtual environment contents
.venv
# The conf file is mostly autogenerated, ignore it
docs/source/conf.py,
# The old directory contains Flake8 2.0
old,
# This contains our built documentation
build,
# This contains builds of flake8 that we don't want to check
dist,
# Any data produced inside the folder during development
data/,
# Temporarily ignore tests
tests/
max-complexity = 18
...@@ -4,9 +4,8 @@ cache: ...@@ -4,9 +4,8 @@ cache:
key: "project-${CI_JOB_NAME}" key: "project-${CI_JOB_NAME}"
paths: paths:
- .venv - .venv
key: files:
files: - poetry.lock
- poetry.lock
variables: variables:
TRIGGER_PYPI_NAME: "" TRIGGER_PYPI_NAME: ""
......
...@@ -22,4 +22,3 @@ it's very hard to read otherwise.) ...@@ -22,4 +22,3 @@ it's very hard to read otherwise.)
## Possible fixes ## Possible fixes
(If you can, link to the line of code that might be responsible for the problem) (If you can, link to the line of code that might be responsible for the problem)
...@@ -12,14 +12,14 @@ See [INSTALL.md](./INSTALL.md) for installation instructions. ...@@ -12,14 +12,14 @@ See [INSTALL.md](./INSTALL.md) for installation instructions.
## Quickstart Documentation ## Quickstart Documentation
### Setting up a server ### Setting up a server
For testing and development, the easiest way to set up an OMERO server is by For testing and development, the easiest way to set up an OMERO server is by
using Docker images. using Docker images.
[The software carpentry](https://software-carpentry.org/) and the [Open [The software carpentry](https://software-carpentry.org/) and the [Open
Microscopy Environment](https://www.openmicroscopy.org), have provided Microscopy Environment](https://www.openmicroscopy.org), have provided
[instructions](https://ome.github.io/training-docker/) to do this. [instructions](https://ome.github.io/training-docker/) to do this.
The `docker-compose.yml` file can be used to create an OMERO server with an The `docker-compose.yml` file can be used to create an OMERO server with an
accompanying PostgreSQL database, and an OMERO web server. accompanying PostgreSQL database, and an OMERO web server.
It is described in detail It is described in detail
[here](https://ome.github.io/training-docker/12-dockercompose/). [here](https://ome.github.io/training-docker/12-dockercompose/).
Our version of the `docker-compose.yml` has been adapted from the above to Our version of the `docker-compose.yml` has been adapted from the above to
...@@ -59,7 +59,7 @@ with Image(list(image_ids.values())[0], **server_info) as image: ...@@ -59,7 +59,7 @@ with Image(list(image_ids.values())[0], **server_info) as image:
imgs = dimg[tps, image.metadata["channels"].index("Brightfield"), 2, ...].compute() imgs = dimg[tps, image.metadata["channels"].index("Brightfield"), 2, ...].compute()
# tps timepoints, Brightfield channel, z=2, all x,y # tps timepoints, Brightfield channel, z=2, all x,y
``` ```
### Tiling the raw data ### Tiling the raw data
A `Tiler` object performs trap registration. It may be built in different ways but the simplest one is using an image and a the default parameters set. A `Tiler` object performs trap registration. It may be built in different ways but the simplest one is using an image and a the default parameters set.
...@@ -72,7 +72,7 @@ with Image(list(image_ids.values())[0], **server_info) as image: ...@@ -72,7 +72,7 @@ with Image(list(image_ids.values())[0], **server_info) as image:
``` ```
The initialisation should take a few seconds, as it needs to align the images The initialisation should take a few seconds, as it needs to align the images
in time. in time.
It fetches the metadata from the Image object, and uses the TilerParameters values (all Processes in aliby depend on an associated Parameters class, which is in essence a dictionary turned into a class.) It fetches the metadata from the Image object, and uses the TilerParameters values (all Processes in aliby depend on an associated Parameters class, which is in essence a dictionary turned into a class.)
...@@ -97,7 +97,7 @@ seg_expt.channels # Get a list of channels ...@@ -97,7 +97,7 @@ seg_expt.channels # Get a list of channels
channel = 'Brightfield' channel = 'Brightfield'
ch_id = seg_expt.get_channel_index(channel) ch_id = seg_expt.get_channel_index(channel)
n_traps = seg_expt.n_traps # Get the number of traps n_traps = seg_expt.n_traps # Get the number of traps
``` ```
#### Get the traps for a given time point #### Get the traps for a given time point
...@@ -105,7 +105,7 @@ Alternatively, if you want to get all the traps at a given timepoint: ...@@ -105,7 +105,7 @@ Alternatively, if you want to get all the traps at a given timepoint:
```python ```python
timepoint = 0 timepoint = 0
seg_expt.get_traps_timepoints(timepoint, tile_size=96, channels=None, seg_expt.get_traps_timepoints(timepoint, tile_size=96, channels=None,
z=[0,1,2,3,4]) z=[0,1,2,3,4])
``` ```
......
#!/usr/bin/env python3 #!/usr/bin/env python3
import shutil import shutil
from typing import Union
from pathlib import Path, PosixPath from pathlib import Path, PosixPath
from typing import Union
import omero import omero
from aliby.io.omero import Argo
from aliby.io.image import ImageLocal from aliby.io.image import ImageLocal
from aliby.io.omero import Argo
class DatasetLocal: class DatasetLocal:
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
Pipeline and chaining elements. Pipeline and chaining elements.
""" """
import logging import logging
import typing as t
import os import os
import re import re
import traceback import traceback
import typing as t
from copy import copy from copy import copy
from itertools import groupby from itertools import groupby
from pathlib import Path, PosixPath from pathlib import Path, PosixPath
......
# Installation # Installation
Tested on: Mac OSX Mojave and Ubuntu 20.04 Tested on: Mac OSX Mojave and Ubuntu 20.04
## Requirements ## Requirements
We strongly recommend installing within a python environment as there are many dependencies that you may not want polluting your regular python environment. We strongly recommend installing within a python environment as there are many dependencies that you may not want polluting your regular python environment.
Make sure you are using python 3. Make sure you are using python 3.
An environment can be created with using the conda package manager: An environment can be created with using the conda package manager:
...@@ -11,25 +11,25 @@ An environment can be created with using the conda package manager: ...@@ -11,25 +11,25 @@ An environment can be created with using the conda package manager:
$ conda create --name <env> $ conda create --name <env>
$ conda activate <env> $ conda activate <env>
Which you can deactivate with: Which you can deactivate with:
$ conda deactivate $ conda deactivate
Or using virtualenv: Or using virtualenv:
$ python -m virtualenv /path/to/venv/ $ python -m virtualenv /path/to/venv/
$ source /path/to/venv/bin/activate $ source /path/to/venv/bin/activate
This will download all of your packages under `/path/to/venv` and then activate it. This will download all of your packages under `/path/to/venv` and then activate it.
Deactivate using Deactivate using
$ deactivate $ deactivate
You will also need to make sure you have a recent version of pip. You will also need to make sure you have a recent version of pip.
In your local environment, run: In your local environment, run:
$ pip install --upgrade pip $ pip install --upgrade pip
Or using [pyenv](https://github.com/pyenv/pyenv) with pyenv-virtualenv: Or using [pyenv](https://github.com/pyenv/pyenv) with pyenv-virtualenv:
$ pyenv install 3.7.9 $ pyenv install 3.7.9
...@@ -48,7 +48,7 @@ Once you have created your local environment, run: ...@@ -48,7 +48,7 @@ Once you have created your local environment, run:
### Git version ### Git version
We use [ poetry ](https://python-poetry.org/docs/#installation) for dependency management. We use [ poetry ](https://python-poetry.org/docs/#installation) for dependency management.
In case you want to have local versions (usually for development) the main three aliby dependencies you must install them in a specific order: In case you want to have local versions (usually for development) the main three aliby dependencies you must install them in a specific order:
......
...@@ -12,4 +12,3 @@ ...@@ -12,4 +12,3 @@
.. include:: ../../README.md .. include:: ../../README.md
:parser: myst_parser.sphinx_ :parser: myst_parser.sphinx_
from inspect import getmembers, isfunction, getfullargspec from inspect import getfullargspec, getmembers, isfunction
import numpy as np import numpy as np
......
import matplotlib.pyplot as plt
from core.experiment import Experiment from core.experiment import Experiment
from core.segment import Tiler from core.segment import Tiler
import matplotlib.pyplot as plt
expt = Experiment.from_source( expt = Experiment.from_source(
19310, # Experiment ID on OMERO 19310, # Experiment ID on OMERO
......
This diff is collapsed.
[tool.poetry] [tool.poetry]
name = "aliby" name = "aliby"
version = "0.1.35" version = "0.1.36"
description = "Process and analyse live-cell imaging data" description = "Process and analyse live-cell imaging data"
authors = ["Alan Munoz <alan.munoz@ed.ac.uk>"] authors = ["Alan Munoz <alan.munoz@ed.ac.uk>"]
packages = [ packages = [
...@@ -32,16 +32,18 @@ xmltodict = "^0.13.0" # read ome-tiff metadata ...@@ -32,16 +32,18 @@ xmltodict = "^0.13.0" # read ome-tiff metadata
zeroc-ice = {version="3.6.5"} # networking interface, slow to build zeroc-ice = {version="3.6.5"} # networking interface, slow to build
# zeroc-ice = {version="3.6.5", optional=true} # To be set as optional in the future # zeroc-ice = {version="3.6.5", optional=true} # To be set as optional in the future
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
black = "^22.3.0" black = "^22.6.0"
Sphinx = "^4.3.2" Sphinx = "^4.3.2"
pytest = "^6.2.5" pytest = "^6.2.5"
mypy = "^0.930" mypy = "^0.930"
numpydoc = "^1.3.1" numpydoc = "^1.3.1"
pyflakes = "^2.4.0"
isort = "^5.10.1" isort = "^5.10.1"
jupyter = "^1.0.0" jupyter = "^1.0.0"
flake8 = "^4.0.1"
pyright = "^1.1.258"
pre-commit = "^2.20.0"
data-science-types = "^0.2.23"
[build-system] [build-system]
requires = ["setuptools", "poetry-core>=1.0.0"] requires = ["setuptools", "poetry-core>=1.0.0"]
...@@ -52,12 +54,21 @@ line-length = 79 ...@@ -52,12 +54,21 @@ line-length = 79
target-version = ['py37'] target-version = ['py37']
include = '\.pyi?$' include = '\.pyi?$'
extend-exclude = ''' extend-exclude = '''
# A regex preceded with ^/ will apply only to files and directories /(
# in the root of the project. \.git
^/foo.py # exclude a file named foo.py in the root of the project (in addition to the defaults) | \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
''' '''
[tool.isort] [tool.isort]
profile = "black"
multi_line_output = 3 multi_line_output = 3
line_length = 79 line_length = 79
include_trailing_comma = true include_trailing_comma = true
from setuptools import setup, find_packages from setuptools import find_packages, setup
print("find_packages outputs ", find_packages("aliby")) print("find_packages outputs ", find_packages("aliby"))
setup( setup(
......
import pytest
import unittest import unittest
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import pytest
import skimage.morphology as morph import skimage.morphology as morph
from scipy import ndimage from scipy import ndimage
from skimage import draw from skimage import draw
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment