Skip to main content

kamo

almost subset of mako. this is a toy package.

don’t use in production!!

# -*- coding:utf-8 -*-
import logging
from kamo import Template
logging.basicConfig(level=logging.DEBUG)


template = Template("""
<%
def decorate(s):
    return "** {} **".format(s)
%>
<%!from datetime import datetime%>

${greeting|decorate}
${name}: this is my first sample! (now: ${datetime.now()})
""")


print(template.render(name="foo", greeting="chears"))
print("----------------------------------------")
print(template.render(name="boo", greeting="chears"))

generated function is such as below.

from datetime import datetime


def render(io, **c):
    write = io.write
    def decorate(s):
        return "** {} **".format(s)

    write(str(decorate(c['greeting'])))
    write('\n')
    write(str(c['name']))
    write(': this is my first sample! (now: ')
    write(str(datetime.now()))
    write(')\n')

lookup template

foo.kamo

${name}: yup

foo.py

from kamo import TemplateManager
tm = TemplateManager(directories=["."])
template = tm.lookup("foo.kamo")    # find template from ["./foo.kamo"]
print(template.render(name="foo"))

Metadata

Release files for kamo 0.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 kamo 0.0
File Size Uploaded Provenance
kamo-0.0.tar.gz 9.4 kB Without provenance Details

Release files / kamo-0.0.tar.gz

Download URL kamo-0.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9012b4d8c5daaf7cec97a91025e4de51c0e721be37a0fe6043844b2b650da92d
BLAKE2b-256 checksum
How to use checksums
a44878d357d251ceef306d5773c01f0c0b2662763ec1cf199d0b1bbedd319aec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for kamo 0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0 This release

1 release file No provenance

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