A Fast, spec compliant Python 3.14+ tokenizer

0.4.1 · active · verified Sat Mar 28

Pytokens is an open-source Python library providing a fast, spec-compliant tokenizer for Python 3.14+ that is also capable of running on older Python versions (>=3.8). Currently at version 0.4.1, it appears to be actively maintained with recent releases focusing on packaging and development improvements.

Warnings

Install

Imports

Quickstart

Pytokens is primarily designed for command-line usage to tokenize Python files. This example demonstrates tokenizing a simple Python file. The output will be a stream of tokens (e.g., NAME, STRING, OP, etc.) representing the input file's content.

echo "print('Hello, World!')" > example.py
python -m pytokens example.py

view raw JSON →