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 nrevah-pytcl 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| nrevah_pytcl-0.0.4.tar.gz | 8.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nrevah_pytcl-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.0 kB
Release files / nrevah_pytcl-0.0.4.tar.gz
| Download URL | nrevah_pytcl-0.0.4.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ef7d9954e33c623d45098691f4f756f75f0b278a4c32dfa26a53076964008a2
|
|
BLAKE2b-256 checksum How to use checksums |
7603b0ef791071499281e0fb2296d31591b1171925d630d4d1ed214106c9f9c4
|
| 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 11, 2026.
Transparency logRelease files / nrevah_pytcl-0.0.4-py3-none-any.whl
| Download URL | nrevah_pytcl-0.0.4-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e24a336aec2a67f40978f2fd32064cb9008cd537b17ad837d2a0ee3a16f8f426
|
|
BLAKE2b-256 checksum How to use checksums |
ae3ae88869a5d5d95e7bdceed2cdce5e9dc8cba5cedb31cd50e81bb364a95f8a
|
| 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 11, 2026.
Transparency logSecurity for nrevah-pytcl 0.0.4
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.
Attestation for nrevah_pytcl-0.0.4.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 11, 2026.
Transparency logA 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.