Skip to content

Commit bb49d6d

Browse files
authored
Merge pull request #37 from virtualcell/simpler-apis
Session-based remote API, notebook testing, and usability improvements
2 parents 8795b69 + 7154faf commit bb49d6d

30 files changed

Lines changed: 2726 additions & 903 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ test_output_1/
178178
examples/test_output/SimID_*
179179
/examples/notebooks/*.py
180180
/examples/solver_output/zarr/
181+
/examples/solver_output/*.vtu
182+
/examples/solver_output/*.json
181183

182184
examples/notebooks/workspace/
183185

CLAUDE.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Run `make check`, which does:
2828

2929
Then run tests: `poetry run pytest tests -v`
3030

31+
For changes to remote/session code, also prompt the developer to run authenticated integration tests manually:
32+
33+
```bash
34+
poetry run pytest tests/vcml/test_remote_integration.py -v --run-remote
35+
```
36+
37+
This requires interactive browser login and a live VCell server.
38+
3139
## Project structure
3240

3341
```
@@ -58,8 +66,10 @@ scripts/
5866

5967
The main entry point is `import pyvcell.vcml as vc`. Key functions:
6068

61-
- **Load models**: `vc.load_vcml_file()`, `vc.load_vcml_url()`, `vc.load_biomodel(id)`, `vc.load_sbml_file()`, `vc.load_antimony_str()`
62-
- **Simulate**: `vc.simulate(biomodel, sim_name)` (local), `vc.run_remote(...)` (server)
69+
- **Load models (local)**: `vc.load_vcml_file()`, `vc.load_vcml_url()`, `vc.load_sbml_file()`, `vc.load_antimony_str()`
70+
- **Simulate (local)**: `vc.simulate(biomodel, sim_name)`
71+
- **Remote (anonymous)**: `session = vc.connect()`, `session.load_biomodel(id)`, `session.list_biomodels()`
72+
- **Remote (authenticated)**: `session = vc.connect(login=True)`, `session.run_sim(...)`, `session.start_sim(...)`
6373
- **Results**: `result.plotter.plot_concentrations()`, `result.plotter.plot_slice_3d()`
6474

6575
## Code conventions

docs/getting-started/quickstart.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,20 @@ biomodel = vc.load_vcml_file("path/to/model.vcml")
1111
print(biomodel)
1212
```
1313

14-
You can also load public models directly from the VCell database by ID:
14+
You can also load public models from the VCell server. Use `vc.connect()` to create a session for remote access:
1515

1616
```python
17-
biomodel = vc.load_biomodel("279851639")
18-
```
19-
20-
To browse or search models by name, authenticate first:
21-
22-
```python
23-
from pyvcell._internal.api.vcell_client.auth.auth_utils import login_interactive
17+
session = vc.connect()
2418

25-
api_client = login_interactive() # opens a browser for login
19+
# Load by database ID
20+
biomodel = session.load_biomodel("279851639")
2621

27-
# List available models (public, shared, and your private models)
28-
for m in vc.list_biomodels(api_client=api_client)[:2]:
22+
# List available models
23+
for m in session.list_biomodels()[:2]:
2924
print(m)
3025

3126
# Load by name and owner
32-
biomodel = vc.load_biomodel(name="Tutorial_MultiApp", owner="tutorial", api_client=api_client)
33-
34-
# Load by database ID
35-
biomodel = vc.load_biomodel("279851639", api_client=api_client)
27+
biomodel = session.load_biomodel(name="Tutorial_MultiApp", owner="tutorial")
3628
```
3729

3830
Output:

docs/guides/notebooks/remote-simulations.ipynb

Lines changed: 21 additions & 248 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)