Skip to content

fractal-analytics-platform/fractal-helper-tasks

Repository files navigation

fractal-helper-tasks

License Python version GitHub Workflow Status codecov

Collection of Fractal helper tasks

Development instructions

This instructions are only relevant after you completed both the copier copy command and the git/GitLab/GitHub initialization phase - see README for details.

  1. It is recommended to work from an isolated Python virtual environment:
# Create the virtual environment in the folder venv
python -m venv venv
# Activate the Python virtual environment
source venv/bin/activate
# Deactivate the virtual environment, when you don't need it any more
deactivate
  1. You can install your package locally as in:
# Install only fractal_helper_tasks:
python -m pip install -e .
# Install both fractal_helper_tasks and development dependencies (e.g. pytest):
python -m pip install -e ".[dev]"
  1. Enjoy developing the package.

  2. The template already includes a sample task ("Thresholding Task"). Whenever you change its input parameters or docstring, re-run

python src/fractal_helper_tasks/dev/create_manifest.py
git add src/fractal_helper_tasks/__FRACTAL_MANIFEST__.json
git commit -m'Update `__FRACTAL_MANIFEST__.json`'
git push origin main
  1. If you add a new task, you should also add a new item to the task_list property in src/fractal_helper_tasks/__FRACTAL_MANIFEST__.json. A minimal example may look like
    {
      "name": "My Second Task",
      "executable": "my_second_task.py",
      "input_type": "zarr",
      "output_type": "zarr",
      "meta": {
        "some-property": "some-value"
      },
    }

Notes:

  • After adding a task, you should also update the manifest (see point 4 above).
  • The minimal example above also includes the meta task property; this is optional, and you can remove it if it is not needed.
  1. Run the test suite (with somewhat verbose logging) through
python -m pytest --log-cli-level info -s
  1. Build the package through
python -m build

This command will create the release distribution files in the dist folder. The wheel one (ending with .whl) is the one you can use to collect your tasks within Fractal.