Beaker
------
<img align="left" src="https://raw.githubusercontent.com/algorand-devrel/beaker/master/beaker.png" margin="10px" >
Beaker is a smart contract development framework for [PyTeal](https://github.com/algorand/pyteal).
## Hello, Beaker
```py
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](https://github.com/algorandfoundation/algokit-cli#install)
and start it
```sh
$ algokit localnet start
$ algokit localnet status
```
## Front End
See [Beaker TS](https://github.com/algorand-devrel/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](/examples/)
[Docs](https://beaker.algo.xyz)
**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.
Raw data
{
"_id": null,
"home_page": "https://beaker.algo.xyz",
"name": "beaker-pyteal",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "pyteal,algorand",
"author": "Ben Guidarelli",
"author_email": "ben@algorand.com",
"download_url": "",
"platform": null,
"description": "Beaker\n------\n<img align=\"left\" src=\"https://raw.githubusercontent.com/algorand-devrel/beaker/master/beaker.png\" margin=\"10px\" >\n\nBeaker is a smart contract development framework for [PyTeal](https://github.com/algorand/pyteal).\n\n \n\n \n\n \n\n## Hello, Beaker\n\n```py\nfrom pyteal import *\nfrom beaker import *\n\n\nhello_app = Application(\"HelloBeaker\")\n\n\n@hello_app.external\ndef hello(name: abi.String, *, output: abi.String) -> Expr:\n # Set output to the result of `Hello, `+name\n return output.set(Concat(Bytes(\"Hello, \"), name.get()))\n\n\n# Create an Application client\napp_client = client.ApplicationClient(\n # Get sandbox algod client\n client=sandbox.get_algod_client(),\n # Pass instance of app to client\n app=hello_app,\n # Get acct from sandbox and pass the signer\n signer=sandbox.get_accounts().pop().signer,\n)\n\n# Deploy the app on-chain\napp_id, app_addr, txid = app_client.create()\nprint(\n f\"\"\"Deployed app in txid {txid}\n App ID: {app_id}\n Address: {app_addr}\n\"\"\"\n)\n\n# Call the `hello` method\nresult = app_client.call(hello, name=\"Beaker\")\nprint(result.return_value) # \"Hello, Beaker\"\n\n```\n\n## Install\n\n Beaker requires Python >= 3.10\n\nYou can install from pip:\n\n`pip install beaker-pyteal`\n\nOr from github directly (no promises on stability):\n\n`pip install git+https://github.com/algorand-devrel/beaker`\n\n# Dev Environment\n\nRequires a local network running to compile and test contracts.\n\nInstall [AlgoKit](https://github.com/algorandfoundation/algokit-cli#install)\n\nand start it\n\n```sh\n$ algokit localnet start\n$ algokit localnet status\n```\n\n## Front End\n\nSee [Beaker TS](https://github.com/algorand-devrel/beaker-ts) to generate a front end client for a Beaker App.\n\n## Testing\n\nYou can run tests from the root of the project using `pytest`\n\n## Use\n\n[Examples](/examples/)\n\n[Docs](https://beaker.algo.xyz)\n\n**Please report bugs and get any contracts audited**\n\nWe 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.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Framework for building PyTeal Applications",
"version": "1.1.1",
"project_urls": {
"Homepage": "https://beaker.algo.xyz",
"Repository": "https://github.com/algorand-devrel/beaker"
},
"split_keywords": [
"pyteal",
"algorand"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2c232ea38e89d472771baf577f9fbdba1910cfdc6b31e3553b59521afae7e32f",
"md5": "56ae340940a318eb37fd10e1a25b3330",
"sha256": "a85a4568213acbd097cd70d8acd71d0e7187b71a4dc5c1fd9760ae8c1433571e"
},
"downloads": -1,
"filename": "beaker_pyteal-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "56ae340940a318eb37fd10e1a25b3330",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 47233,
"upload_time": "2023-10-10T14:05:41",
"upload_time_iso_8601": "2023-10-10T14:05:41.533984Z",
"url": "https://files.pythonhosted.org/packages/2c/23/2ea38e89d472771baf577f9fbdba1910cfdc6b31e3553b59521afae7e32f/beaker_pyteal-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-10 14:05:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "algorand-devrel",
"github_project": "beaker",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "beaker-pyteal"
}