diff --git a/README.md b/README.md index e2532d5..23bbe94 100644 --- a/README.md +++ b/README.md @@ -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//`. +1. **Open the form: ** +2. If you find the following window, click on `Yes, get this app back up!` + + image -## 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 + + image -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//` 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). diff --git a/app_manifest.py b/app_manifest.py index 891598d..aba6512 100644 --- a/app_manifest.py +++ b/app_manifest.py @@ -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") diff --git a/docs/labconstrictor-project.yaml b/docs/labconstrictor-project.yaml index 7d487f3..6590251 100644 --- a/docs/labconstrictor-project.yaml +++ b/docs/labconstrictor-project.yaml @@ -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. diff --git a/schemas/README.md b/schemas/README.md index 6c52f7e..0000650 100644 --- a/schemas/README.md +++ b/schemas/README.md @@ -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/`). diff --git a/schemas/labconstrictor-app.schema.json b/schemas/labconstrictor-app.schema.json index 30ae4ae..1e67f94 100644 --- a/schemas/labconstrictor-app.schema.json +++ b/schemas/labconstrictor-app.schema.json @@ -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"], diff --git a/tests/test_app_manifest.py b/tests/test_app_manifest.py index a93c86e..4d9f45b 100644 --- a/tests/test_app_manifest.py +++ b/tests/test_app_manifest.py @@ -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})