Skip to content
Merged
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
43 changes: 30 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
# LabConstrictor repository initialiser
# LabConstrictor repository form

A Streamlit web form for [LabConstrictor](https://github.com/CellMigrationLab/LabConstrictor) app repositories. It is deployed at https://labconstrictor-form.streamlit.app (the app sleeps when idle, so the first load can be slow).
A web form that sets up a [LabConstrictor](https://cellmigrationlab.github.io/LabConstrictor-Site/) app repository for you, so that you do not have to edit its files by hand.

It does two things, each by opening a pull request on your repository with a GitHub Personal Access Token (classic):
## Get Started

- **Initialise a repository** made from the LabConstrictor template: you give the project name, the first version, whether code cells are hidden, and optional welcome, header and icon images. The form clones the repository, replaces the template placeholders (`placeholders.py`), turns the icon into `.ico` and `.icns`, writes a starter README and, if you describe the app, `labconstrictor-app.yaml` for the LabConstrictor App Centre (`manifest_form.py`, `app_manifest.py`, checked against `schemas/labconstrictor-app.schema.json`).
- **Upload or update notebooks**: each notebook with its `requirements.yaml` goes to `notebooks/<name>/`.
1. **Open the form: <https://labconstrictor-form.streamlit.app>**
2. If you find the following window, click on `Yes, get this app back up!`

<img width="40%" height="40%" alt="image" src="https://github.com/user-attachments/assets/9960fcbb-cf8b-4202-b26b-14de749e64b7" />

## Run it locally
3. When you arrive to the following page, chose between `Initialise a repository` or `Upload or update notebooks`, please take a look into [What it does](#what-it-does) for further information

<img width="1781" height="349" alt="image" src="https://github.com/user-attachments/assets/790a20cc-1e1c-4c76-97d1-4fe48496fc56" />

Needs Python (CI uses 3.11) and `git` on the PATH.
## What it does

The form opens a pull request on your repository; you review and merge it. It needs a GitHub Personal Access Token (classic). It can:

- **Initialise a repository** made from the LabConstrictor template. You give the project name, the first version, whether code cells are hidden, and optional welcome, header and icon images. The form fills in the template, converts the icon, writes a starter README and, if you describe your app, the `labconstrictor-app.yaml` file that lists it in the [App Centre](https://cellmigrationlab.github.io/LabConstrictor-Site/apps/).
- **Upload or update notebooks.** Each notebook goes to `notebooks/<name>/` together with its `requirements.yaml`.

The guides on the [LabConstrictor website](https://cellmigrationlab.github.io/LabConstrictor-Site/guides/) show where the form fits into making an app, step by step.

## Getting help

Questions and bugs: the [issue tracker](https://github.com/CellMigrationLab/LabConstrictor_streamlit/issues).

## For developers

Run the form on your computer (needs Python and `git`; the automated tests use Python 3.11):

```
pip install -r requirements.txt
streamlit run app.py
```

## Tests
Run the tests:

```
python -m unittest discover -s tests -v
```

The test that initialises a copy of the template is skipped unless `LC_TEMPLATE_DIR` points to a clone of [CellMigrationLab/LabConstrictor](https://github.com/CellMigrationLab/LabConstrictor). CI (`.github/workflows/tests.yml`) runs it against the template's `main` on every push, pull request and weekly.

`docs/labconstrictor-project.yaml` is how this project is listed on the LabConstrictor website. `schemas/README.md` says where the manifest schema comes from.
The test that initialises a copy of the template is skipped unless `LC_TEMPLATE_DIR` points to a clone of [CellMigrationLab/LabConstrictor](https://github.com/CellMigrationLab/LabConstrictor).

## License
Where things are: `app.py` is the form, `placeholders.py` fills in the template, `manifest_form.py` and `app_manifest.py` write `labconstrictor-app.yaml`, and [schemas/README.md](schemas/README.md) says where the manifest schema comes from.

[MIT](LICENSE)
License: [MIT](LICENSE).
2 changes: 1 addition & 1 deletion app_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

MANIFEST_NAME = "labconstrictor-app.yaml"
SCHEMA_PATH = Path(__file__).resolve().parent / "schemas" / "labconstrictor-app.schema.json"
SCHEMA_URL = "https://labconstrictor.cellmig.org/schema/labconstrictor-app.schema.json"
SCHEMA_URL = "https://cellmigrationlab.github.io/LabConstrictor-Site/schema/labconstrictor-app.schema.json"
KINDS = {"Analysis": "analysis", "Segmentation": "segmentation", "Simulation": "simulation",
"Game": "game", "Training": "training", "Utility": "utility"}
HOSTS = ("notebook", "napari", "fiji", "qupath")
Expand Down
2 changes: 1 addition & 1 deletion docs/labconstrictor-project.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# yaml-language-server: $schema=https://labconstrictor.cellmig.org/schema/labconstrictor-project.schema.json
# yaml-language-server: $schema=https://cellmigrationlab.github.io/LabConstrictor-Site/schema/labconstrictor-project.schema.json
# How this project is listed on the LabConstrictor website's Ecosystem page. Keep the status true.
name: Repository initialiser
summary: A web form that sets up a new app repository and opens a pull request. It sleeps when idle, so the first load can be slow.
Expand Down
2 changes: 1 addition & 1 deletion schemas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
`labconstrictor-app.schema.json` is a copy of the schema of the LabConstrictor App Centre manifest
(`labconstrictor-app.yaml`). The authority is the LabConstrictor site repository
(`schema/labconstrictor-app.schema.json`, published at
https://labconstrictor.cellmig.org/schema/labconstrictor-app.schema.json). When that file changes,
https://cellmigrationlab.github.io/LabConstrictor-Site/schema/labconstrictor-app.schema.json). When that file changes,
copy it here and into the template (`.tools/schema/`).
4 changes: 2 additions & 2 deletions schemas/labconstrictor-app.schema.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://labconstrictor.cellmig.org/schema/labconstrictor-app.schema.json",
"$id": "https://cellmigrationlab.github.io/LabConstrictor-Site/schema/labconstrictor-app.schema.json",
"title": "labconstrictor-app.yaml",
"description": "Manifest that an app keeps in the root of its own repository so that it can be listed in the LabConstrictor App Centre. Edit it with schema support: add `# yaml-language-server: $schema=https://labconstrictor.cellmig.org/schema/labconstrictor-app.schema.json` as the first line.",
"description": "Manifest that an app keeps in the root of its own repository so that it can be listed in the LabConstrictor App Centre. Edit it with schema support: add `# yaml-language-server: $schema=https://cellmigrationlab.github.io/LabConstrictor-Site/schema/labconstrictor-app.schema.json` as the first line.",
"type": "object",
"additionalProperties": false,
"required": ["schema", "name", "summary", "kind", "distribution"],
Expand Down
2 changes: 1 addition & 1 deletion tests/test_app_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def build(self, **overrides):

def test_a_valid_manifest_round_trips(self) -> None:
text = am.render(self.build(description="First paragraph.\n\nSecond paragraph.", icon_path="app/logo/icon.png"))
self.assertTrue(text.startswith("# yaml-language-server: $schema=https://labconstrictor.cellmig.org/"))
self.assertTrue(text.startswith("# yaml-language-server: $schema=https://cellmigrationlab.github.io/LabConstrictor-Site/"))
data = yaml.safe_load(text)
self.assertEqual(data["kind"], "analysis")
self.assertEqual(data["distribution"], {"installer": True})
Expand Down
Loading