Releases: algorandfoundation/puya
v5.4.0
v5.4.0 (2025-10-27)
Added
-
Add validation for ABI method names to match ARC-4 specification (
^[_A-Za-z][A-Za-z0-9_]*$). -
Added support for configuration of language server log level and debounce interval.
v5.3.2
v5.3.2 (2025-10-20)
Fixed
- Fixed incorrect validation for dynamic structs ending with a bool.
v5.3.1
v5.3.0
v5.3.0 (2025-10-20)
Added
- Added
validate_encodingoption toalgopy.arc4.abimethod, this allows controlling whether ABI arguments for the method are validated or not - Added
.validate()method to ARC4 and native data types to validate a value is encoded correctly - Added support for validating dynamic types
- Added
--validate-abi-argsand--validate-abi-returnoptions for more granular control of automatic ABI validation - Added output to display puyapy version when compiling
Changed
- Preserve asserts with error messages followed by unconditional approval.
Deprecated
- The
--validate-abi-dynamic-severityoption has been deprecated since dynamic types can now also be validated - The
--validate-abi-valuesoption has been deprecated, use--validate-abi-argsand--validate-abi-returninstead
v4.11.0
v4.11.0 (2025-10-20)
Added
- Added
validate_encodingoption toalgopy.arc4.abimethod, this allows controlling whether ABI arguments for the method are validated or not - Added
.validate()method to ARC4 and native data types to validate a value is encoded correctly - Added support for validating dynamic types
- Added
--validate-abi-argsand--validate-abi-returnoptions for more granular control of automatic ABI validation - Added output to display puyapy version when compiling
Fixed
- Prevent a critical error when optimizing extract ops with constant offsets and sizes
v5.2.0
v5.2.0 (2025-10-13)
Added
- Added a compiler option to validate the sizes of ARC-4 arguments to ensure they are well-formed this option is enabled by default
- Added a compiler option to control the severity of compiler output when notifying that nested dynamic types are not validated
v5.1.0
v5.1.0 (2025-10-13)
Added
- added language server code fix for .copy() requirements
v5.0.1
v5.0.1 (2025-10-06)
Fixed
-
creating a type alias from another type alias is now supported e.g.
Timestamp = algopy.arc4.UInt64 -
improved language server support for PyCharm LSP4IJ plugin
v5.0.0
v5.0.0 (2025-10-03)
PuyaPy 5.0 contains breaking changes, please refer to the Changed section and migration guide for more details.
Added
-
Documentation for how to get started with contributing a new front end langauge for the compiler.
-
Added
algopy.FixedArraythat supports mutable, native and dynamic elements in an array with a fixed size. -
Added
algopy.Structthat supports mutable, native and dynamic members. -
Added
.to_native(element_type)function for convertingalgopy.arc4.DynamicArraytoalgopy.Arrayandalgopy.arc4.StaticArraytoalgopy.FixedArray. -
Added a PuyaPy CLI option and
@abimethodargumentresource_encodingthat controls how
resource types (algopy.Asset,algopy.Applicationandalgopy.Account) are handled in the
ABI router.
When set tovalue(the default) the types will use their underlying value type (uint64oraddress).
When set toindexthe types will use their ARC-4 reference aliases and when calling
require populating the appropriate foreign array.
This affects TEAL, AVM bytecode, ARC-32 and ARC-56 file output. -
Boxes containing fixed-size types larger than 4K can now be created/read/updated, provided
the size of the innermost element being read/written is not larger than 4K. -
Improved reads and writes to nested fixed-size data types by reducing number of bounds checks
where possible to do so safely. -
Added
algopy.zero_bytes()function to easily initialise fixed-size bytes-backed types to
all zero bytes. -
The optimiser can now detect when a storage key (box/global/local) is guaranteed to exist and
can eliminate some redundant asserts. -
Repeated operations of concatenation, addition, multiplication, and uint64 bitwise operations
involving two or more constants can now be optimized. -
Improved detection and elimination of redundant ARC-4 encode/decode operations, particularly
those involving nested data structures, or where data structures have equivalent encoding but
not identical types. -
Improved ARC-4 encoding generation for tuples with dynamically-sized elements.
-
Added constant optimizations for
sha3_256,sha512_256andkeccak256op codes. -
Added support for reading and writing at an index or iterating a dynamic array of fixed size elements
in a box > 4k in size. -
Added an optimization for converting
substring3with alenas the length argument to anextract START 0. -
Added an optimisation to eliminate
extract_uint64when it's consumed only from anitob. -
Optimize op
argtoarg_Nwhen N <= 3. -
Include an error message in TEAL, ARC-56 and debug outputs for when a dynamic array of fixed elements when writing to an out-of-bounds index.
-
Added optimisation to always inline a subroutine that is a single intrinsic.
-
Minor improvements to TEAL peephole optimisations.
-
Support matching against multiple values in Python match-cases with
|. -
Add
.as_uint64()and.as_biguint()methods for allarc4.UIntNandarc4.BigUIntNclasses to convert them to the primitive values..as_uint64()works even for types with bytes size > 64 such asBigUIntN[typing.Literal[128]],BigUIntN[typing.Literal[512]], .etc, as long as the actual value fits within the bound of uint64..as_uint64()throws overflow error if the value is larger than uint64 -
Added
extract,replace,resize, andsplicemethods toBoxclass -
Added AVM 13 support
-
Added support for ops from langspec v4.3.0, including
txn RejectVersionandapp_params_get AppVersion
Changed
-
algopy.Arraycan now be used in storage and allows native, mutable and dynamically sized types,
however it no longer has reference semantics and may require.copy()when aliasing the array or it's contents.To retain the original behaviour of
algopy.Arrayuse the newalgopy.ReferenceArraytype. -
Require
.copy()when extending or concatenating a sequence containing mutable values to maintain idiomatic compatibility. -
The default behaviour for the new
resource_encodingoption is different to prior versions, resource
types (algopy.Asset,algopy.Applicationandalgopy.Account) will now appear as their underlying
ARC-4 value types in ABI methods (uint64andaddress).
This affects TEAL, AVM bytecode, ARC-32 and ARC-56 file output. -
Updated vendored mypy version from v1.13.0 to v1.17.0.
-
Increase severity from warning to error when referencing logic sig only args in a contract and vice versa.
-
Disable some lower level optimisations when running at O0.
-
Improved performance of puya backend.
-
ARC-4 router code generation has been changed to be more program-size efficient.
-
Multiple other improvements to decrease program size have been introduced.
-
Improved the help output for puyapy.
-
Removed automatic output of ARC-32 app spec files.
ARC-32 has been marked for eventual deprecation, with ARC-56 as the replacement.
ARC-56 app spec files are already automatically output and continue to be.
To continue outputting an ARC-32 file, specify the command line option--output-arc32. -
Changed constructors of
ImmutableArrayandReferenceArrayto take anIterableinstead of variadic args for consistency with other native array types. -
The default AVM version has been updated from 10 to 11 to match the current mainnet version.
AVM version 10 remains a supported option for now.
Deprecated
-
.nativeproperty inarc4.UIntNandarc4.BigUIntNclasses has been depreacted. Use.as_uint64()or.as_biguint()instead. -
.refproperty inBoxclass has been deprecated. The methods previously accessed via.refe.g.extract,replace,resize, andspliceare now available directly in theBoxclass. -
BoxRefclass has been deprecated. UseBox[Bytes]instead.
Fixed
-
Prevent a critical error when optimizing extract ops with constant offsets and sizes.
-
Fixed a potential semantic compatibility bug when instantiating a new
algopy.arc4.Struct
using keyword arguments. The arguments were being evaluated in the order of the fields on the
Struct class, rather than from left to right when being passed. -
Fixed a compilation failure when using
--locals-coalescing-strategy=aggressiveoption in
combination withalgopy.ReferenceArray. -
Fixed a compilation failure when subroutines contained extremely long control flow sequences.
-
Fixed a compilation failure when attempting to iterate an empty tuple.
-
Prevent compilation failure in certain scenarios when performing copy-propagation.
-
Fixed an issue where comparisons
between boolean evaluations of Asset or Application types would produce unexpected results. -
No longer allow optimizations for
setbitwhere the value could result in something other than a 0 or 1. -
Fixed typing for methods that should have only allowed bool inputs, specifically:
algopy.op.setbitalgopy.op.getbitalgopy.op.ITxnCreate.set_config_asset_default_frozenalgopy.op.ITxnCreate.set_freeze_asset_frozenalgopy.op.ITxnCreate.set_nonparticipationalgopy.itxn.InnerTransaction'snonparticipationargalgopy.itxn.KeyRegistration'snonparticipationarg
-
algopy.itxn.KeyRegistrationno longer has any required fields since some combinations are mutually exclusive. -
Fix a compilation failure occurring at optimisation-level zero when a function that is
declared to produce a result but always terminates the program is explicitly inlined. -
Fix an issue where a subroutine that never returns could be generated with ops that will
always fail at runtime (specifically, usingframe_digand/orframe_buryin a subroutine
that is detected as not requiring aprotoinstruction). -
Tuple types are now supported in template variables.
-
Fixed an issue whereby reading the target variable of a
urangebased for-loop outside of the loop would not match the expected behaviour of the native Python equivalentrange. -
Fixed an issue of semantic incompatibility concerning the order of evaluation of arguments when constructing named tuples.
Previously, arguments were evaluated in the order of field declarations in the named tuple type, rather than in the order they appear in the instantiating call. This could cause different results when arguments have side effects.