This project has been generated using AlgoKit. See below for default getting started instructions.
- Clone this repository:
git clone {repository_url}
- Install pre-requisites:
- If you have AlgoKit installed, run
algokit bootstrap poetry
within this folder; - or:
- Install
Python
- Link: The minimum required version is3.10
. Ensure you can executepython -V
and get3.10
+. - Install
Poetry
- Link: The minimum required version is1.2
. Ensure you can executepoetry -V
and get1.2
+. - If you're not using PyCharm, then run
poetry install
in the root directory (this should set up.venv
and also install all Python dependencies) - PyCharm will do this for you automatically on startup 🪄.
- Install
- If you have AlgoKit installed, run
- Open the project and start debugging / developing via:
- VS Code
- Open the repository root in VS Code
- Install recommended extensions
- Hit F5 (or whatever you have debug mapped to) and it should start running with breakpoint debugging. (NOTE: The first time you run, VS Code may prompt you to select the Python Interpreter. Select python from the .venv path within this project)
- IDEA (e.g. PyCharm)
- Open the repository root in the IDE
- It should automatically detect it's a Poetry project and set up a Python interpreter and virtual environment.
- Hit Shift+F9 (or whatever you have debug mapped to) and it should start running with breakpoint debugging.
- Other
- Open the repository root in your text editor of choice
- In a terminal run
poetry shell
- Run
python -m smart_contracts
through your debugger of choice
- VS Code
- If you update to the latest source code and there are new dependencies you will need to run
poetry install
again - Follow step 3 above
This project makes use of Python to build Algorand smart contracts. The following tools are in use:
-
Poetry: Python packaging and dependency management.
-
Black: A Python code formatter.
-
Ruff: An extremely fast Python linter.
-
mypy: Static type checker.
It has also been configured to have a productive dev experience out of the box in VS Code, see the .vscode folder.
How I got it to work
❯ python --version
Python 3.11.1
❯ poetry env use python
Update pyproject.toml
:
[tool.poetry.dependencies]
python = "^3.11"
beaker-pyteal = {git = "https://github.com/tzaffi/beaker", branch = "source-map-b1"}
Then run the update command:
❯ poetry udpate
...
❯ poetry lock
...
Make sure to have a sandbox running
❯ algokit sandbox start
Starting the AlgoKit sandbox now...
...