Prompteer

Latest version: v0.4.0

Safety actively analyzes 993520 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.4.0

Fixed
- **Braces inside injected values were misread as unresolved variables** -
Rendering is now a single pass, so `{...}` contained in a value is no longer
interpreted as a variable. Common inputs such as
`render_template("A: {a}", {"a": "React {children} usage"})` used to fail with
`TemplateVariableError`. Detection of genuinely missing variables is unchanged.
- Applies to every rendering path: plain templates, `{if}`, `{for}`, and dot notation.
- **Non-deterministic output from `render_template_safe()`** - It applied
`str.replace` once per variable, so the result depended on substitution order
(hash seed). Now uses the shared pipeline, removing the order dependency.
- **`render_template_safe()` did not substitute dot notation** - `{user.name}`
was left as-is even when a value was supplied.
- Missing `Prompteer` import in `examples/advanced_usage.py`.

Added
- **Brace escaping** - `{{` and `}}` produce literal braces. To write
`{children}` verbatim in a prompt, escape it as `{{children}}`.
- `blocks.substitute_variables()` - the single substitution implementation (public API)
- `blocks.VARIABLE_PATTERN`, `blocks.BLOCK_KEYWORDS`
- 27 regression tests for braces in injected values (`tests/test_brace_injection.py`)

Changed
- Rendering was restructured into a single pass. A template is scanned exactly
once, and output produced by substitution is never reinterpreted as a variable.
- `render_template()`, `render_template_safe()`, and
`render_template_with_defaults()` now share one rendering core.
- `extract_variables()`, `extract_all_variables()`, and `validate_template()`
recognize escaped braces.

Breaking
- **`{{foo}}` changes meaning.** It used to render as `{` + the value of `foo` +
`}`; it now renders as the literal `{foo}`. Code that used escaping as a
workaround should drop it at value-injection sites (escaping intended for
literal braces in the template itself keeps working as written).
- **Partial dot-notation failures now raise.** If `user` exists but has no `name`
attribute, `{user.name}` raises `TemplateVariableError` instead of silently
leaving the placeholder.
- **`render_template_safe()` substitutes dot notation.** Where `{user.name}` was
previously left verbatim, the value is now inserted.
- Internal helpers `template._substitute_variables()` and
`blocks._substitute_text_variables()` were merged into
`blocks.substitute_variables()` and removed.
- **Minimum Python is now 3.9** (previously declared as 3.7). 3.7 has no
verification path (neither uv nor GitHub runners provide it) and 3.8 reached
EOL in 2024-10. 3.9 through 3.13 are verified by the CI matrix.

Infrastructure
- GitHub Actions CI (`.github/workflows/test.yml`) - runs tests, doctests, and
the example scripts across Python 3.9-3.13 on every push and pull request.
- Automated PyPI releases (`.github/workflows/release.yml`) - publishing is
triggered only by pushing a `v*` tag and uses Trusted Publishing (OIDC), so no
API token is stored anywhere. The build fails if the tag and the package
version disagree.

Known limitations
- Block tags cannot be escaped; `{{if x}}` is still parsed as a block.
- `validate_template()` still reports syntax the renderer ignores (`{"key": 1}`,
`{na me}`) as invalid. This function is not called on the rendering path.

0.3.0

0.2.1

0.2.0

0.1.0

Links

Releases

© 2026 Safety CLI Cybersecurity Inc. All Rights Reserved.