Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
125 lines (116 loc) · 5.23 KB
/
Copy pathpyproject.toml
File metadata and controls
125 lines (116 loc) · 5.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
[project]
name = "history-matching-tutorial"
version = "0.1.0"
description = "Tutorial on history matching and production optimisation."
readme = "README.md"
license = "MIT"
authors = [{ name = "Patrick N. Raanes", email = "patrick.n.raanes@gmail.com" }]
# ── Dependency policy ────────────────────────────────────────────────────────
#
# The tutorials must run with a single click on Google Colab, whose base
# environment we do not control and which gets upgraded every few weeks.
# That single fact shapes everything below. There are two install targets:
#
# (A) Local (`uv sync`): exact reproducibility comes from `uv.lock`,
# not from pins in this file. Refresh with `uv lock --upgrade`.
#
# (B) Colab (`colab_bootstrap.sh`): installs `requirements-colab.txt`
# with `pip install --no-deps`, i.e. it adds ONLY the packages Colab lacks,
# and never touches a preinstalled one. Reason: numpy/scipy/matplotlib/
# ipywidgets are already *imported* when a Colab kernel starts, so
# re-installing them (up- or downgrade) requires a runtime restart.
# Hence the constraints below on Colab-preinstalled packages must accept
# whatever Colab ships. In practice this means: no upper bounds here
# (our own `minires` caps matplotlib, scipy and tqdm at their next major), and lower bounds only
# where the code demands them. If Colab's upgrades break us, we fix the
# code, not the pins -- and `tests/colab/` exists to catch that early.
#
# Consequently `pyproject.toml` and `requirements-colab.txt` must be kept in
# sync by hand (they are short). The Colab smoke test fails loudly on drift
# (ImportError for a missing package, or a mutated preinstalled package).
#
# Python: 3.12 (`.python-version`) because that is what Colab runs
# (runtime 2026.08). Newer versions work too (`requires-python` is open),
# but 3.12 is what gets tested.
requires-python = ">=3.12"
dependencies = [
# Our own toy reservoir simulator, from PyPI since its 0.3.0 (2026-09-15).
# Pinned to the minor: `minires` is 0.x, so a minor bump may break the API
# (keep `requirements-colab.txt` in step). An unreleased snapshot is
# `"minires @ git+https://github.com/patnr/MiniRes.git@<hash>"`; for local
# hacking, `uv pip install -e ${HOME}/path/MiniRes`.
"minires~=0.3.0",
# Preinstalled on Colab => deliberately unconstrained (see policy above).
"numpy",
"scipy",
"matplotlib",
"ipywidgets",
"ipython",
"threadpoolctl",
"tqdm",
# NOT preinstalled on Colab => also listed in `requirements-colab.txt`.
# `pathos` (multiprocessing with dill pickling) drags in
# dill/multiprocess/pox/ppft, all pure-Python, so also cheap on Colab.
"pathos",
# Zero dependencies, by design (it is our own).
"struct-tools",
# Label de-overlapping in `tools/utils.py`. Exact-pinned since it was added
# (2023, when 0.8 was current); the 1.x releases rewrote the algorithm and
# the pin has simply not been re-evaluated against them. Not preinstalled on
# Colab (only depends on numpy+matplotlib), so the exact pin is harmless there.
"adjustText==0.8",
]
[dependency-groups]
# Local-only tooling. Never installed on Colab, which has its own frontend.
dev = [
# Notebook frontend (v7, i.e. built on JupyterLab 4). Classic notebook (v6)
# and `jupyterlab~=3.6` were dropped: they forced `jupyter-server<2` and
# Python 3.12, and doubled the surface to test. `ipympl` was also dropped:
# all notebooks use the inline backend (the only one that works on Colab).
"notebook",
# tornado 6.5.9 (2026-09-14) added a symlink check in `StaticFileHandler`
# that reads `self.allowed_symlink_directory`, set in its `initialize()`.
# jupyter_server (<=2.21.0) `FileFindHandler` overrides `initialize()`
# without calling super, so every `/static/...` request 500s and the
# notebook page renders blank. Drop this pin once jupyter_server is fixed.
"tornado<6.5.9",
# `tests/colab/run_nb.py` executes notebooks headlessly with these two
# (deliberately not nbclient, see its docstring). Both come with `notebook`
# anyway, and Colab ships them.
"jupyter_client",
"nbformat",
# Keep in sync with the `jupytext` rev in `.pre-commit-config.yaml`.
"jupytext~=1.15.2",
"ipdb",
"pre-commit",
"ruff~=0.5.0",
]
# Not a package: nothing is imported from this project, the notebooks are run
# in place. Hence no `[build-system]` (a PEP 517 build would only serve to
# read the dependency list). Install with `uv sync`, or, for pip users,
# `pip install -r requirements-colab.txt` is NOT the way (it is Colab-specific);
# use `uv pip install -r pyproject.toml` or just `pip install uv && uv sync`.
[tool.uv]
package = false
[tool.ruff]
line-length = 100
[tool.ruff.lint]
ignore = [
# "E501" # "line too long"
"E402", # "import not at top of file"
"E703", # "statement ends with a semicolon"
"E731", # "do not assign a lambda expression, use a def"
# "F401", # "imported but unused"
# "F811", # "redefinition of unused name"
]
extend-select = [
# "E501" # "line too long"
]
# unfixable = ["B"]
[tool.ruff.lint.per-file-ignores]
"Optimise*.py" = [
"F401", # "imported but unused"
]
# "**/{tests,docs,tools}/*" = ["E402"]
# [tool.ruff.format]
# quote-style = "single"