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

Add task metadata & update template #1

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Do not edit - changes here will be overwritten by Copier
_commit: v0.3.0
_commit: v0.4.2
_src_path: gh:fractal-analytics-platform/fractal-tasks-template
author_email: [email protected]
author_name: Lorenzo Cerrone
package_name: plantseg_tasks
project_name: fractal-plantseg-tasks
project_short_description: Package description.
project_url: ''
project_short_description: A collection of fractal tasks to run plantseg workflows.
project_url: https://github.com/fractal-analytics-platform/fractal-plantseg-tasks

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

# on:
# push:
# branches: ["main"]
# tags:
# - "*"
# 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/plantseg_tasks/dev/create_manifest.py

# - name: Check if manifest has changed
# run: |
# if [ -n "$(git diff --exit-code ./src/plantseg_tasks/__FRACTAL_MANIFEST__.json)" ]; then
# echo "__FRACTAL_MANIFEST__.json has changed. Please run 'python src/plantseg_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

# deploy:
# name: Deploy
# needs: tests
# if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
# runs-on: ubuntu-latest

# permissions:
# # IMPORTANT: this permission is mandatory for trusted publishing on PyPi
# # see https://docs.pypi.org/trusted-publishers/
# id-token: write
# # This permission allows writing releases
# contents: write

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

# - name: 🐍 Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3.x"

# - name: 👷 Build
# run: |
# python -m pip install build
# python -m build

# - name: 🚢 Publish to PyPI
# # TODO remove the "if: false" line when the package is ready for pypi release
# if: false
# uses: pypa/gh-action-pypi-publish@release/v1

# - uses: softprops/action-gh-release@v2
# with:
# generate_release_notes: true
# files: './dist/*'
85 changes: 15 additions & 70 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Git ignored is sourced from https://github.com/pydev-guide/pyrepo-copier/blob/main/LICENSE
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -8,6 +9,7 @@ __pycache__/

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
Expand All @@ -20,11 +22,11 @@ parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

.DS_Store

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -39,17 +41,14 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -58,8 +57,6 @@ cover/
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
Expand All @@ -72,63 +69,27 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
.python-version

# celery beat schedule file
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
# dotenv
.env

# virtualenv
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
Expand All @@ -142,26 +103,10 @@ venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
# ruff
.ruff_cache/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.vscode
*.ipynb

# MacOS files
.DS_Store
# IDE settings
.vscode/
.idea/
2 changes: 1 addition & 1 deletion create_env_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ $COMMMAND run --name $ENVNAME pip install git+https://github.com/fractal-analyti


echo "Downloading the __FRACTAL_MANIFEST__.json file file"
curl -O https://raw.githubusercontent.com/fractal-analytics-platform/fractal-plantseg-tasks/$VERSION/__FRACTAL_MANIFEST__.json
curl -O https://raw.githubusercontent.com/fractal-analytics-platform/fractal-plantseg-tasks/$VERSION/src/plantseg_tasks/__FRACTAL_MANIFEST__.json
12 changes: 3 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,19 @@ build-backend = "hatchling.build"

# https://hatch.pypa.io/latest/config/metadata/
[tool.hatch.version]
#path = "src/plantseg_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"]
packages = ["src/plantseg_tasks"]


# Project metadata (see https://peps.python.org/pep-0621)
[project]
name = "fractal-plantseg-tasks"
dynamic = ["version"]
description = "Package description."
description = "A collection of fractal tasks to run plantseg workflows."
readme = "README.md"
license = { text = "BSD-3-Clause" }
authors = [
Expand All @@ -32,7 +26,7 @@ authors = [

# Required Python version and dependencies
requires-python = ">=3.9"
dependencies = ["fractal-tasks-core == 1.2.1"]
dependencies = ["fractal-tasks-core == 1.3.3"]

# Optional dependencies (e.g. for `pip install -e ".[dev]"`, see
# https://peps.python.org/pep-0621/#dependencies-optional-dependencies)
Expand Down
21 changes: 17 additions & 4 deletions src/plantseg_tasks/__FRACTAL_MANIFEST__.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"manifest_version": "2",
"task_list": [
{
"name": "H5 Converter Task",
"name": "Convert H5 to OME-Zarr",
"category": "Conversion",
"tags": [
"H5",
"HDF5"
],
"executable_non_parallel": "convert_h5_to_ome_zarr.py",
"meta_non_parallel": {
"cpus_per_task": 1,
Expand Down Expand Up @@ -250,7 +255,8 @@
"docs_info": "## convert_h5_to_ome_zarr\nH5 to OME-Zarr converter task.\n"
},
{
"name": "Tiff Converter Task",
"name": "Convert Tiff to OME-Zarr",
"category": "Conversion",
"executable_non_parallel": "convert_tiff_to_ome_zarr.py",
"meta_non_parallel": {
"cpus_per_task": 1,
Expand Down Expand Up @@ -494,7 +500,13 @@
"docs_info": "## convert_tiff_to_ome_zarr\nTIFF to OME-Zarr converter task.\n"
},
{
"name": "PlantSeg Workflow Task",
"name": "PlantSeg Segmentation",
"category": "Segmentation",
"tags": [
"Neural Network Segmentation",
"Deep Learning",
"Instance Segmentation"
],
"executable_parallel": "plantseg_workflow.py",
"meta_parallel": {
"cpus_per_task": 1,
Expand Down Expand Up @@ -712,5 +724,6 @@
}
],
"has_args_schemas": true,
"args_schema_version": "pydantic_v2"
"args_schema_version": "pydantic_v2",
"authors": "Lorenzo Cerrone"
}
2 changes: 1 addition & 1 deletion src/plantseg_tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Package description."""
"""A collection of fractal tasks to run plantseg workflows."""

from importlib.metadata import PackageNotFoundError, version

Expand Down
5 changes: 4 additions & 1 deletion src/plantseg_tasks/dev/create_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@
]
if __name__ == "__main__":
PACKAGE = "plantseg_tasks"
create_manifest(package=PACKAGE, custom_pydantic_models=custom_pydantic_models)
AUTHORS = "Lorenzo Cerrone"
create_manifest(
package=PACKAGE, authors=AUTHORS, custom_pydantic_models=custom_pydantic_models
)
9 changes: 9 additions & 0 deletions src/plantseg_tasks/dev/task_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,24 @@
name="Convert H5 to OME-Zarr",
executable="convert_h5_to_ome_zarr.py",
meta={"cpus_per_task": 1, "mem": 8000},
category="Conversion",
tags=["H5", "HDF5"],
),
NonParallelTask(
name="Convert Tiff to OME-Zarr",
executable="convert_tiff_to_ome_zarr.py",
meta={"cpus_per_task": 1, "mem": 8000},
category="Conversion",
),
ParallelTask(
name="PlantSeg Segmentation",
executable="plantseg_workflow.py",
meta={"cpus_per_task": 1, "mem": 32000, "needs_gpu": True},
category="Segmentation",
tags=[
"Neural Network Segmentation",
"Deep Learning",
"Instance Segmentation",
],
),
]
Binary file added tests/data/ngff_example/my_image/0/0/0/0/0
Binary file not shown.
Binary file added tests/data/ngff_example/my_image/0/0/1/0/0
Binary file not shown.
Binary file added tests/data/ngff_example/my_image/1/0/0/0/0
Binary file not shown.
Binary file added tests/data/ngff_example/my_image/1/0/1/0/0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.