Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

feat: algokit debugger support #49

Merged
merged 16 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 104 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 21 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "copier-testing-template"
name = "template_content"
version = "0.1.0"
description = ""
authors = ["MakerX <[email protected]>"]
Expand All @@ -13,7 +13,7 @@ python-dotenv = "^1.0.0"

[tool.poetry.group.dev.dependencies]
ruff = ">=0.0.260"
black = {extras = ["d"], version = "^22.10.0"}
black = { extras = ["d"], version = "^22.10.0" }
flake8 = "^6.0.0"
pytest = "^7.2.2"
mypy = "^1.1.1"
Expand All @@ -26,11 +26,26 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.ruff]
select = ["E", "F", "ANN", "UP", "N", "C4", "B", "A", "YTT", "W", "FBT", "Q", "RUF", "I"]
select = [
"E",
"F",
"ANN",
"UP",
"N",
"C4",
"B",
"A",
"YTT",
"W",
"FBT",
"Q",
"RUF",
"I",
]
extend-exclude = [
"tests_generated/*", # Ignoring generated tests, ruff specific errors are to be caught by pytest
"template_content"
]
"template_content",
]
ignore = [
"ANN101", # no type for self
"ANN102", # no type for cls
Expand All @@ -39,9 +54,7 @@ unfixable = ["B", "RUF"]

[tool.pytest.ini_options]
pythonpath = ["tests"]
testpaths = [
"tests",
]
testpaths = ["tests"]

[tool.mypy]
python_version = "3.10"
Expand Down
10 changes: 10 additions & 0 deletions template_content/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ This project has been generated using AlgoKit. See below for default getting sta

This project uses [GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions) to define CI/CD workflows, which are located in the [`.github/workflows`](./.github/workflows) folder.

### Debugging Smart Contracts

This project is optimized to work with AlgoKit AVM Debugger extension. To activate it:
{%- if deployment_language == 'python' %}
Refer to the commented header in the `__main__.py` file in the `smart_contracts` folder.
{%- elif deployment_language == 'typescript' %}
Refer to the commented header in the `index.ts` file in the `smart_contracts` folder.
{%- endif %}
For information on using and setting up the `AlgoKit AVM Debugger` VSCode extension refer [here](TODO: put link).

#### Setting up GitHub for CI/CD workflow and TestNet deployment

1. Every time you have a change to your smart contract, and when you first initialize the project you need to [build the contract](#initial-setup) and then commit the `smart_contracts/artifacts` folder so the [output stability](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/articles/output_stability.md) tests pass
Expand Down
2 changes: 1 addition & 1 deletion template_content/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
beaker-pyteal = "^1.1.1"
algokit-utils = "^2.0.1"
algokit-utils = {git = "https://github.com/algorandfoundation/algokit-utils-py.git", rev = "feat/debugger-support"}
python-dotenv = "^1.0.0"

[tool.poetry.group.dev.dependencies]
Expand Down
5 changes: 5 additions & 0 deletions template_content/smart_contracts/__main__.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ from smart_contracts.helpers.deploy import deploy
from smart_contracts.helpers.build import build
{%- endif %}

# # Uncomment the following lines to enable auto generation of AVM Debugger compliant sourceMap and simulation trace file.
# # Learn more about using AVM Debugger to debug your TEAL source codes and algorand transactions of various kinds here: [TODO: put link once available]
# from algokit_utils.config import config
# config.configure(debug=True, trace_all=True)

logging.basicConfig(
level=logging.DEBUG, format="%(asctime)s %(levelname)-10s: %(message)s"
)
Expand Down
7 changes: 0 additions & 7 deletions tests_generated/test_default_parameters/.copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,12 @@ author_email: None
author_name: None
contract_name: hello_world
deployment_language: python
ide_jetbrains: false
ide_vscode: true
indexer_port: 8980
indexer_server: http://localhost
indexer_token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
preset_name: starter
project_name: test_default_parameters
python_linter: none
use_dispenser: false
use_github_actions: false
use_pre_commit: false
use_python_black: true
use_python_mypy: false
use_python_pip_audit: true
use_python_pytest: true

2 changes: 1 addition & 1 deletion tests_generated/test_default_parameters/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
beaker-pyteal = "^1.1.1"
algokit-utils = "^2.0.1"
algokit-utils = {git = "https://github.com/algorandfoundation/algokit-utils-py.git", rev = "feat/debugger-support"}
python-dotenv = "^1.0.0"

[tool.poetry.group.dev.dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
import sys
from pathlib import Path

from algokit_utils.config import config
from dotenv import load_dotenv

from smart_contracts.config import contracts
from smart_contracts.helpers.build import build
from smart_contracts.helpers.deploy import deploy

# # Uncomment the following lines to enable auto generation of AVM Debugger compliant sourceMap and simulation trace file.
# # Learn more about using AVM Debugger to debug your TEAL source codes and algorand transactions of various kinds here: [TODO: put link once available]
# config.configure(debug=True, trace_all=True)

logging.basicConfig(
level=logging.DEBUG, format="%(asctime)s %(levelname)-10s: %(message)s"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,12 @@ author_email: None
author_name: None
contract_name: hello_world
deployment_language: python
ide_jetbrains: false
aorumbayev marked this conversation as resolved.
Show resolved Hide resolved
ide_vscode: true
indexer_port: 8980
indexer_server: http://localhost
indexer_token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
preset_name: starter
project_name: test_deployment_language-python
python_linter: none
use_dispenser: false
use_github_actions: false
use_pre_commit: false
use_python_black: true
use_python_mypy: false
use_python_pip_audit: true
use_python_pytest: true

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
beaker-pyteal = "^1.1.1"
algokit-utils = "^2.0.1"
algokit-utils = {git = "https://github.com/algorandfoundation/algokit-utils-py.git", rev = "feat/debugger-support"}
python-dotenv = "^1.0.0"

[tool.poetry.group.dev.dependencies]
Expand Down
Loading
Loading