Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

utme-1.0.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

utme-1.0.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file utme-1.0.1.tar.gz.

File metadata

  • Download URL: utme-1.0.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for utme-1.0.1.tar.gz
Algorithm Hash digest
SHA256 deddb326f9fd387f1de0cf1be3eba7a76618f8d33858f7f641369b1e3ab7ba0c
MD5 10cbc05bd33f595647593fec4063ea74
BLAKE2b-256 ab5661d3357997803e722074a033cc5b6960a7eb78455c01e70857d1d22b9550

See more details on using hashes here.

File details

Details for the file utme-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: utme-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for utme-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1097acbb6170df0180752324224f8813a379655700693900c0d6a9e92d1e65a8
MD5 bc365ef32c5712bb595b8ac66c478d84
BLAKE2b-256 21a4f4b307e2f16d3b8ff0b5dbec0af17b4645d4688876a98ff827912958b5ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page