Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Sep 6, 2024
0 parents commit 52a2a2d
Show file tree
Hide file tree
Showing 71 changed files with 1,171 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Do not edit - changes here will be overwritten by Copier
_commit: 0.4.0
_src_path: gh:fractal-analytics-platform/fractal-tasks-template
author_email: [email protected]
author_name: Lorenzo Cerrone
package_name: ilastik_tasks
project_name: ilastik-tasks
project_short_description: Package description.
project_url: ''

52 changes: 52 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI (build and test)

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]


jobs:
tests:
strategy:
matrix:
os: [ubuntu-22.04, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
exclude:
- os: macos-latest
python-version: '3.9'
- os: macos-latest
python-version: '3.10'
name: "Core, Python ${{ matrix.python-version }}, ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install package
run: python -m pip install -e .[dev]

- name: Regenerate the manifest
run: python src/ilastik_tasks/dev/create_manifest.py

- name: Check if manifest has changed
run: |
if [ -n "$(git diff --exit-code ./src/ilastik_tasks/__FRACTAL_MANIFEST__.json)" ]; then
echo "__FRACTAL_MANIFEST__.json has changed. Please run 'python src/ilastik_tasks/dev/create_manifest.py' and commit the changes."
exit 1
else
echo "__FRACTAL_MANIFEST__.json has not changed."
fi
- name: Test core library with pytest
run: python -m pytest tests
112 changes: 112 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Git ignored is sourced from https://github.com/pydev-guide/pyrepo-copier/blob/main/LICENSE
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

.DS_Store

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# ruff
.ruff_cache/

# IDE settings
.vscode/
.idea/
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# enable pre-commit.ci at https://pre-commit.ci/

repos:
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
hooks:
- id: validate-pyproject

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.5.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2023, Lorenzo Cerrone

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ilastik-tasks

Package description.

## Development instructions

Specific instructions on how to install your package, managing your environment, versioning and more can be found in the [DEVELOPERS_GUIDE](https://github.com/fractal-analytics-platform/fractal-tasks-template/blob/main/DEVELOPERS_GUIDE.md).
78 changes: 78 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# https://peps.python.org/pep-0517/
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

# https://hatch.pypa.io/latest/config/metadata/
[tool.hatch.version]
#path = "src/ilastik_tasks/__init__.py"
source = "vcs"

# read more about configuring hatch at:
# https://hatch.pypa.io/latest/config/build/
[tool.hatch.build.targets.wheel]
only-include = ["src"]
sources = ["src"]

# Always include the __FRACTAL_MANIFEST__.json file in the package
[tool.hatch.build]
include = ["__FRACTAL_MANIFEST__.json"]


# Project metadata (see https://peps.python.org/pep-0621)
[project]
name = "ilastik-tasks"
dynamic = ["version"]
description = "Package description."
readme = "README.md"
license = { text = "BSD-3-Clause" }
authors = [
{ name = "Lorenzo Cerrone", email = "[email protected]" },
]

# Required Python version and dependencies
requires-python = ">=3.9"
dependencies = ["fractal-tasks-core == 1.3.0", "scikit-image"]

# Optional dependencies (e.g. for `pip install -e ".[dev]"`, see
# https://peps.python.org/pep-0621/#dependencies-optional-dependencies)
[project.optional-dependencies]
dev = ["devtools", "hatch", "pytest", "requests", "jsonschema", "ruff", "pre-commit"]

# https://docs.astral.sh/ruff
[tool.ruff]
line-length = 88
target-version = "py39"
src = ["src"]

# https://docs.astral.sh/ruff/rules
[tool.ruff.lint]
pydocstyle = { convention = "google" }
select = [
"E", # style errors
"W", # style warnings
"F", # flakes
"D", # pydocstyle
"D417", # Missing argument descriptions in Docstrings
"I", # isort
"UP", # pyupgrade
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"A001", # flake8-builtins
"RUF", # ruff-specific rules
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
]
ignore = [
"D401", # First line should be in imperative mood (remove to opt in)
"D415", # First line should end with a period (remove to opt in)
]

[tool.ruff.lint.per-file-ignores]
"tests/*.py" = ["D", "S"]

# https://docs.astral.sh/ruff/formatter/
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 89
skip-magic-trailing-comma = false # default is false
79 changes: 79 additions & 0 deletions src/ilastik_tasks/__FRACTAL_MANIFEST__.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"manifest_version": "2",
"task_list": [
{
"name": "Thresholding Label Task",
"executable_parallel": "thresholding_label_task.py",
"meta_parallel": {
"cpus_per_task": 1,
"mem": 4000
},
"args_schema_parallel": {
"$defs": {
"ChannelInputModel": {
"description": "A channel which is specified by either `wavelength_id` or `label`.",
"properties": {
"wavelength_id": {
"title": "Wavelength Id",
"type": "string",
"description": "Unique ID for the channel wavelength, e.g. `A01_C01`. Can only be specified if label is not set."
},
"label": {
"title": "Label",
"type": "string",
"description": "Name of the channel. Can only be specified if wavelength_id is not set."
}
},
"title": "ChannelInputModel",
"type": "object"
}
},
"additionalProperties": false,
"properties": {
"zarr_url": {
"title": "Zarr Url",
"type": "string",
"description": "Absolute path to the OME-Zarr image."
},
"threshold": {
"title": "Threshold",
"type": "integer",
"description": "Threshold value to be applied."
},
"channel": {
"$ref": "#/$defs/ChannelInputModel",
"title": "Channel",
"description": "Channel to be thresholded."
},
"label_name": {
"title": "Label Name",
"type": "string",
"description": "Name of the resulting label image"
},
"min_size": {
"default": 50,
"title": "Min Size",
"type": "integer",
"description": "Minimum size of objects. Smaller objects are filtered out."
},
"overwrite": {
"default": true,
"title": "Overwrite",
"type": "boolean",
"description": "Whether to overwrite an existing label image"
}
},
"required": [
"zarr_url",
"threshold",
"channel"
],
"type": "object",
"title": "ThresholdingLabelTask"
},
"docs_info": "## thresholding_label_task\nThreshold an image and find connected components.\n"
}
],
"has_args_schemas": true,
"args_schema_version": "pydantic_v2"
}
Loading

0 comments on commit 52a2a2d

Please sign in to comment.