From d6295c562434d49c6ce9f6cb2065506e8d0e61c8 Mon Sep 17 00:00:00 2001 From: David Gwartney Date: Sun, 8 Nov 2026 12:31:26 -0800 Subject: [PATCH] Add pyproject.toml so the notebooks run with uv Lists the packages from requirements.txt as dependencies and requirements-dev.txt as a dev group, with Python 3.12 as in environment.yml. Adds lifelines, which chapter 13 imports: its %pip install fallback fails in a uv environment, which has no pip. Checked with uv sync: every chapter notebook in nb/ and soln/ (0-14) runs headless without errors. --- pyproject.toml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1763c98 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,42 @@ +[project] +name = "thinkstats" +version = "0.1.0" +description = "Environment for running the Think Stats 3e notebooks and build tools" +# Matches environment.yml (python=3.12) +requires-python = ">=3.12,<3.13" +# From requirements.txt: everything the chapter notebooks import +dependencies = [ + "empiricaldist", + "html5lib", + "lxml", + "jupyter", + "numpy", + "matplotlib", + "seaborn", + "scipy", + "statadict", + "statsmodels", + "sympy", + "tables", + # Chapter 13 needs it; its %pip install fallback fails in a uv environment, which has no pip + "lifelines>=0.30.3", +] + +[dependency-groups] +# From requirements-dev.txt: formatting, notebook tests and the Jupyter Book build +dev = [ + "black", + "nb_black==1.0.5", + "flake8", + "nbformat", + "nbmake", + "pytest", + "jupytext", + "jupyter-book<2", + "ghp-import", + "sphinx-sitemap", + "sphinxext-opengraph", +] + +[tool.uv] +package = false