Skip to content

Migrate to Monorepo #4765

@gnodar01

Description

@gnodar01

Many motivations for this, but generally, it makes dev easier:

  • Often changes need to simultaneously be made to core and cellprofiler. Currently, core PR must be merged first before cellprofiler PR can be tested and merged. We'd like to have a single git branch be responsible for a single feature change across all necessary components, filed under a single PR.
  • Dependencies, version numbers, build systems, etc all need to be manually synchronized. With a monorepo these are still separate but can be automated more effectively.
  • We want library as a separate package, without introducing yet another repo.

We've talked about moving to poetry as well. If we want to do this simultaneously, we have at least two paths forward:

  1. We can wait until Support subprojects in a poetry project python-poetry/poetry#2270 is closed before doing anything. There is also Monorepo / Monobuild support? python-poetry/poetry#936, but that has been folded into the former.

  2. Don't wait, and do what several others have done (eg here w/ src, or here, or here): move to a pyproject.toml per subpackage (one for core, one for library, and one at the top level for cellprofiler), with a scripts directory that will run poetry <cmd> across all of them if/when necessary. Once the issue above is closed, we can migrate.

The main priority with (2) is to avoid having to create a separate virtual environment (something poetry strongly nudges towards) for each package. We already go through the trouble to make sure dependencies are non-conflicting, so we only need a single virtual environment.

If we don't want to move to poetry (either at all or yet), we might like to have a monorepo-aware build system like pants for the reasons outlined here.

Ultimately, we don't have to prioritize that either. We'd just refactor the directory to include core, and put library in its own package, with a simple setup.py:

CellProfiler/
├─ packages/
│  ├─ cellprofiler-core/
│  │  ├─ README
│  │  ├─ setup.py
│  │  ├─ cellprofiler_core/
│  │  │  ├─ __init__.py
│  │  ├─ tests/
│  │  ├─ docs/
│  ├─ cellprofiler-library/
│  │  ├─ setup.py
│  │  ├─ README
│  │  ├─ cellprofiler_library/
│  │  │  ├─ __init__.py
│  │  ├─ tests/
├─ setup.py
├─ README
├─ cellprofiler/
│  ├─ __init__.py
├─ tests/
├─ plugins/
├─ docs/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions