Changelog
This changelog is generated automatically from GitHub Releases.
v0.2.2
2026-11-07 · GitHub
Security
- render_partial strips surrounding whitespace from a name before checking it, as Chameleon’s loader does before loading it. The 0.2.1 check saw the unstripped name, so a leading space, tab, or newline (
' ../secret.pt') passed the check as the folder' ..'and then loaded the file outside the template folder. Stripping first makes the check and the loader see one string; a harmless name with surrounding whitespace still renders, as before.
Fixed
- Every spelling of a partial now compiles and caches one template. Chameleon’s loader caches by the exact name it is given, so
./shared/card.pt,shared//card.pt,shared/../shared/card.pt, and whitespace variants each kept their own compiled copy for the life of the process, which a request-chosen name could grow without bound. Names are normalized first; distinct case spellings on a case-insensitive filesystem still cache separately. - A name that is a folder (
partials,partials/,.) raisesValueError(Template not found: ...) instead of leaking anIsADirectoryErrorfrom inside Chameleon.
Added
_template_name(template_file, folder), the single function render_partial now resolves names through. It returns the normalized name to load orNonefor a refused or missing one. chameleon-rs calls it when it renders a partial on behalf of this package, so both engines share one check.- Guidance in the render_partial docs and README: choose the partial in code and map any request value to a name you wrote, and pass the model as named keyword arguments rather than spreading request parameters into it.
Changed
- The minimum supported Python is now 3.10 (
requires-python >= 3.10), and the 3.9 trove classifier is gone. Chameleon itself still supports 3.9; stay on 0.2.1 if you need it.
Documentation
- A user guide on the docs site, also included in
llms-full.txt: getting started, writing partials (path resolution, the model, nesting, loops, METAL layouts, rendering from Python, choosing partials safely), testing, and a troubleshooting page that lists every error the package or Chameleon raises in normal use with its cause and fix. The README links each page and gained Testing and Troubleshooting sections. - The agent skill (
skill.mdand the.well-knowncopies) is now hand-written inskills/chameleon-partials/SKILL.mdand copied verbatim by Great Docs, replacing the generated one. It states the rules an agent would otherwise get wrong (path resolution, the one-shot registration, the error contract, reserved model names, theHTMLwrapper), a decision table, the API with what each name raises, and real output. - The module docstring names the four public entry points, the
HTMLwrapper, and the error contract, since it is the first thing an agent sees on import. scripts/build_docs.pynow fails whenllms.txt,llms-full.txt,skill.md, or a.well-knownskill file is missing from the built site. Great Docs reports success even when it could not import the package to writellms-full.txt.- The example app’s own test suite passes again:
tests/test_views.pyimported amy_viewthat no longer existed and now tests theindexview,test_functional.pyasserts on the rendered partials rather than on text the home page never had, and theVideomodel’s optionalcategoryfield has a default so the app loads under pydantic 2.
PyPI: https://pypi.org/project/chameleon-partials/0.2.2/
v0.2.1
2026-11-07 · GitHub
Security
- render_partial refuses names that would load a file outside the registered template folder: an absolute path, a
..out of the folder, or apackage:pathspec. These used to reach Chameleon’s loader as is, which loaded the file and ran it as a template; they now raise Chameleon’s ownValueError(Template not found: ...), as a missing file does. A..that stays inside the folder still works, and the check is lexical, so a symlink inside the folder is still followed.
PyPI: https://pypi.org/project/chameleon-partials/0.2.1/
v0.2.0
2026-06-11 · GitHub
[0.2.0] - 2026-06-10
Added
- Google-style docstrings, complete type annotations, and runnable usage examples for the public API (register_extensions, render_partial, extend_model, PartialsException) and the internal
HTMLwrapper. - PEP 561
py.typedmarker, so type checkers consume the package’s inline type annotations; the package checks clean undertyandpyrefly, which join the dev requirements. - Documentation site rendered from those docstrings with Great Docs, published at https://mkennedy.codes/docs/chameleon-partials/. Includes
scripts/build_docs.pyandscripts/serve_docs.py; the built site is committed indocs/, andgreat-docsjoins thedevextra (skipped automatically on Python < 3.11). - Project URLs in the package metadata for the PyPI sidebar — Issues, Changelog, and Funding (GitHub Sponsors) — alongside the existing Homepage, Repository, and Documentation links.
- Pyramid
BeforeRendermiddleware pattern, documented in the README and wired into the example app, so views do not have to add render_partial to every model by hand. - Test suite (
tests/test_rendering.py) covering bare renders, partials with data, layouts, nested (recursive) partials, and error conditions. - Pytest configuration (
[tool.pytest.ini_options],testpaths = ["tests"]) so a barepytestfrom the repo root runs only the package’s tests instead of erroring while collecting the standaloneexample/app’s suite (which needs Pyramid and WebTest). - This changelog.
Changed
- Packaging migrated from
setup.pyto a PEP 621pyproject.toml. The version stays single-sourced inchameleon_partials/__init__.pyand dependencies inrequirements*.txt(read dynamically), so the built wheel is unchanged aside from added project URLs. - Raised the minimum supported Python from 3.6 to 3.9 (3.6-3.8 are end-of-life and match no supported Chameleon release). Trove classifiers now cover Python 3.9-3.14, and the development status is Production/Stable.
Fixed
- register_extensions no longer marks the extension as registered when registration fails. The flag used to be set before the template folder was validated, so a failed call left the library flagged as registered and a later retry with the default
cache_init=Truesilently did nothing. Failed registrations can now simply be retried. (Behavior change.) - extend_model’s type annotation now accepts
None(Optional[Dict[str, Any]]), matching its documented and actual behavior. - Ruff’s
target-versionis nowpy39to matchrequires-python(waspy313), so Ruff won’t rewrite code into newer-only idioms that would break on Python 3.9. - README accuracy: the Pyramid startup snippet now imports
Configurator, the listing snippet matches the example app’s template (span, notdiv), and several typos were corrected: “incredible easy”, “subtitle of author”, “them middleware”, and “veiws” (#2, thanks @hodgesd).