Universal Turing Machine Emulator.
Project description
Universal Turing Machine Emulator
utme is a library that provides Turing machine emulation in pure Python.
With utme, you can define a Turing machine, run it with an input and inspect its output.
Note: I wrote this library to help myself understand Turing machines. utme is not suitable for efficient/performant Turing machine emulation.
Why is it called universal?
As the library allows you to define any valid Turing machine (universal or not) and run it, the library itself is equivalent to a universal Turing machine (a Turing machine that accepts another Turing machine and an input for it, and yields its output).
While utme does not emulate a universal Turing machine by itself, I found
the name cool (It was originally utm, but then I found out it was already
taken by another project on PyPI).
That said, there is an example script that
composes universal_machine; a universal Turing machine using utme.
The script also provides encode/decode functions that converts utme
objects from and into valid tapes for universal_machine (so you can even pass
universal_machine (with an input) to itself!).
Installation
utme is available in the Python Package Index:
pip install utme
The library has zero dependencies and should work on any Python (3.12+) implementation on any platform.
Documentation
utme's API is documented at the definition level (via docstrings where possible, and comments otherwise).
The library code is around 250 logical line of codes, so you can easily read the source code to understand implementation details.
Exported objects are categorized and enumerated briefly in the package's docstring:
python -m pydoc utme
Examples
Examples of Turing machines implemented using utme are included in the examples directory.
Development
You only need uv and just on your POSIX system to get
started.
Run just (without arguments) to see available tasks.
Contribution
Before you submit a patch, please run just precommit and make sure the task
runs successfully. Patches that don't pass just precommit will not be
merged.
License
utme is licensed under the MIT (Expat) license.
Copyright (C) 2025 Karam Assany (karam.assany@disroot.org)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file utme-1.0.0.tar.gz.
File metadata
- Download URL: utme-1.0.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84372d1b753769fb65052793c89b7e6d105e1532fce5fef7fe4273a624ea5e09
|
|
| MD5 |
3b93033e21aeb5d15e9983d15bdee156
|
|
| BLAKE2b-256 |
73fc30131b2fe4a9b36fff909f72f3bb97c46e816e2744d90d82873aa1679a40
|
File details
Details for the file utme-1.0.0-py3-none-any.whl.
File metadata
- Download URL: utme-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58204d473ed6ff2f09230105a8fbfb8760df74a1a59dade7a52d1ab398c6961e
|
|
| MD5 |
6444a0b308854b80b16759326f1ddfe8
|
|
| BLAKE2b-256 |
a7b1ef26fafd066b0945064670dc0422f0cf428d02e372f2c7f1dc618dbf7e82
|