Skip to main content

Clem

PyPI version

Simple and lightweight text variation/formatting language written in pure Python.

Installation

pip install clem

Usage

Example .clem file

# Sections are optional, and contained within parenthesis
greeting (
    # [indicator] | [content]
    # The indicator is used to find the line in your Python program. It's referenced as 'section.indicator'.

    # You can add decisions by putting choices inside angle-brackets. Clem will select one at random.
    casual | How's it <hanging / going>, <bro/dude/dog/man>?

    # You can also nest decisions. (If a decision only contains one choice, it will be treated as an optional.)
    casual | I <<sincerely> hope / think> you will <have fun during / enjoy / <forever> remember> your stay.

    # You can set a choice's odds by prefixing it with '[number]:'. If ommitted this will default to 1.
    casual | <Sup / What's up>, my <2: dog / cat>? <Welcome to {location}.>

    # Remember you can make as many different indicators as you want.
    formal | Greetings, my <dear> <man / friend>. I <sincerely> hope you enjoy your <time/stay> here in {location}.
)

Using Clem in Python

from clem import Clem

clem = Clem()

# Load in lines
clem.load_file("example.clem")
# Add a new one at runtime
clem.add("casual | hi there! my name is <Jack <Black / White> \
         / Selena <Gomez>>.", "greeting")

# Print out line
print("Casual: ", clem.render("greeting.casual", location="Boston"))
print("Formal: ", clem.render("greeting.formal", location="Covington"))

History

Origin

Clem was originally developed for [Fallout Simulator 2] (https://github.com/jakeledoux/fsim2) and based on the primitive templating system of its predecessor, [Fallout Simulator] (https://jakeledoux.itch.io/falloutsim). You can read the original format specification here. This version of Clem, originally titled Clem2, was adapted from the game's code to better structure the logic and to remove dependencies so that it could run independent of the game.

Name

The Clem language is named after a user by the name of 'qclem', who contributed to the content and localisation of the templates for the original Fallout Simulator.

Metadata

Release files for clem 0.1.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 clem 0.1.0
File Size Uploaded
clem-0.1.0.tar.gz 12.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for clem 0.1.0
File Interpreter ABI Platform
clem-0.1.0-py3.9.egg Legacy Egg format - - Details
clem-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / clem-0.1.0.tar.gz

Download URL clem-0.1.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3ab74545b4eaa591a96826dc1739bf8462cf19c0b0e740fe872b7a1606e962b8
BLAKE2b-256 checksum
How to use checksums
673749792905043cc0c866242ad98b420673c7b34be024b106db7e88b31bff57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release files / clem-0.1.0-py3.9.egg

Download URL clem-0.1.0-py3.9.egg
Size 9.2 kB
Tags Egg
SHA-256 checksum
How to use checksums
6474216068cf602628755f197d64447cea9d027db59b92758d49928cd3ebdf64
BLAKE2b-256 checksum
How to use checksums
c17127e9c0dedae843d1a80cfc82785e685ff25aeb323f7576f3d01b04d91c9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release files / clem-0.1.0-py3-none-any.whl

Download URL clem-0.1.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e10655c92423012316fd99ada87344a2e0e589f2362eee862eaad6040d7c319
BLAKE2b-256 checksum
How to use checksums
ef7682cba264066ff2c0144b14388966ebd7f1e9832f9c7ad9b664c6c31ea10a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.1.0 This release

3 release files

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