skillfed

bfi

A fast optimizing Brainfuck interpreter in pure python

bfi v1.1.1 338.5K downloads/30d#7,430 on PyPI14
Permissive license MIT AGING released

What it is and what it does

bfi is a pure-Python interpreter for Brainfuck, an esoteric programming language. It works by first compiling Brainfuck source code into an intermediate bytecode form that collapses common instruction sequences—such as runs of cell pointer movements—into single optimized operations. This compilation step allows bfi to execute Brainfuck programs significantly faster than naive interpreters that process each source character individually.

The package supports both Python 2 and Python 3, has no external runtime dependencies, and can be used either from the command line (via the `bfi` command) or imported as a module in your own code. It includes configurable tape size (default 30,000 cells) and wrapping overflow/underflow behavior. The package ships with example Brainfuck programs demonstrating various algorithms and games.

Use it for:

  • Run Brainfuck programs from the command line without installing a separate interpreter or compiler
  • Execute Brainfuck code programmatically from Python, capturing output or providing custom input
  • Learn or teach esoteric language design and compilation techniques through a working pure-Python example
  • Benchmark or compare Brainfuck interpreter performance across implementations

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pure-Python interpreter for Brainfuck that compiles source code into an optimized intermediate form for faster execution than direct interpretation.

Yes, if you need to run or study Brainfuck code. The package is lightweight, dependency-free, and genuinely faster than comparable pure-Python alternatives. However, maintenance is aging (last release 279 days ago), so treat it as stable but not actively developed. Not relevant for production systems or non-Brainfuck use cases.

Install

bfi on PyPI

pip

pip install bfi

uv

uv add bfi

poetry

poetry add bfi

Installing bfi

Before you install

Low friction install with no runtime dependencies. Maintenance is aging—last release was 279 days ago, though the repository remains active and the package has been stable since its first release in 2017.

License in practice

MIT license permits unrestricted use, modification, and distribution with minimal restrictions, making it suitable for both personal and commercial projects.

Quickstart

pip install bfi

import bfi
with open('hello_world.b', 'r') as fh:
    code = fh.read()
output = bfi.interpret(code, stdin='', buffer_stdout=True)
print(output)

Verify before relying

  • Whether the package is actively maintained beyond bug fixes, or if development has effectively stalled
  • Performance characteristics on modern Python versions beyond the CPython 2.7.14 benchmark mentioned in the documentation

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 279 days since the last release
Last repo commit
First released
Downloads 338,545/month — #7,430 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: bfi-1.1.1-py2-none-any.whl; bfi-1.1.1-py3-none-any.whl

Intended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.11

Tags

brainfuck interpreteresoteric language runnerbrainfuck compilerpure python interpreterbrainfuck optimizationbrainfuck execution engine
esoteric-languagesinterpretercompiler

More Software Development packages