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
3 changes: 1 addition & 2 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Ruff
on:
push:
branches:
- master
- dev
- main
pull_request:
jobs:
ruff:
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Tests

on:
push:
branches:
- main
pull_request:

jobs:
pytest:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4

- name: Setup Conda environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
use-mamba: true
activate-environment: CADET-GUI
environment-file: environment.yml

# No CADET-Process release includes CADETProcess.instruments yet (the
# LC flow-sheet layer this GUI is built on); pin a dev-branch commit
# known to have it, rather than floating on the branch tip.
- name: Install CADET-Process
run: pip install "git+https://github.com/fau-advanced-separations/CADET-Process.git@a064f9c"

- name: Install CADET-GUI
run: pip install -e . --group dev

- name: Install headless Chromium
run: playwright install --with-deps chromium

- name: Run tests
run: pytest -v
44 changes: 12 additions & 32 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,25 @@

### Coding Style

We use the [`Ruff` linter / formatter](https://docs.astral.sh/ruff/formatter/) for all Python files.
To install the latest version of Ruff, use the following command:

We use [`Ruff`](https://docs.astral.sh/ruff/) for linting and formatting all Python files.

```bash
pip install ruff
ruff check # lint
ruff format # format
```

**Linting:** To check your files for compliance with our coding standards, run the following command:

```bash
ruff check
```

This command will analyze the specified directory and report any issues that need to be addressed.

**Formatting:** To automatically format your files according to our coding standards, use:

```bash
ruff format
```

This command will apply the necessary formatting changes to ensure consistency across the codebase.

### Unit Tests

Install the dev dependencies and run the suite with [pytest](https://docs.pytest.org/):

```bash
pip install -e ".[dev]"
pip install -e . --group dev
pytest
```

Slow tests (real optimizer runs) are marked `@pytest.mark.slow`; skip them
during day-to-day work with `pytest -m "not slow"`, but run the full suite,
slow tests included, before opening a pull request.
locally with `pytest -m "not slow"`, but run the full suite before opening a
pull request. CI (`.github/workflows/tests.yml`) runs the full suite,
including headless-browser element tests, on every push to `main` and PR.

### Pre-commit Hooks

Expand All @@ -63,14 +46,11 @@ slow tests included, before opening a pull request.

## Versioning

CADET-GUI follows the same versioning approach as
[CADET-Process](https://github.com/fau-advanced-separations/CADET-Process):
a plain `MAJOR.MINOR.PATCH` string in `__version__`
(`cadetgui/__init__.py`), the single source of truth `pyproject.toml` reads
dynamically (`[tool.setuptools.dynamic] version = { attr =
"cadetgui.__version__" }`) — never duplicate the version number elsewhere.
While the project is pre-1.0, a MINOR bump may still include breaking
changes; PATCH is for fixes only. Tag each release `vX.Y.Z` to match.
CADET-GUI follows [CADET-Process](https://github.com/fau-advanced-separations/CADET-Process)'s
versioning: a plain `MAJOR.MINOR.PATCH` string in `cadetgui/__init__.py`'s
`__version__`, read dynamically by `pyproject.toml` — never duplicate it
elsewhere. Pre-1.0, a MINOR bump may include breaking changes; PATCH is
fixes only. Tag each release `vX.Y.Z`.

## Publish Package

Expand Down
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CADET-GUI

CADET-GUI provides widget-based graphical user elements to configure, run and
analyse [CADET-Process](https://github.com/fau-advanced-separations/CADET-Process)
Widget-based graphical elements to configure, run and analyse
[CADET-Process](https://github.com/fau-advanced-separations/CADET-Process)
simulations from a Jupyter notebook.

---
Expand Down Expand Up @@ -33,17 +33,15 @@ and versioning.
## Getting started

Everything is a plain [ipywidgets](https://ipywidgets.readthedocs.io/)/
[anywidget](https://anywidget.dev/) object: build one, call `.display()` (or
just let it be the last expression in a Jupyter cell), and keep using its
Python attributes from other cells.
[anywidget](https://anywidget.dev/) object: build one, call `.display()`, and
keep using its Python attributes from other cells.

### The workbench

`WorkbenchWidget` is the top-level entry point — a sidebar with four steps
(System Configuration, Process Configuration, Simulation, Parameter
Estimation), each a widget of its own that stays reachable as a plain
attribute (`.instrument`, `.configuration`, `.solution`,
`.parameter_estimation`):
Estimation), each also reachable as its own attribute: `.instrument`,
`.configuration`, `.solution`, `.parameter_estimation`.

```python
from cadetgui.widgets.composite import WorkbenchWidget
Expand All @@ -56,9 +54,8 @@ See [`examples/workbench.ipynb`](examples/workbench.ipynb).

### Composing widgets yourself

The same widgets that make up `WorkbenchWidget` can be built and wired by
hand — useful for a notebook that only needs a couple of steps, or a custom
layout:
Build and wire the same widgets by hand for a custom layout or a subset of
steps:

```python
from cadetgui.widgets.composite import ConfigurationWidget, SolutionWidget
Expand All @@ -72,22 +69,24 @@ solution.display()
```

See [`examples/configuration_and_solution.ipynb`](examples/configuration_and_solution.ipynb)
and [`examples/custom_sidebar.ipynb`](examples/custom_sidebar.ipynb) (a
`SidebarShell` built from a hand-picked set of widgets).
and [`examples/custom_sidebar.ipynb`](examples/custom_sidebar.ipynb).

### Example data

[`examples/data/`](examples/data/) and
[`examples/EXAMPLE_DATA.md`](examples/EXAMPLE_DATA.md) hold small synthetic
datasets (generated by simulating a known process and adding noise, never
measured data) for exercising Parameter Estimation without needing your own
experimental files first.
datasets for exercising Parameter Estimation without your own experimental
files.

### Running as a web app

[`examples/webapp/`](examples/webapp/) shows deploying `WorkbenchWidget`
through [Voilà](https://voila.readthedocs.io/), turning the notebook into a
standalone page with no visible code cells.
[`examples/webapp/`](examples/webapp/) deploys `WorkbenchWidget` as a
standalone page via [Voilà](https://voila.readthedocs.io/):

```bash
pip install voila
voila examples/webapp/app.ipynb
```

---

Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
"Intended Audience :: Science/Research"
]
dependencies = [
"CADETProcess>=0.11",
"CADET-Process>=0.11",
"anywidget",
"ipywidgets>=8",
"traitlets",
Expand All @@ -52,6 +52,7 @@ cadetgui = [
[dependency-groups]
testing = [
"coverage",
"playwright",
"pytest",
"pytest-cov"
]
Expand All @@ -66,6 +67,7 @@ docs = [
]
dev = [
"coverage",
"playwright",
"pytest",
"pytest-cov",
"myst-nb>=0.17.1",
Expand Down
Loading