Skip to content

Commit a8c9a1b

Browse files
authored
feat: initial setup for the puya template (#1)
* feat: initial draft; wip * refactor: refining codebase * chore: refining tests
1 parent a241b02 commit a8c9a1b

File tree

418 files changed

+4278
-6427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

418 files changed

+4278
-6427
lines changed

.github/workflows/check-python.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
- name: Install algokit
1717
run: pipx install algokit
1818

19-
- name: Set up Python 3.10
19+
- name: Set up Python 3.12
2020
uses: actions/setup-python@v4
2121
with:
22-
python-version: "3.10"
22+
python-version: "3.12"
2323
cache: "poetry"
2424

2525
- name: Install dependencies

README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
<div align="center">
2-
<a href="https://github.com/algorandfoundation/algokit-beaker-default-template"><img src="https://bafybeiguaon767jcuyawcee4prtzx7om6kpbe5g66zck5pgbpd5mmucamu.ipfs.nftstorage.link/" width=60%></a>
2+
<a href="https://github.com/algorandfoundation/algokit-puya-template"><img src="https://bafkreihnmpvtrgloxz5exuk2ybfxkeq5b2ka5vxfjejjslswl5ecr7pvpy.ipfs.nftstorage.link/" width=60%></a>
33
</div>
44

55
<p align="center">
66
<a target="_blank" href="https://github.com/algorandfoundation/algokit-cli"><img src="https://img.shields.io/badge/docs-repository-00dc94?logo=github&style=flat.svg" /></a>
77
<a target="_blank" href="https://developer.algorand.org/algokit/"><img src="https://img.shields.io/badge/learn-AlgoKit-00dc94?logo=algorand&mac=flat.svg" /></a>
8-
<a target="_blank" href="https://github.com/algorandfoundation/algokit-beaker-default-template"><img src="https://img.shields.io/github/stars/algorandfoundation/algokit-beaker-default-template?color=00dc94&logo=star&style=flat" /></a>
9-
<a target="_blank" href="https://developer.algorand.org/algokit/"><img src="https://vbr.wocr.tk/badge?page_id=algorandfoundation%2Falgokit-beaker-default-template&color=%2300dc94&style=flat" /></a>
8+
<a target="_blank" href="https://github.com/algorandfoundation/algokit-puya-template"><img src="https://img.shields.io/github/stars/algorandfoundation/algokit-puya-template?color=00dc94&logo=star&style=flat" /></a>
9+
<a target="_blank" href="https://developer.algorand.org/algokit/"><img src="https://vbr.wocr.tk/badge?page_id=algorandfoundation%2Falgokit-puya-template&color=%2300dc94&style=flat" /></a>
1010
</p>
1111

1212
---
1313

14-
This template provides a production-ready baseline for developing and deploying [Beaker](https://github.com/algorand-devrel/beaker) smart contracts.
14+
This template provides a production-ready baseline for developing and deploying [Puya](https://github.com/algorand-devrel/puya) smart contracts.
1515

16-
To use it [install AlgoKit](https://github.com/algorandfoundation/algokit-cli#readme) and then either pass in `-t beaker_production` to `algokit init` or select the `beaker_production` template.
16+
To use it [install AlgoKit](https://github.com/algorandfoundation/algokit-cli#readme) and then either pass in `-t puya` to `algokit init` or select the `puya` template.
1717

1818
This is one of the official templates used by AlgoKit to initialize an Algorand smart contract project. It's a [Copier template](https://copier.readthedocs.io/en/stable/).
1919

20+
> Please note `Puya` smart contract development language is currently in alpha / developer preview. It is not recommended for production usage yet.
21+
2022
## Features
2123

2224
This template supports the following features:
2325

24-
- Compilation of [multiple Beaker contracts](template_content/smart_contracts/config.py) to a [predictable folder location and file layout](template_content/smart_contracts/__main__.py) where they can be deployed
25-
- Deploy-time immutability and permanence control
26-
- [Poetry](https://python-poetry.org/) for Python dependency management and virtual environment management
27-
- Linting via [Ruff](https://github.com/charliermarsh/ruff) or [Flake8](https://flake8.pycqa.org/en/latest/)
28-
- Formatting via [Black](https://github.com/psf/black)
29-
- Type checking via [mypy](https://mypy-lang.org/)
30-
- Testing via pytest (not yet used)
31-
- Dependency vulnerability scanning via pip-audit (not yet used)
32-
- VS Code configuration (linting, formatting, breakpoint debugging)
33-
- dotenv (.env) file for configuration
34-
- Automated testing of the compiled smart contracts
35-
- [Output stability](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/articles/output_stability.md) tests of the TEAL output
36-
- CI/CD pipeline using GitHub Actions:
37-
- - Optionally pick deployments to Netlify or Vercel
26+
- Compilation of [multiple Puya contracts](template_content/smart_contracts/config.py) to a [predictable folder location and file layout](template_content/smart_contracts/__main__.py) where they can be deployed
27+
- Deploy-time immutability and permanence control
28+
- [Poetry](https://python-poetry.org/) for Python dependency management and virtual environment management
29+
- Linting via [Ruff](https://github.com/charliermarsh/ruff) or [Flake8](https://flake8.pycqa.org/en/latest/)
30+
- Formatting via [Black](https://github.com/psf/black)
31+
- Type checking via [mypy](https://mypy-lang.org/)
32+
- Testing via pytest (not yet used)
33+
- Dependency vulnerability scanning via pip-audit (not yet used)
34+
- VS Code configuration (linting, formatting, breakpoint debugging)
35+
- dotenv (.env) file for configuration
36+
- Automated testing of the compiled smart contracts
37+
- [Output stability](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/articles/output_stability.md) tests of the TEAL output
38+
- CI/CD pipeline using GitHub Actions:
39+
- - Optionally pick deployments to Netlify or Vercel
3840

3941
# Getting started
4042

copier.yaml

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ project_name:
88
help: Name for this project.
99
placeholder: "algorand-app"
1010

11-
preset_name:
12-
type: str
13-
help: Name of the preset to use. Starter is optimal for simpler projects, Production is optimal for more complex projects that require CI/CD and other features.
14-
choices:
15-
Starter: "starter"
16-
Production: "production"
17-
default: "starter"
11+
# preset_name:
12+
# type: str
13+
# help: Name of the preset to use. Starter is optimal for simpler projects, Production is optimal for more complex projects that require CI/CD and other features.
14+
# choices:
15+
# Starter: "starter"
16+
# Production: "production"
17+
# default: "starter"
1818

1919
contract_name:
2020
type: str
@@ -58,17 +58,12 @@ deployment_language:
5858
python_linter:
5959
type: str
6060
help: Do you want to use a Python linter?
61-
when: "{{ preset_name == 'production' }}"
6261
choices:
6362
Ruff: "ruff"
6463
Flake8: "flake8"
6564
No thanks: "none"
6665
default: |-
67-
{% if preset_name == 'production' -%}
68-
ruff
69-
{%- else -%}
70-
none
71-
{%- endif %}
66+
ruff
7267
7368
use_python_black:
7469
type: bool
@@ -77,14 +72,9 @@ use_python_black:
7772

7873
use_python_mypy:
7974
type: bool
80-
when: "{{ preset_name == 'production' }}"
8175
help: Do you want to use a Python type checker (via mypy)?
8276
default: |-
83-
{% if preset_name == 'production' -%}
84-
yes
85-
{%- else -%}
86-
no
87-
{%- endif %}
77+
yes
8878
8979
use_python_pytest:
9080
type: bool
@@ -93,35 +83,23 @@ use_python_pytest:
9383

9484
use_python_pip_audit:
9585
type: bool
96-
when: "{{ preset_name == 'production' }}"
9786
help: Do you want to include Python dependency vulnerability scanning (via pip-audit)?
9887
default: yes
9988

10089
use_github_actions:
10190
type: bool
102-
when: "{{ preset_name == 'production' }}"
10391
help: Do you want to include Github Actions workflows for build and testnet deployment?
10492
default: |-
105-
{% if preset_name == 'production' -%}
106-
yes
107-
{%- else -%}
108-
no
109-
{%- endif %}
93+
yes
11094
11195
use_pre_commit:
11296
type: bool
113-
when: "{{ preset_name == 'production' }}"
11497
help: Do you want to include pre-commit for linting, type checking and formatting?
11598
default: |-
116-
{% if preset_name == 'production' -%}
117-
yes
118-
{%- else -%}
119-
no
120-
{%- endif %}
99+
yes
121100
122101
use_dispenser:
123102
type: bool
124-
when: "{{ preset_name == 'production' }}"
125103
help: Do you want to fund your deployment account using an optional dispenser account?
126104
default: no
127105

0 commit comments

Comments
 (0)