github eth-brownie/brownie v1.22.0.dev0

15 hours ago

Brownie v1.22.0.dev0: What Changed?


Fixed

  • typing for *args and **kwargs (#1870)
  • singleton metaclass instance typing (#1888)
  • various other minor typing issues
  • Various typos in API and core documentation for readability

Changed

  • With Brownie v1.22.0.dev0, much of the codebase is now compiled to C using mypyc, rather than running purely as interpreted Python. (#1875 and others) This brings significant performance improvements—but also some important differences in how the code runs. More on this below.
  • Support Python3.14 and 3.14t (#2008)
  • Replace eth-utils with faster-eth-utils (#1885)
  • Replace eth-abi with faster-eth-abi (#1977)
  • Replace hexbytes with faster-hexbytes (#2004)
  • Replaced builtin json with (ujson) for 4x encoding/decoding speed improvements (#2005)
  • Support eth-utils v5 (#1872)
  • optimize EventDict.contains and .count (#1868)
  • Various TypedDict definitions and other typing improvements

⚡ Compiled vs. Interpreted Code in Brownie v1.22.0.dev0

Interpreted Python: How Brownie Used to Work

Traditionally, Brownie (like most Python code) runs via the Python interpreter:

  • Execution: Each line of code is parsed and executed at runtime.
  • Flexibility: Features like dynamic typing, introspection, monkeypatching, and hot reloading work seamlessly.
  • Performance: Interpreted code tends to be slower, especially for heavy computation and tight loops.

Compiled with mypyc: What’s New?

With mypyc:

  • Compilation: Type-annotated Python is compiled to C, producing native shared libraries (.so or .pyd files) loaded by Python as extension modules.
  • Performance: This brings significantly faster execution, particularly for computation-heavy or frequently-used code paths.
  • Limitations: Some highly dynamic Python features might not work as before—such as certain reflection patterns, monkeypatching, or on-the-fly class/attribute modifications. You can read more about the differences vs interpreted Python here.
  • Type hints now enforced: Brownie’s codebase now makes greater use of Python type hints, both internally and at the user-facing boundary. With mypyc compilation, many of these type hints are enforced at runtime—so passing an unexpected type may now raise a TypeError immediately, where previously such issues might have gone unnoticed.
  • Distribution: Compiling to C results in substantially longer install times when building from source. To mitigate this for users, we are providing prebuilt wheels on PyPI—allowing for fast, simple installations across systems.

Why Can This Cause Bugs?

  • Type hint enforcement: mypyc-enforced type hints mean violations can raise TypeErrors at runtime that would have been silently ignored in pure Python. You may encounter different errors if your code passes unexpected types to Brownie functions.
  • The C-compiled code path could expose edge cases previously unseen.
  • Third-party plugins or code relying on Brownie’s internal Python structures or dynamic features may not function exactly identically. We've taken steps to minimize the frequency of this, but you may find cases that we need to know about before pushing v1.22.0.
  • Some subtle differences in error reporting or debugging (e.g., shorter stack traces).

Help Us Test!

v1.22.0.dev0 is a prerelease—we are actively seeking testers to help us ensure compatibility and stability before Brownie 1.22.0 is officially released.

  • Does your project use Brownie? Upgrade to v1.22.0.dev0 and let us know if you find unexpected behavior.
  • Found a bug, performance issue, or incompatible plugin? Please open an issue!
  • Feedback about speed or experience? We want to hear from you!

How to Try the Prerelease

pip install --pre eth-brownie==1.22.0.dev0

Don't miss a new brownie release

NewReleases is sending notifications on new releases.