From 749c7057fa66fa71cb02bed1ac5ea6bed5860905 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 17 Nov 2026 09:13:35 +0100 Subject: [PATCH] Collect changelog entries as separate files using towncrier Every pull request added its changelog entry at the same place in `CHANGELOG.md`, so concurrent pull requests conflicted with each other. Now, each pull request adds its entry as a separate file `changelog.d/+..md` (see `changelog.d/README.md`). At release time, `towncrier build --version X.Y.Z` collects them into `CHANGELOG.md`. The unreleased 0.11.0 entry is moved to `changelog.d/`, and entries are added for #583, #584, #588, #590, #592 and #595, which did not add one. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 11 ++--- CONTRIBUTING.md | 2 + changelog.d/+bool2num.fix.md | 3 ++ changelog.d/+experiments-to-sbml-time.fix.md | 3 ++ changelog.d/+num2bool.fix.md | 5 +++ changelog.d/+pysb-is-state-variable.fix.md | 5 +++ ...ysb-pattern-from-string-strict.breaking.md | 3 ++ changelog.d/+sciml-hybridization-math.fix.md | 4 ++ changelog.d/+spec0.breaking.md | 4 ++ .../+sympify-boolean-piecewise.breaking.md | 4 ++ changelog.d/+v2-lint-time.fix.md | 4 ++ changelog.d/README.md | 43 +++++++++++++++++++ changelog.d/template.md.j2 | 9 ++++ doc/development.rst | 21 +++++++-- pyproject.toml | 42 ++++++++++++++++++ 15 files changed, 152 insertions(+), 11 deletions(-) create mode 100644 changelog.d/+bool2num.fix.md create mode 100644 changelog.d/+experiments-to-sbml-time.fix.md create mode 100644 changelog.d/+num2bool.fix.md create mode 100644 changelog.d/+pysb-is-state-variable.fix.md create mode 100644 changelog.d/+pysb-pattern-from-string-strict.breaking.md create mode 100644 changelog.d/+sciml-hybridization-math.fix.md create mode 100644 changelog.d/+spec0.breaking.md create mode 100644 changelog.d/+sympify-boolean-piecewise.breaking.md create mode 100644 changelog.d/+v2-lint-time.fix.md create mode 100644 changelog.d/README.md create mode 100644 changelog.d/template.md.j2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bb5cec2..4f28ff40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,11 @@ # PEtab changelog -## 0.11 series +Changes that are not released yet are collected in +[`changelog.d/`](https://github.com/PEtab-dev/libpetab-python/tree/main/changelog.d). -### 0.11.0 (unreleased) +## 0.11 series -**Breaking changes** -* Follow SPEC 0 instead of NEP 29 for minimum supported dependency versions. - Require `numpy>=2.2`, and for the `vis` extra, `matplotlib>=3.10` and - `scipy>=1.15` - (by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/578) + ## 0.10 series diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1cdde6af..58869dc2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,6 +13,8 @@ General: * Please document all modules, functions, classes, attributes, arguments, return values, ... in a style consistent with the rest of the library * Use descriptive commit messages +* For user-visible changes, add a changelog entry to `changelog.d/` + (see [`changelog.d/README.md`](changelog.d/README.md)) To contribute to this repository: diff --git a/changelog.d/+bool2num.fix.md b/changelog.d/+bool2num.fix.md new file mode 100644 index 00000000..9564f50e --- /dev/null +++ b/changelog.d/+bool2num.fix.md @@ -0,0 +1,3 @@ +Non-constant Booleans in numeric context, e.g., `1 + (x > 0)`, failed +with `TypeError`. They are now converted to `1.0` / `0.0` +([#584](https://github.com/PEtab-dev/libpetab-python/pull/584)) diff --git a/changelog.d/+experiments-to-sbml-time.fix.md b/changelog.d/+experiments-to-sbml-time.fix.md new file mode 100644 index 00000000..6192ca12 --- /dev/null +++ b/changelog.d/+experiments-to-sbml-time.fix.md @@ -0,0 +1,3 @@ +`ExperimentsToSbmlConverter` converts `time` in condition target values to +the SBML time csymbol instead of a constant parameter with value 0 +([#595](https://github.com/PEtab-dev/libpetab-python/pull/595)) diff --git a/changelog.d/+num2bool.fix.md b/changelog.d/+num2bool.fix.md new file mode 100644 index 00000000..ccda3a37 --- /dev/null +++ b/changelog.d/+num2bool.fix.md @@ -0,0 +1,5 @@ +Non-constant numeric expressions in Boolean context (operands of `&&`, +`||`, `!`, `piecewise` conditions) were treated as always `true`. +They are now `true` if non-zero, e.g., `!(x + 1)` is parsed to `x + 1 == 0` +instead of `0.0` +([#583](https://github.com/PEtab-dev/libpetab-python/pull/583)) diff --git a/changelog.d/+pysb-is-state-variable.fix.md b/changelog.d/+pysb-is-state-variable.fix.md new file mode 100644 index 00000000..943d0205 --- /dev/null +++ b/changelog.d/+pysb-is-state-variable.fix.md @@ -0,0 +1,5 @@ +Fixed `KeyError` in `PySBModel.is_state_variable`, and thus in PEtab v2 +validation, for PySB species with binding sites; `(state, bond)` tuples, +`MultiState`, lists of bonds, and complex-level compartments are now +supported +([#592](https://github.com/PEtab-dev/libpetab-python/pull/592)) diff --git a/changelog.d/+pysb-pattern-from-string-strict.breaking.md b/changelog.d/+pysb-pattern-from-string-strict.breaking.md new file mode 100644 index 00000000..cb2e3d0a --- /dev/null +++ b/changelog.d/+pysb-pattern-from-string-strict.breaking.md @@ -0,0 +1,3 @@ +`PySBModel.pattern_from_string` raises `ValueError` for unknown monomers, +sites, states, or compartments, instead of returning an incomplete pattern +([#592](https://github.com/PEtab-dev/libpetab-python/pull/592)) diff --git a/changelog.d/+sciml-hybridization-math.fix.md b/changelog.d/+sciml-hybridization-math.fix.md new file mode 100644 index 00000000..81e37a9d --- /dev/null +++ b/changelog.d/+sciml-hybridization-math.fix.md @@ -0,0 +1,4 @@ +PEtab SciML extension: Hybridization target values are written and +validated as PEtab math instead of sympy strings (e.g., `x^2` instead of +`x**2.0`), so written hybridization tables can be read again +([#590](https://github.com/PEtab-dev/libpetab-python/pull/590)) diff --git a/changelog.d/+spec0.breaking.md b/changelog.d/+spec0.breaking.md new file mode 100644 index 00000000..c353776f --- /dev/null +++ b/changelog.d/+spec0.breaking.md @@ -0,0 +1,4 @@ +Follow SPEC 0 instead of NEP 29 for minimum supported dependency versions. +Require `numpy>=2.2`, and for the `vis` extra, `matplotlib>=3.10` and +`scipy>=1.15` +([#578](https://github.com/PEtab-dev/libpetab-python/pull/578)) diff --git a/changelog.d/+sympify-boolean-piecewise.breaking.md b/changelog.d/+sympify-boolean-piecewise.breaking.md new file mode 100644 index 00000000..68979b02 --- /dev/null +++ b/changelog.d/+sympify-boolean-piecewise.breaking.md @@ -0,0 +1,4 @@ +`sympify_petab` now returns top-level Boolean expressions as numeric +expressions, e.g., `x > 0` as `Piecewise((1.0, x > 0), (0.0, True))` +instead of a relational +([#584](https://github.com/PEtab-dev/libpetab-python/pull/584)) diff --git a/changelog.d/+v2-lint-time.fix.md b/changelog.d/+v2-lint-time.fix.md new file mode 100644 index 00000000..210d8c4b --- /dev/null +++ b/changelog.d/+v2-lint-time.fix.md @@ -0,0 +1,4 @@ +PEtab v2 validation: `time` in condition target values, and in observable +or noise formulas of PySB or BNGL models, is no longer reported as a missing +parameter. A parameter table entry `time` is now reported as extraneous +([#588](https://github.com/PEtab-dev/libpetab-python/pull/588)) diff --git a/changelog.d/README.md b/changelog.d/README.md new file mode 100644 index 00000000..3c26755f --- /dev/null +++ b/changelog.d/README.md @@ -0,0 +1,43 @@ +# Changelog fragments + +Each pull request with user-visible changes adds its changelog entry as a +separate file to this directory, instead of editing `CHANGELOG.md` directly. +This avoids merge conflicts between pull requests. At release time, the +fragments are collected into `CHANGELOG.md` using +[towncrier](https://towncrier.readthedocs.io/). + +## Adding an entry + +Create a file `changelog.d/..md`, where `` is one of + +* `breaking`: **Breaking changes** +* `deprecation`: **Deprecations** +* `feature`: **Features** +* `fix`: **Fixes** +* `doc`: **Documentation** +* `misc`: **Other changes** + +and `` is `+` followed by a short descriptive name +(e.g., `+unused-placeholders.feature.md`). The name only needs to be unique; +it does not appear in `CHANGELOG.md`. + +The file contains the text of the entry as Markdown, without a leading +bullet, hard-wrapped at 79 characters. Describe the change from the user's +perspective, and end with a link to the pull request. +For example, `changelog.d/+unused-placeholders.feature.md`: + +```markdown +New validation task `CheckUnusedPlaceholders` warns about observable and +noise placeholders that are not used in the respective formulas +([#599](https://github.com/PEtab-dev/libpetab-python/pull/599)) +``` + +Changes that don't affect users, such as CI-only changes or refactoring, +don't need an entry. + +You can also create the file using `towncrier create`, e.g., +`towncrier create +unused-placeholders.feature.md`. towncrier is included in +the `test` dependency group. + +To preview the changelog section for the next release, run +`towncrier build --draft --version ` from the repository root. diff --git a/changelog.d/template.md.j2 b/changelog.d/template.md.j2 new file mode 100644 index 00000000..ef5db783 --- /dev/null +++ b/changelog.d/template.md.j2 @@ -0,0 +1,9 @@ +{% for section, _ in sections.items() %} +{% for category, val in definitions.items() if category in sections[section] %} +**{{ definitions[category]['name'] }}** +{% for text, values in sections[section][category].items() %} +* {{ text }} +{% endfor %} + +{% endfor %} +{% endfor %} diff --git a/doc/development.rst b/doc/development.rst index d48de966..1741ea18 100644 --- a/doc/development.rst +++ b/doc/development.rst @@ -34,10 +34,23 @@ Release process 1. Update the version number in ``petab/version.py``. -2. Update the changelog in ``doc/CHANGELOG.md``. - The update content can be generated automatically: - draft a new dummy GitHub release with a dummy tag and the ``develop`` - branch, then click :guilabel:`Generate release notes`. +2. Collect the changelog entries from ``changelog.d/`` into + ``CHANGELOG.md`` by running + `towncrier `__ + (included in the ``test`` dependency group) from the repository root: + + .. code-block:: shell + + towncrier build --version X.Y.Z + + This adds a new section for the release to ``CHANGELOG.md``, and removes + the collected fragments (``git rm``). Run with ``--draft`` to only preview + the result. Review the new section and edit it as necessary: + group related entries (e.g., by PEtab version or module), + reorder entries (they are sorted alphabetically within each category), + credit new contributors, and add the ``**Full Changelog**`` link. + For a new minor version, add a ``## X.Y series`` heading and move the + ```` marker below it. 3. Create a pull request with the to-be-released changes to the main branch (usually from ``develop``). diff --git a/pyproject.toml b/pyproject.toml index 5a48823b..9f592619 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,6 +71,8 @@ test = [ "pytest", "pytest-cov", "scipy", + # for collecting changelog entries, see changelog.d/README.md + "towncrier", "petabtests @ git+https://github.com/PEtab-dev/petab_test_suite@main", "benchmark_models_petab @ git+https://github.com/PEtab-dev/petab-benchmark-problems.git@main#subdirectory=src/python", ] @@ -140,3 +142,43 @@ docstring-code-format = true exclude = [ "petab/math/_generated/*", # auto-generated ] + +# Collecting changelog entries from changelog.d/, see changelog.d/README.md +[tool.towncrier] +name = "libpetab-python" +filename = "CHANGELOG.md" +directory = "changelog.d" +template = "changelog.d/template.md.j2" +start_string = "\n" +title_format = "### {version}" +underlines = ["", "", ""] + +[[tool.towncrier.type]] +directory = "breaking" +name = "Breaking changes" +showcontent = true + +[[tool.towncrier.type]] +directory = "deprecation" +name = "Deprecations" +showcontent = true + +[[tool.towncrier.type]] +directory = "feature" +name = "Features" +showcontent = true + +[[tool.towncrier.type]] +directory = "fix" +name = "Fixes" +showcontent = true + +[[tool.towncrier.type]] +directory = "doc" +name = "Documentation" +showcontent = true + +[[tool.towncrier.type]] +directory = "misc" +name = "Other changes" +showcontent = true