Skip to content

ecell/kedro-bioimage

Repository files navigation

kedro-bioimage

Overview

This is a Kedro project for bioimage analysis, which was generated using Kedro 0.16.6.

How to setup kedro-bioimage environment

  1. install miniconda from https://docs.conda.io/en/latest/miniconda.html
  2. Create a new Python virtual environment, called kedro-environment, using conda
    conda create --name kedro-bioimage python=3.7 -y
    
  3. This will create an isolated Python 3.7 environment. To activate it:
    conda activate kedro-bioimage
    
  4. Install dependencies with pip (and install numpy with conda for Windows)
    pip install -r src/requirements.txt --user
    conda install numpy
    
  5. Remove scopyon example directory
    rm -rf src/scopyon/examples
    

Rules and guidelines

In order to get the best out of the template:

  • Don't remove any lines from the .gitignore file we provide
  • Make sure your results can be reproduced by following a data engineering convention
  • Don't commit data to your repository
  • Don't commit any credentials or your local configuration to your repository. Keep all your credentials and local configuration in conf/local/

How to run your Kedro pipeline

You can run your Kedro project with:

kedro run

How to test your Kedro project

Have a look at the file src/tests/test_run.py for instructions on how to write your tests. You can run your tests as follows:

kedro test

To configure the coverage threshold, go to the .coveragerc file.

Project dependencies

If you'd like to update your project requirements, please update src/requirements.in and re-run kedro build-reqs.

DO NOT UPDATE src/requirements.txt manually, if you do not understand what this will effect

kedro build-reqs

To install new added packages,

kedro install

Further information about project dependencies

How to work with Kedro and notebooks

Note: Using kedro jupyter or kedro ipython to run your notebook provides these variables in scope: context, catalog, and startup_error.

Jupyter, JupyterLab, and IPython are already included in the project requirements by default, so once you have run kedro install you will not need to take any extra steps before you use them.

Jupyter

You can start a local notebook server:

kedro jupyter notebook

JupyterLab

You can also start JupyterLab:

kedro jupyter lab

IPython

And if you want to run an IPython session:

kedro ipython

How to convert notebook cells to nodes in a Kedro project

You can move notebook code over into a Kedro project structure using a mixture of cell tagging and Kedro CLI commands.

By adding the node tag to a cell and running the command below, the cell's source code will be copied over to a Python file within src/<package_name>/nodes/:

kedro jupyter convert <filepath_to_my_notebook>

Note: The name of the Python file matches the name of the original notebook.

Alternatively, you may want to transform all your notebooks in one go. Run the following command to convert all notebook files found in the project root directory and under any of its sub-folders:

kedro jupyter convert --all

How to ignore notebook output cells in git

To automatically strip out all output cell contents before committing to git, you can run kedro activate-nbstripout. This will add a hook in .git/config which will run nbstripout before anything is committed to git.

Note: Your output cells will be retained locally.

Package your Kedro project

Further information about building project documentation and packaging your project