diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d58eba4..84d92c22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change ## [Unreleased] +### Fixed + +- Fix bug with packaging core pretext resources that prevented most recent commit from running. + ## [2.41.1] - 2026-06-07 Includes updates to core through commit: [fc8221d](https://github.com/PreTeXtBook/pretext/commit/fc8221d5b8e7027f686729102e169c482fbd1fe5) diff --git a/pyproject.toml b/pyproject.toml index bf8a5920..4477a178 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ authors = [ "Steven Clontz ", ] license = "GPL-3.0-or-later" -include = ["pretext/core/pretext.py", "pretext/core/braille_format.py", "pretext/resources/*.zip", "pretext/resources/*.json"] +include = ["pretext/core/*.py", "pretext/resources/*.zip", "pretext/resources/*.json"] # Dependencies # ------------ diff --git a/tests/test_utils.py b/tests/test_utils.py index 28bfa343..96dd1546 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,4 +1,6 @@ +import fnmatch import os +import sys import pytest from pathlib import Path from pretext import utils @@ -117,6 +119,39 @@ def test_is_earlier_version() -> None: assert not utils.is_earlier_version("2.11.5.dev0", "2.11.5") +def test_core_modules_included_in_package() -> None: + if sys.version_info >= (3, 11): + import tomllib + + opener = lambda p: open(p, "rb") # noqa: E731 + loader = tomllib.load + else: + import toml + + opener = lambda p: open(p, "r") # noqa: E731 + loader = toml.load + + root = Path(__file__).parent.parent + with opener(root / "pyproject.toml") as f: + config = loader(f) + + includes: list[str] = config["tool"]["poetry"]["include"] + + core_dir = root / "pretext" / "core" + core_files = [ + str(p.relative_to(root)) + for p in sorted(core_dir.glob("*.py")) + if p.name != "__init__.py" + ] + + for rel_path in core_files: + covered = any(fnmatch.fnmatch(rel_path, pat) for pat in includes) + assert covered, ( + f"{rel_path} is not covered by any entry in pyproject.toml [tool.poetry] include.\n" + f"Add it explicitly or use a glob like 'pretext/core/*.py'." + ) + + def test_hash_path(tmp_path: Path) -> None: # hash_path should return a 10-character hex string. result = utils.hash_path(tmp_path)