Skip to content

Commit 7a0a87c

Browse files
feat: orchestration support (#7)
* feat: refining pipelines to rely on orchestration; defining run commands * chore: regen examples * docs: refresh readme * chore: bumping min version * chore: bump min version * chore: apply suggestions from code review Co-authored-by: Neil Campbell <neil@codecise.com> * chore: regen examples * chore: swapping to final prerelease branch * chore: change build and deploy to use new .ar32.json app specs * chore: fix up the ts deployer build command * chore: renaming puya to python * chore: update badge * chore: regen examples * chore: use algorand-python package * chore: ignore pylance warning * chore: ignore pylance warning * chore: fixing race condition in tests (xdist) * refactor: more robust tests; refined contributing guideline * chore: updating algokit install (temp) * chore: minor tweaks * chore: minor tweaks * chore: use algokit compile * chore: adjust mypy settings * chore: regen examples * chore: regen examples * chore: regen examples * chore: regen examples * chore: bumping min version BREAKING CHANGE: Support for algokit-cli v2.0 * chore: fixing tests --------- Co-authored-by: Neil Campbell <neil@codecise.com> Co-authored-by: Neil Campbell <neil.campbell@makerx.com.au>
1 parent 37a737b commit 7a0a87c

File tree

285 files changed

+2083
-2053
lines changed

Some content is hidden

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

285 files changed

+2083
-2053
lines changed

.github/workflows/check-python.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ jobs:
1616
- name: Install algokit
1717
run: pipx install algokit
1818

19+
- name: Run algokit localnet
20+
run: algokit localnet start
21+
1922
- name: Set up Python 3.12
2023
uses: actions/setup-python@v5
2124
with:
2225
python-version: "3.12"
2326
cache: "poetry"
2427

2528
- name: Install dependencies
26-
run: poetry install --no-interaction --no-root
29+
run: poetry env use 3.12 && poetry install --no-interaction --no-root
2730

2831
- name: Check formatting with Black
2932
run: |

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,7 @@ examples/**/poetry.lock
176176

177177
# playground folder for previewing templates
178178
.playground/*
179-
!.playground/.gitkeep
179+
180+
# Misc
181+
examples/**/smart_contracts/artifacts
182+
examples/**/.algokit/sources

.playground/.gitkeep

Whitespace-only changes.

.vscode/clear.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Remove-Item -Recurse -Force test_output -ErrorAction Ignore
1+
Remove-Item -Recurse -Force .playground -ErrorAction Ignore

.vscode/tasks.json

+8-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"-v",
99
"init",
1010
"--name",
11-
"test_output",
11+
".playground",
1212
"--no-git",
1313
"--defaults",
1414
"--UNSAFE-SECURITY-accept-template-url",
@@ -23,7 +23,7 @@
2323
"kind": "build",
2424
"isDefault": true
2525
},
26-
"dependsOn": ["Delete test_output folder"],
26+
"dependsOn": ["Cleanup .playground folder"],
2727
"problemMatcher": []
2828
},
2929
{
@@ -33,7 +33,7 @@
3333
"-v",
3434
"init",
3535
"--name",
36-
"test_output",
36+
".playground",
3737
"--no-git",
3838
"--defaults",
3939
"--UNSAFE-SECURITY-accept-template-url",
@@ -51,7 +51,7 @@
5151
"kind": "build",
5252
"isDefault": true
5353
},
54-
"dependsOn": ["Delete test_output folder"],
54+
"dependsOn": ["Cleanup .playground folder"],
5555
"problemMatcher": []
5656
},
5757
{
@@ -61,7 +61,7 @@
6161
"-v",
6262
"init",
6363
"--name",
64-
"test_output",
64+
".playground",
6565
"--no-git",
6666
"--UNSAFE-SECURITY-accept-template-url",
6767
"--template-url",
@@ -71,16 +71,13 @@
7171
"--no-bootstrap"
7272
],
7373
"type": "shell",
74-
"dependsOn": ["Delete test_output folder"],
74+
"dependsOn": ["Cleanup .playground folder"],
7575
"problemMatcher": []
7676
},
7777
{
78-
"label": "Delete test_output folder",
78+
"label": "Cleanup .playground folder",
7979
"command": "rm",
80-
"args": [
81-
"-rf",
82-
"test_output"
83-
],
80+
"args": ["-rf", ".playground"],
8481
"type": "shell",
8582
"windows": {
8683
"command": "./.vscode/clear.ps1"

CONTRIBUTING.md

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
# AlgoKit Official Template for contributors
22

3-
This repository is a template for creating new AlgoKit projects. It includes a basic structure for creating a puya based smart contract project.
3+
This repository is a template for creating new AlgoKit projects. It includes a basic structure for creating a Algorand Python based smart contract project.
44

55
## Pre-requisites
66

77
`poetry install` - Install the dependencies for the project.
8+
`pipx install algokit` - Ensure cli is installed.
89

910
## Testing
1011

12+
Ensure localnet is running by executing `algokit localnet reset`.
13+
1114
```bash
12-
poetry run pytest
15+
poetry run pytest -n auto
1316
```
1417

1518
This will regenerate the tests for default `starter` and `production` presets as well as default tests for `generators` available on the template.
1619

1720
## Development
1821

22+
### Manual
23+
1924
```bash
20-
poetry run copier copy . .playground/{some_dummy_folder_name} --vcs-ref=HEAD --trust
25+
poetry run copier copy . .playground --vcs-ref=HEAD --trust
2126
```
2227

2328
To generate a dummy project into the `.playground` folder. This is useful for testing the template to quickly preview the output of the template before testing via `pytest`.
2429

30+
### Using VSCode Tasks
31+
32+
In VSCode IDE, you can find the tasks in the `.vscode/tasks.json` file. To run them:
33+
34+
1. Open the command palette (`Cmd+Shift+P` on macOS, `Ctrl+Shift+P` on Windows/Linux) and type `> Run Task`
35+
2. Select the task you want to run
36+
3. It will be generated for you under the .playground folder
37+
38+
To cleanup the .playground folder run dedicated cleanup task.
39+
2540
## Contributing
2641

2742
### Commits

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<div align="center">
2-
<a href="https://github.com/algorandfoundation/algokit-puya-template"><img src="https://bafkreihnmpvtrgloxz5exuk2ybfxkeq5b2ka5vxfjejjslswl5ecr7pvpy.ipfs.nftstorage.link/" width=60%></a>
2+
<a href="https://github.com/algorandfoundation/algokit-python-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-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://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Falgorandfoundation%2Falgokit-react-puya-template&countColor=%2300dc94&style=flat" /></a>
8+
<a target="_blank" href="https://github.com/algorandfoundation/algokit-python-template"><img src="https://img.shields.io/github/stars/algorandfoundation/algokit-python-template?color=00dc94&logo=star&style=flat" /></a>
9+
<a target="_blank" href="https://developer.algorand.org/algokit/"><img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Falgorandfoundation%2Falgokit-python-template&countColor=%2300dc94&style=flat" /></a>
1010
</p>
1111

1212
---
1313

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

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.
16+
To use it [install AlgoKit](https://github.com/algorandfoundation/algokit-cli#readme) and then either pass in `-t python` to `algokit init` or select the `python` 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

copier.yaml

+24-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
_subdirectory: template_content
22
_templates_suffix: ".jinja"
33

4+
use_workspace:
5+
type: bool
6+
when: false # never prompted to user explicitly, instead expect cli to auto fill (supported cli versions > v1.13.x)
7+
help: Automatically filled by AlgoKit CLI (>1.13.x) - passes the --workspace/--no-workspace flag's value, can be used to reason whether this template is currently being instantiated as part of a workspace or not.
8+
default: no
9+
410
# questions
5-
# project_name should never get prompted, AlgoKit should always pass it by convention
611
project_name:
712
type: str
813
help: Name for this project.
914
placeholder: "algorand-app"
1015

11-
contract_name:
12-
type: str
13-
help: Name of the default smart contract app.
14-
placeholder: "hello_world"
15-
default: "hello_world"
16-
validator: >-
17-
{% if not (contract_name | regex_search('^[a-z]+(?:_[a-z]+)*$')) %}
18-
contract_name must be formatted in snake case.
19-
{% endif %}
20-
2116
author_name:
2217
type: str
2318
help: Package author name
@@ -30,6 +25,16 @@ author_email:
3025
placeholder: "your@email.tld"
3126
default: "your@email.tld"
3227

28+
contract_name:
29+
type: str
30+
help: Name of the default smart contract app.
31+
placeholder: "hello_world"
32+
default: "hello_world"
33+
validator: >-
34+
{% if not (contract_name | regex_search('^[a-z]+(?:_[a-z]+)*$')) %}
35+
contract_name must be formatted in snake case.
36+
{% endif %}
37+
3338
preset_name:
3439
type: str
3540
help: Name of the template preset to use.
@@ -57,7 +62,7 @@ ide_jetbrains:
5762
type: bool
5863
help: Do you want to add JetBrains configuration (primarily optimized for PyCharm CE)?
5964
when: "{{ preset_name == 'custom' }}"
60-
default: no
65+
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"
6166

6267
use_python_pytest:
6368
type: bool
@@ -79,40 +84,40 @@ python_linter:
7984
Ruff: "ruff"
8085
Flake8: "flake8"
8186
No thanks: "none"
82-
default: "ruff"
87+
default: "{{ 'ruff' if preset_name == 'production' else 'none' }}"
8388

8489
use_python_black:
8590
type: bool
8691
help: Do you want to use a Python formatter (via Black)?
8792
when: "{{ preset_name == 'custom' }}"
88-
default: yes
93+
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"
8994

9095
use_python_mypy:
9196
type: bool
9297
when: "{{ preset_name == 'custom' }}"
9398
help: Do you want to use a Python type checker (via mypy)?
94-
default: yes
99+
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"
95100

96101
use_python_pip_audit:
97102
type: bool
98103
when: "{{ preset_name == 'custom' }}"
99104
help: Do you want to include Python dependency vulnerability scanning (via pip-audit)?
100-
default: yes
105+
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"
101106

102107
use_github_actions:
103108
type: bool
104109
when: "{{ preset_name == 'custom' }}"
105110
help: Do you want to include Github Actions workflows for build and testnet deployment?
106-
default: yes
111+
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"
107112

108113
use_pre_commit:
109114
type: bool
110115
when: "{{ preset_name == 'custom' }}"
111116
help: Do you want to include pre-commit for linting, type checking and formatting?
112-
default: yes
117+
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"
113118

114119
use_dispenser:
115120
type: bool
116121
when: "{{ preset_name == 'custom' }}"
117122
help: Do you want to fund your deployment account using an optional dispenser account?
118-
default: no
123+
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

examples/generators/.gitkeep

Whitespace-only changes.

examples/generators/production_puya_smart_contract_python/.algokit.toml

-19
This file was deleted.

examples/generators/production_puya_smart_contract_python/.github/workflows/checks.yaml

-82
This file was deleted.

examples/generators/production_puya_smart_contract_python/.github/workflows/pr.yaml

-8
This file was deleted.

0 commit comments

Comments
 (0)