forbiddenfruit
Patch python built-in objects
Decision gist · record as of 2026-08-14
Yes, if you need to dynamically extend built-in types and are committed to CPython. No, if you use PyPy or other implementations, or prefer to avoid C compilation during install. The dual MIT/GPLv3 license is permissive, but the high install friction and age of the last release mean you should verify compatibility with your specific Python version before relying on it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires CPython (not PyPy, Jython, or other implementations) and a C compiler to build the extension module during installation.
- High install friction: the package requires compilation against the CPython C API and is only compatible with CPython.
- Last release was 2021-01-16, but the repository remains active with recent commits.
License · maintenance · safety
(unclear) — Dual-licensed under GPLv3+ and MIT; you may choose either license. This dual licensing provides flexibility—use MIT for permissive integration or GPLv3+ if you prefer copyleft terms.
last release 2021-01-16 (2036 days) · last repo commit 2026-04-03 · 883 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,451,765 downloads/mo, #3,058 on PyPI
Alternatives
Verify before relying
from forbiddenfruit import curse, reverse
def greet(self):
return f"Hello from {self}"
curse(str, "greet", greet)
print("world".greet()) # Hello from world
reverse(str, "greet")- Whether the package works reliably on modern Python versions beyond those explicitly tested (2.7, 3.0, 3.3–3.7).
- Stability and compatibility with CPython versions released after the last 2021-01-16 release.
- Whether reverse() correctly restores pre-existing built-in attributes or only removes added ones.
What it is and what it does
Forbiddenfruit is a CPython-specific library that uses the Python C API to dynamically patch built-in types (int, str, list, etc.) with new methods and attributes at runtime. It was originally created to support fluent assertion libraries similar to RSpec Expectations, but has been used for spying, profiling integration, and other runtime introspection tasks.
The library provides three main functions: `curse()` to add a method to a built-in type, `reverse()` to remove a cursed attribute, and `cursed()` as a context manager or decorator to temporarily patch a type and automatically clean up on exit. Because it operates at the C API level, it can modify types that are normally immutable from pure Python. However, this power comes with significant constraints: it only works on CPython, requires compilation during installation, and the last release was in early 2021.
Use it for
- Implement fluent assertion APIs for testing libraries similar to RSpec Expectations.
- Add introspection or profiling hooks to built-in types without modifying their source.
- Temporarily extend built-in behavior within a specific code block using the context manager.
- Spy on or intercept calls to built-in type methods for debugging or monitoring.
- Prototype or experiment with language-like extensions to Python's core types.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to dynamically extend built-in types and are committed to CPython.
No, if you use PyPy or other implementations, or prefer to avoid C compilation during install. The dual MIT/GPLv3 license is permissive, but the high install friction and age of the last release mean you should verify compatibility with your specific Python version before relying on it in production.
Install
forbiddenfruit on PyPI
Before you install
High install friction: the package requires compilation against the CPython C API and is only compatible with CPython. Last release was 2021-01-16, but the repository remains active with recent commits.
Requires CPython (not PyPy, Jython, or other implementations) and a C compiler to build the extension module during installation.
License in practice
Dual-licensed under GPLv3+ and MIT; you may choose either license. This dual licensing provides flexibility—use MIT for permissive integration or GPLv3+ if you prefer copyleft terms.
Quickstart
from forbiddenfruit import curse, reverse
def greet(self):
return f"Hello from {self}"
curse(str, "greet", greet)
print("world".greet()) # Hello from world
reverse(str, "greet")
Verify before relying
- Whether the package works reliably on modern Python versions beyond those explicitly tested (2.7, 3.0, 3.3–3.7).
- Stability and compatibility with CPython versions released after the last 2021-01-16 release.
- Whether reverse() correctly restores pre-existing built-in attributes or only removes added ones.
Package facts
| License | Not declared unclear |
| Python support | Not specified |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Actively maintained 2,036 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,451,765 / month, #3,058 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)License :: OSI Approved :: MIT License |
Evidence: forbiddenfruit-0.1.4.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “monkey patch built-in types”
- forbiddenfruitForbiddenfruit allows you to dynamically add methods and attributes…
- django-stubs-extProvides runtime monkey-patching extensions for django-stubs to…
- zipfile-zstdExtends Python's standard zipfile module to read and write ZIP…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also none · patchy · jsonable · wrapt · django-stubs-ext · mixed-methods · cint · pyarrow-hotfix · argparse-ext