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.1

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.1
File Size Uploaded
copperlace-0.3.1.tar.gz 47.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for copperlace 0.3.1
File
copperlace-0.3.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
copperlace-0.3.1-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details
copperlace-0.3.1-py3-none-manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64 Details
copperlace-0.3.1-py3-none-macosx_11_0_universal2.whl Python 3 none macOS 11.0+ universal2 (ARM64, x86-64) Details
copperlace-0.3.1-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.1.tar.gz

Download URL copperlace-0.3.1.tar.gz
Size 47.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3ebb56b09d9f786e000fad8185e34f9151ac69f332d37dfd96674254badf2dab
BLAKE2b-256 checksum
How to use checksums
5f4476c119cb6b40442968fe6b0389e7fbd0e73a56f8e09b03a667e27f865d14
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.1-py3-none-win_amd64.whl

Download URL copperlace-0.3.1-py3-none-win_amd64.whl
Size 1.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
9f5e64c245e362586161a2748a880843c1cb68045627f8263029019bd89db5ce
BLAKE2b-256 checksum
How to use checksums
d1e02b01c9b922fdbb0ca673b0bd1e313e0de4749a370ee168c56fbd6d9f9c47
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.1-py3-none-manylinux_2_34_x86_64.whl

Download URL copperlace-0.3.1-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
eaabb37203e9335819d9648fb8274437866fc96c298a9b8d902c9e3b7667dc79
BLAKE2b-256 checksum
How to use checksums
6cea74f02bfcfae939908c78790354ce7f5ca824f03f6aaf8531369253d5b805
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.1-py3-none-manylinux_2_34_aarch64.whl

Download URL copperlace-0.3.1-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
f71579812199431ccf34db526c1b5aaf1601fc74cebb322b1ef9700dac6def58
BLAKE2b-256 checksum
How to use checksums
5b7ddd5c67113afebc3a394b0fdbd1ee6f1fa29f49be2e79468b1cf993994992
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.1-py3-none-macosx_11_0_universal2.whl

Download URL copperlace-0.3.1-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
d7399047a670ccb27d30d2d764ddaf320a0a90478b99811a85fc5a3662bec5cd
BLAKE2b-256 checksum
How to use checksums
9a8b857f733d19b27cb44cdbbf222d6ea9ad7594067359b328b89b299609d2a8
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.1-py3-none-macosx_10_13_universal2.whl

Download URL copperlace-0.3.1-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
7f67f283e870753861a6ad0ce93506de44876a560e988cdfae02d80b7ddbd037
BLAKE2b-256 checksum
How to use checksums
641213965af2e7b295715fe50c7bc12c9b97b9d38ae22411f4ae08522e4c9bc4
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

This release

0.3.1 This release

6 release files

0.3.0

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