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.4.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.4.0
File Size Uploaded
copperlace-0.4.0.tar.gz 57.7 kB Details

Built distributions (wheels)

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

Total release size: 7.1 MB

Release files / copperlace-0.4.0.tar.gz

Download URL copperlace-0.4.0.tar.gz
Size 57.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7ac904f19d1c04f6ced4ca16836d6637b6eecf8879613b06eb2b634b149ea205
BLAKE2b-256 checksum
How to use checksums
d7a450605cf3d4f01f5ebcc742af851f105b2f8ef0ec7b5735efcc2311155115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

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

Download URL copperlace-0.4.0-py3-none-win_amd64.whl
Size 1.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d4ce536948b9b555e85ae27254cccc749947baca3a409446b22037ecd056ecc5
BLAKE2b-256 checksum
How to use checksums
d1d78e3862e6d5025711cd13aa24059c4dcbcfaa12eeb72288c5072f1024673b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

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

Download URL copperlace-0.4.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
adef20e2eb1b92b0636a281da10d13b81557cbaa622a74ca796513e6ed168624
BLAKE2b-256 checksum
How to use checksums
92671c1e1ff247b15761862eaa42fa4f8b63bd856743c742dc98858f8ce32d30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

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

Download URL copperlace-0.4.0-py3-none-manylinux_2_34_aarch64.whl
Size 1.5 MB
Tags Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
8f18d8116f63bdf7acb86e0fd1ae158e89c759995ab37fdae18dcb070f53cb8d
BLAKE2b-256 checksum
How to use checksums
3ecfb4700b7e2fc8af4919eba9ba22c201545d49e0f38b0944fd410fc106173f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

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

Download URL copperlace-0.4.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
c772192d1e451e772ab2adfc2e4657f08eb7a7c6cbce84e3137a799e467a17a2
BLAKE2b-256 checksum
How to use checksums
2c8e15a2c82f122f7bd8184ce08fec6a97887685e62e1f4436ca04020b2a4752
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

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

Download URL copperlace-0.4.0-py3-none-macosx_10_13_universal2.whl
Size 1.4 MB
Tags Python 3 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
713a18fc78a472e7013a7345b13e681ed0b265eefab5e6c775191731110749e9
BLAKE2b-256 checksum
How to use checksums
27cf879637501ec6ebd1572113292472c0f2932865744218234acfbfc4a0945d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.2

7 release files

0.4.1

7 release files

This release

0.4.0 This release

6 release files

0.3.1

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