Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

pytcl

Pure Python TCL interpreter and parser library.

Installation

pip install pytcl

Usage

Interpreter

from pytcl.interpreter import Interpreter

i = Interpreter()
i.substitute_string("set x 42")         # "42"
i.substitute_string("expr {$x * 2}")    # "84"
i.substitute_string("set x")            # "84"

Evaluate a .tcl file:

from pathlib import Path
from pytcl.interpreter import Interpreter

i = Interpreter()
i.substitute_file(Path("script.tcl"))

Custom commands

Commands are plain callables stored in the namespace:

from pytcl.interpreter import Interpreter

i = Interpreter()
i.namespace["double"] = lambda args, ns: str(int(args[0]) * 2)
i.substitute_string("double 21")  # "42"

Parser

Parse Tcl source into a typed tree without executing it:

from pytcl.words import TCLScript

script = TCLScript.read(iter("set x [expr {1 + 2}]"))
for command in script.commands:
    print(command.name, command.args)

Built-in commands

set, unset, expr, if / elseif / else, while, foreach, proc, return, break, continue, incr, append, puts, error

Development

uv sync --all-extras        # install dependencies
uv run pytest               # unit tests
uv run pytest integrations/ # integration tests (requires Docker)
uv run ruff check .         # lint
uv run pre-commit run --all-files

Metadata

Release files for pytclsh 0.0.2

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

Source distribution (sdist)

Source distribution for pytclsh 0.0.2
File Size Uploaded Provenance
pytclsh-0.0.2.tar.gz 7.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytclsh 0.0.2
File Interpreter ABI Platform
pytclsh-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.6 kB

Release files / pytclsh-0.0.2.tar.gz

Download URL pytclsh-0.0.2.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6633c31f06a3b87cf8abaab8381069e9d01b2965dc2e99b6ba4e9ce7330ecc72
BLAKE2b-256 checksum
How to use checksums
b7d3225ec52158972fa43202305d6556472c02580287f42eac853a25a22c8850
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 3, 2026.

Transparency log

Release files / pytclsh-0.0.2-py3-none-any.whl

Download URL pytclsh-0.0.2-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
350a4c4d15991a86126eab40494eb5d013acf1283da4fad9ec8887ac775175c2
BLAKE2b-256 checksum
How to use checksums
9eaa542030d6423d51a7e39b9c76d16fd5fe3e7afff5ba3825730d87842b7506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 3, 2026.

Transparency log

Security for pytclsh 0.0.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pytclsh-0.0.2.tar.gz

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 Apr 3, 2026.

Transparency log

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.

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