Skip to main content

Beaker

Beaker is a smart contract development framework for PyTeal.

 

 

 

Hello, Beaker

from pyteal import *
from beaker import *


hello_app = Application("HelloBeaker")


@hello_app.external
def hello(name: abi.String, *, output: abi.String) -> Expr:
    # Set output to the result of `Hello, `+name
    return output.set(Concat(Bytes("Hello, "), name.get()))


# Create an Application client
app_client = client.ApplicationClient(
    # Get sandbox algod client
    client=sandbox.get_algod_client(),
    # Pass instance of app to client
    app=hello_app,
    # Get acct from sandbox and pass the signer
    signer=sandbox.get_accounts().pop().signer,
)

# Deploy the app on-chain
app_id, app_addr, txid = app_client.create()
print(
    f"""Deployed app in txid {txid}
    App ID: {app_id}
    Address: {app_addr}
"""
)

# Call the `hello` method
result = app_client.call(hello, name="Beaker")
print(result.return_value)  # "Hello, Beaker"

Install

Beaker requires Python >= 3.10

You can install from pip:

pip install beaker-pyteal

Or from github directly (no promises on stability):

pip install git+https://github.com/algorand-devrel/beaker

Dev Environment

Requires a local network running to compile and test contracts.

Install AlgoKit

and start it

$ algokit localnet start
$ algokit localnet status

Front End

See Beaker TS to generate a front end client for a Beaker App.

Testing

You can run tests from the root of the project using pytest

Use

Examples

Docs

Please report bugs and get any contracts audited

We recommend that any production smart contracts be audited by a professional before deployment. Beaker has been thoroughly tested, but we cannot guarantee that it is entirely free of bugs.

Metadata

Release files for beaker-pyteal 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for beaker-pyteal 1.1.1
File Interpreter ABI Platform
beaker_pyteal-1.1.1-py3-none-any.whl Python 3 none any Details

Release files / beaker_pyteal-1.1.1-py3-none-any.whl

Download URL beaker_pyteal-1.1.1-py3-none-any.whl
Size 47.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a85a4568213acbd097cd70d8acd71d0e7187b71a4dc5c1fd9760ae8c1433571e
BLAKE2b-256 checksum
How to use checksums
2c232ea38e89d472771baf577f9fbdba1910cfdc6b31e3553b59521afae7e32f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.6 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/1.5.0 colorama/0.4.6 CPython/3.10.13

Release history Release notifications | RSS feed

This release

1.1.1 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.6.1

1 release file

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page