Skip to content

Commit d1937f4

Browse files
authored
👌 Update dependencies and fix compatibility newer python versions (#14)
including bumping pyglotaran and pyglotaran-extras to 0.7.4, adding a dev dependency group, and checking in the new uv.lock. It also refactors the JavaScript form code to reduce duplication, centralize number-list parsing, and make simulation ID generation more robust. The README now includes clearer uv-based usage instructions for running from GitHub, a local clone, or an existing project. A small cleanup also removes the ANYWIDGET_HMR note from pyparamgui.__init__.
1 parent 66ca12e commit d1937f4

12 files changed

Lines changed: 2823 additions & 287 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
strategy:
6767
matrix:
6868
os: [ubuntu-latest, windows-latest, macOS-latest]
69-
python-version: ["3.10", "3.11"]
69+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
7070

7171
steps:
7272
- name: Check out repo

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ repos:
33
# FORMATTER #
44
###################
55
- repo: https://github.com/tox-dev/pyproject-fmt
6-
rev: "2.1.4"
6+
rev: "v2.20.0"
77
hooks:
88
- id: pyproject-fmt
99

1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.6.0
11+
rev: v6.0.0
1212
hooks:
1313
- id: check-ast
1414
- id: check-builtin-literals
@@ -20,7 +20,7 @@ repos:
2020
args: [--fix=lf]
2121

2222
- repo: https://github.com/PyCQA/docformatter
23-
rev: 06907d0
23+
rev: v1.7.7
2424
hooks:
2525
- id: docformatter
2626
additional_dependencies: [tomli]
@@ -43,7 +43,7 @@ repos:
4343
###################
4444
- repo: https://github.com/astral-sh/ruff-pre-commit
4545
# Ruff version.
46-
rev: v0.5.1
46+
rev: v0.15.7
4747
hooks:
4848
- id: ruff
4949
name: "ruff sort imports"
@@ -58,7 +58,7 @@ repos:
5858
name: "ruff lint"
5959

6060
- repo: https://github.com/pre-commit/mirrors-mypy
61-
rev: v1.10.1
61+
rev: v1.19.1
6262
hooks:
6363
- id: mypy
6464
exclude: "docs"
@@ -68,7 +68,7 @@ repos:
6868
# LINTER DOCS #
6969
###################
7070
- repo: https://github.com/PyCQA/flake8
71-
rev: 7.1.0
71+
rev: 7.3.0
7272
hooks:
7373
- id: flake8
7474
alias: flake8-docs
@@ -91,7 +91,7 @@ repos:
9191
pass_filenames: false
9292

9393
- repo: https://github.com/codespell-project/codespell
94-
rev: v2.3.0
94+
rev: v2.4.2
9595
hooks:
9696
- id: codespell
9797
types: [file]
@@ -100,6 +100,6 @@ repos:
100100
exclude: ^examples/
101101

102102
- repo: https://github.com/rhysd/actionlint
103-
rev: "v1.7.1"
103+
rev: "v1.7.11"
104104
hooks:
105105
- id: actionlint

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,38 @@
1616

1717
A pyglotaran based jupyter notebook widget for teaching parameter estimation examples. It can simulate data, visualize it and create related model.yml, parameters.csv and dataset.nc files. It is supposed to help students learn about the basics of the pyglotaran ecosystem.
1818

19+
## Usage
20+
21+
### Option 1: Run directly from GitHub with uv
22+
23+
Install and run PyParamGUI directly from the repository without cloning:
24+
25+
```bash
26+
uv run --with "pyparamgui @ git+https://github.com/glotaran/pyparamgui" --with jupyter jupyter lab
27+
```
28+
29+
### Option 2: Run from a local clone
30+
31+
Clone the repository and run with the local source:
32+
33+
```bash
34+
uv run --with . --with jupyter jupyter lab
35+
```
36+
37+
### Option 3: Add to an existing uv project
38+
39+
Add PyParamGUI as a dependency to your project:
40+
41+
```bash
42+
uv add "pyparamgui @ git+https://github.com/glotaran/pyparamgui"
43+
```
44+
45+
Then run Jupyter Lab in your project environment:
46+
47+
```bash
48+
uv run jupyter lab
49+
```
50+
1951
## Contributors ✨
2052

2153
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
@@ -26,7 +58,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
2658
<table>
2759
<tbody>
2860
<tr>
29-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/anmolbhatia05"><img src="https://avatars.githubusercontent.com/u/34206963?v=4?s=100" width="100px;" alt="Anmol Bhatia"/><br /><sub><b>Anmol Bhatia</b></sub></a><br /><a href="https://github.com/glotaran/PyParamGUI/commits?author=anmolbhatia05" title="Code">💻</a></td>
61+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/anmolbhatia05"><img src="https://avatars.githubusercontent.com/u/34206963?v=4?s=100" width="100px;" alt="Anmol Bhatia"/><br /><sub><b>Anmol Bhatia</b></sub></a><br /><a href="https://github.com/glotaran/pyparamgui/commits?author=anmolbhatia05" title="Code">💻</a></td>
3062
</tr>
3163
</tbody>
3264
</table>

pyparamgui/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
__all__ = ["Widget"]
1212
"""
1313
Package Usage:
14-
%env ANYWIDGET_HMR=1
1514
from pyparamgui import Widget
1615
1716
widget = Widget()

pyparamgui/generator.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def _generate_decay_model(
3838
dict[str, Any]
3939
The generated model dictionary.
4040
"""
41-
compartments = [f"species_{i+1}" for i in range(nr_compartments)]
42-
rates = [f"rates.species_{i+1}" for i in range(nr_compartments)]
41+
compartments = [f"species_{i + 1}" for i in range(nr_compartments)]
42+
rates = [f"rates.species_{i + 1}" for i in range(nr_compartments)]
4343

4444
model: dict[str, Any] = {
4545
"megacomplex": {
@@ -56,18 +56,18 @@ def _generate_decay_model(
5656
"megacomplex_spectral": {
5757
"type": "spectral",
5858
"shape": {
59-
compartment: f"shape_species_{i+1}"
59+
compartment: f"shape_species_{i + 1}"
6060
for i, compartment in enumerate(compartments)
6161
},
6262
}
6363
}
6464
model["shape"] = {
65-
f"shape_species_{i+1}": {
65+
f"shape_species_{i + 1}": {
6666
"type": "skewed-gaussian",
67-
"amplitude": f"shapes.species_{i+1}.amplitude",
68-
"location": f"shapes.species_{i+1}.location",
69-
"width": f"shapes.species_{i+1}.width",
70-
"skewness": f"shapes.species_{i+1}.skewness",
67+
"amplitude": f"shapes.species_{i + 1}.amplitude",
68+
"location": f"shapes.species_{i + 1}.location",
69+
"width": f"shapes.species_{i + 1}.width",
70+
"skewness": f"shapes.species_{i + 1}.skewness",
7171
}
7272
for i in range(nr_compartments)
7373
}
@@ -275,4 +275,4 @@ def generate_model_yml(*, generator_name: str, generator_arguments: GeneratorArg
275275
)
276276
raise ValueError(msg)
277277
model = generators[generator_name](**generator_arguments)
278-
return cast(str, write_dict(model))
278+
return cast("str", write_dict(model))

pyparamgui/schema.py

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class KineticParameters(BaseModel):
1515
1616
Attributes
1717
----------
18-
decay_rates (list[float]): List of decay rates.
18+
decay_rates : list[float]
19+
List of decay rates.
1920
"""
2021

2122
decay_rates: list[float]
@@ -26,10 +27,14 @@ class SpectralParameters(BaseModel):
2627
2728
Attributes
2829
----------
29-
amplitude (list[float]): List of amplitudes.
30-
location (list[float]): List of locations.
31-
width (list[float]): List of widths.
32-
skewness (list[float]): List of skewness values.
30+
amplitude : list[float]
31+
List of amplitudes.
32+
location : list[float]
33+
List of locations.
34+
width : list[float]
35+
List of widths.
36+
skewness : list[float]
37+
List of skewness values.
3338
"""
3439

3540
amplitude: list[float]
@@ -43,8 +48,10 @@ class TimeCoordinates(BaseModel):
4348
4449
Attributes
4550
----------
46-
timepoints_max (int): Maximum number of time points.
47-
timepoints_stepsize (float): Step size between time points.
51+
timepoints_max : int
52+
Maximum number of time points.
53+
timepoints_stepsize : float
54+
Step size between time points.
4855
"""
4956

5057
timepoints_max: int
@@ -56,9 +63,12 @@ class SpectralCoordinates(BaseModel):
5663
5764
Attributes
5865
----------
59-
wavelength_min (int): Minimum wavelength.
60-
wavelength_max (int): Maximum wavelength.
61-
wavelength_stepsize (float): Step size between wavelengths.
66+
wavelength_min : int
67+
Minimum wavelength.
68+
wavelength_max : int
69+
Maximum wavelength.
70+
wavelength_stepsize : float
71+
Step size between wavelengths.
6272
"""
6373

6474
wavelength_min: int
@@ -100,12 +110,14 @@ class Settings(BaseModel):
100110
101111
Attributes
102112
----------
103-
stdev_noise (float): Standard deviation of the noise to be added to the simulation data.
104-
seed (int): Seed for the random number generator to ensure reproducibility.
105-
add_gaussian_irf (bool): Whether to add a Gaussian IRF to the simulation.
106-
Default is False.
107-
use_sequential_scheme (bool): Whether to use a sequential scheme in the simulation.
108-
Default is False.
113+
stdev_noise : float
114+
Standard deviation of the noise to be added to the simulation data.
115+
seed : int
116+
Seed for the random number generator to ensure reproducibility.
117+
add_gaussian_irf : bool
118+
Whether to add a Gaussian IRF to the simulation. Default is False.
119+
use_sequential_scheme : bool
120+
Whether to use a sequential scheme in the simulation. Default is False.
109121
"""
110122

111123
stdev_noise: float
@@ -119,8 +131,10 @@ class IRF(BaseModel):
119131
120132
Attributes
121133
----------
122-
center (float): The center position of the IRF.
123-
width (float): The width of the IRF.
134+
center : float
135+
The center position of the IRF.
136+
width : float
137+
The width of the IRF.
124138
"""
125139

126140
center: float
@@ -132,13 +146,17 @@ class SimulationConfig(BaseModel):
132146
133147
Attributes
134148
----------
135-
kinetic_parameters (KineticParameters): Kinetic parameters for the simulation.
136-
spectral_parameters (SpectralParameters): Spectral parameters for the simulation.
137-
coordinates (Dict[str, np.ndarray]): Dictionary containing the time and spectral axes as
138-
numpy arrays.
139-
settings (Settings): Other settings for the simulation, including noise standard deviation,
140-
random seed, and flags for adding Gaussian IRF and using a sequential scheme.
141-
irf (IRF): Instrument Response Function (IRF) settings, e.g. center position and width.
149+
kinetic_parameters : KineticParameters
150+
Kinetic parameters for the simulation.
151+
spectral_parameters : SpectralParameters
152+
Spectral parameters for the simulation.
153+
coordinates : dict[str, np.ndarray]
154+
Dictionary containing the time and spectral axes as numpy arrays.
155+
settings : Settings
156+
Other settings for the simulation, including noise standard deviation,
157+
random seed, and flags for adding Gaussian IRF and using a sequential scheme.
158+
irf : IRF
159+
Instrument Response Function (IRF) settings, e.g. center position and width.
142160
"""
143161

144162
kinetic_parameters: KineticParameters

0 commit comments

Comments
 (0)