Skip to main content

Copperlace Python

Python wrapper for the Copperlace renderer.

The wheel build runs Cargo for ../rust-core, bundles the resulting native library, and exposes a small Python API over the Copperlace C ABI.

from copperlace import Copperlace

with Copperlace.from_string('name = ["Mia"]\norigin = "{name}"') as copperlace:
    print(copperlace.render("origin"))
    print(copperlace.render("origin"))
    print(copperlace.render("origin", {"name": "Darcy"}))

with Copperlace.from_string(
    'name = ["Mia"]\norigin = "{name | shout}"',
    {"shout": lambda value: value.upper()},
) as copperlace:
    print(copperlace.render("origin"))

Recursive rule references are errors by default. Pass max_recursion_depth to allow limited recursive expansion; recursive calls beyond the limit return an empty string:

from copperlace import render_str

print(render_str('origin = "x{origin}"', "origin", max_recursion_depth=1))
# xx

Structured rendering returns JSON strings for object-valued rules:

from copperlace import render_str_structured

config = """
name = ["Mia"]
origin {
  title = "Hello {name}"
  tags = ["structured", "{name | slug}"]
  count = 3
  active = true
  missing = null
}
"""

print(render_str_structured(config, "origin"))
# {
#     "active": true,
#     "count": 3,
#     "missing": null,
#     "tags": [
#         "structured",
#         "mia"
#     ],
#     "title": "Hello Mia"
# }

RuleSet.render_structured, Copperlace.render_structured, render_str_structured, and render_file_structured return formatted JSON strings from the native renderer.

Use inferred rendering when callers want the CLI-style behavior from one method: text rules return text, list rules keep random text choice behavior, and object-valued rules return a formatted JSON string.

from copperlace import render_str_inferred

print(render_str_inferred(config, "origin"))

Release files for copperlace 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for copperlace 0.3.0
File Size Uploaded
copperlace-0.3.0.tar.gz 47.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for copperlace 0.3.0
File
copperlace-0.3.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
copperlace-0.3.0-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details
copperlace-0.3.0-py3-none-manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64 Details
copperlace-0.3.0-py3-none-macosx_11_0_universal2.whl Python 3 none macOS 11.0+ universal2 (ARM64, x86-64) Details
copperlace-0.3.0-py3-none-macosx_10_13_universal2.whl Python 3 none macOS 10.13+ universal2 (ARM64, x86-64) Details

Total release size: 6.7 MB

Release files / copperlace-0.3.0.tar.gz

Download URL copperlace-0.3.0.tar.gz
Size 47.4 kB
Tags Source
SHA-256 checksum
How to use checksums
93ac76f5d6d56be92a7921a71354bbeaa580e471a65d794962b7378e260bb6ef
BLAKE2b-256 checksum
How to use checksums
91906d94b6ea5d1920ed8eb6c49f68a90017d07a945f2de99af7848e3f8f9b06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release files / copperlace-0.3.0-py3-none-win_amd64.whl

Download URL copperlace-0.3.0-py3-none-win_amd64.whl
Size 1.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
7daca552bec8f7e4efdecc3c7482121ab85de5e123aa2ee7fefd0f0b3282f396
BLAKE2b-256 checksum
How to use checksums
3da448d6d167790dc9507c388a7f5b37be86952653dae6c12aaf4e4969b18929
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release files / copperlace-0.3.0-py3-none-manylinux_2_34_x86_64.whl

Download URL copperlace-0.3.0-py3-none-manylinux_2_34_x86_64.whl
Size 1.5 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
026e9e19c8039d908f39a3f30a6adad8b00925d5c6facedd9dafb1bbb0c6b313
BLAKE2b-256 checksum
How to use checksums
7f4a9918c7f0b9a8abc50b01115a515efbf85830266b2c1de18f527beb994385
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release files / copperlace-0.3.0-py3-none-manylinux_2_34_aarch64.whl

Download URL copperlace-0.3.0-py3-none-manylinux_2_34_aarch64.whl
Size 1.4 MB
Tags Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
2cec3e85b12d7cc7826ba374d4de1f36831c17f7a808d2a879d67c6e1582e0dc
BLAKE2b-256 checksum
How to use checksums
ca1ad6b865a77c4e74568ab9899d8d4474515d09602de20e8dc70d41f136d6f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release files / copperlace-0.3.0-py3-none-macosx_11_0_universal2.whl

Download URL copperlace-0.3.0-py3-none-macosx_11_0_universal2.whl
Size 1.3 MB
Tags Python 3 macOS 11.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
116a9694438333c6ddb3a009ca5e360837193e712067b5849c248f405969c461
BLAKE2b-256 checksum
How to use checksums
e54402c4a2518a39691890432613b3f089e11a6c22c11f876bbf50332e8aec0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release files / copperlace-0.3.0-py3-none-macosx_10_13_universal2.whl

Download URL copperlace-0.3.0-py3-none-macosx_10_13_universal2.whl
Size 1.3 MB
Tags Python 3 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
e5af0c234065d0e7356ec57de4810e7246ea075c50cf06840df69bc7f58cbe55
BLAKE2b-256 checksum
How to use checksums
20435ce31cb86be7145793d93ccc6b07ba442e4b655a03b07283e2bd96b49d29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.2

7 release files

0.4.1

7 release files

0.4.0

6 release files

0.3.1

6 release files

This release

0.3.0 This release

6 release files

0.2.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page