Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: orchestration support #7

Merged
merged 29 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
54bb16c
feat: refining pipelines to rely on orchestration; defining run commands
aorumbayev Mar 8, 2024
3b2d772
chore: regen examples
aorumbayev Mar 8, 2024
441e3f8
docs: refresh readme
aorumbayev Mar 11, 2024
1497a7c
chore: bumping min version
aorumbayev Mar 11, 2024
0c505db
chore: bump min version
aorumbayev Mar 11, 2024
980831e
chore: apply suggestions from code review
aorumbayev Mar 15, 2024
4927795
chore: regen examples
aorumbayev Mar 15, 2024
2973caf
chore: swapping to final prerelease branch
aorumbayev Mar 19, 2024
4b415ea
chore: change build and deploy to use new .ar32.json app specs
neilcampbell Mar 22, 2024
8da8fc6
chore: fix up the ts deployer build command
neilcampbell Mar 22, 2024
49dc5db
chore: renaming puya to python
aorumbayev Mar 25, 2024
0021df4
chore: update badge
aorumbayev Mar 25, 2024
3da69e7
chore: regen examples
aorumbayev Mar 25, 2024
a95905b
chore: use algorand-python package
neilcampbell Mar 26, 2024
8b11b99
chore: ignore pylance warning
neilcampbell Mar 26, 2024
a432ca0
chore: ignore pylance warning
neilcampbell Mar 26, 2024
6d5caf6
chore: fixing race condition in tests (xdist)
aorumbayev Mar 26, 2024
78f0fa6
refactor: more robust tests; refined contributing guideline
aorumbayev Mar 26, 2024
dfe578b
chore: updating algokit install (temp)
aorumbayev Mar 26, 2024
872b651
chore: minor tweaks
aorumbayev Mar 26, 2024
58a1755
chore: minor tweaks
aorumbayev Mar 26, 2024
30bc12c
chore: use algokit compile
neilcampbell Mar 27, 2024
f8d0dae
chore: adjust mypy settings
neilcampbell Mar 27, 2024
d50ad7d
chore: regen examples
aorumbayev Mar 27, 2024
fd36424
chore: regen examples
aorumbayev Mar 27, 2024
3506d6b
chore: regen examples
aorumbayev Mar 27, 2024
78eab26
chore: regen examples
aorumbayev Mar 27, 2024
99ad000
chore: bumping min version
aorumbayev Mar 27, 2024
7c65618
chore: fixing tests
aorumbayev Mar 27, 2024
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
5 changes: 4 additions & 1 deletion .github/workflows/check-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ jobs:
- name: Install algokit
run: pipx install algokit

- name: Run algokit localnet
run: algokit localnet start

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "poetry"

- name: Install dependencies
run: poetry install --no-interaction --no-root
run: poetry env use 3.12 && poetry install --no-interaction --no-root

- name: Check formatting with Black
run: |
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,7 @@ examples/**/poetry.lock

# playground folder for previewing templates
.playground/*
!.playground/.gitkeep

# Misc
examples/**/smart_contracts/artifacts
examples/**/.algokit/sources
Empty file removed .playground/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion .vscode/clear.ps1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Remove-Item -Recurse -Force test_output -ErrorAction Ignore
Remove-Item -Recurse -Force .playground -ErrorAction Ignore
19 changes: 8 additions & 11 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"-v",
"init",
"--name",
"test_output",
".playground",
"--no-git",
"--defaults",
"--UNSAFE-SECURITY-accept-template-url",
Expand All @@ -23,7 +23,7 @@
"kind": "build",
"isDefault": true
},
"dependsOn": ["Delete test_output folder"],
"dependsOn": ["Cleanup .playground folder"],
"problemMatcher": []
},
{
Expand All @@ -33,7 +33,7 @@
"-v",
"init",
"--name",
"test_output",
".playground",
"--no-git",
"--defaults",
"--UNSAFE-SECURITY-accept-template-url",
Expand All @@ -51,7 +51,7 @@
"kind": "build",
"isDefault": true
},
"dependsOn": ["Delete test_output folder"],
"dependsOn": ["Cleanup .playground folder"],
"problemMatcher": []
},
{
Expand All @@ -61,7 +61,7 @@
"-v",
"init",
"--name",
"test_output",
".playground",
"--no-git",
"--UNSAFE-SECURITY-accept-template-url",
"--template-url",
Expand All @@ -71,16 +71,13 @@
"--no-bootstrap"
],
"type": "shell",
"dependsOn": ["Delete test_output folder"],
"dependsOn": ["Cleanup .playground folder"],
"problemMatcher": []
},
{
"label": "Delete test_output folder",
"label": "Cleanup .playground folder",
"command": "rm",
"args": [
"-rf",
"test_output"
],
"args": ["-rf", ".playground"],
"type": "shell",
"windows": {
"command": "./.vscode/clear.ps1"
Expand Down
21 changes: 18 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
# AlgoKit Official Template for contributors

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

## Pre-requisites

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

## Testing

Ensure localnet is running by executing `algokit localnet reset`.

```bash
poetry run pytest
poetry run pytest -n auto
```

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

## Development

### Manual

```bash
poetry run copier copy . .playground/{some_dummy_folder_name} --vcs-ref=HEAD --trust
poetry run copier copy . .playground --vcs-ref=HEAD --trust
```

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`.

### Using VSCode Tasks

In VSCode IDE, you can find the tasks in the `.vscode/tasks.json` file. To run them:

1. Open the command palette (`Cmd+Shift+P` on macOS, `Ctrl+Shift+P` on Windows/Linux) and type `> Run Task`
2. Select the task you want to run
3. It will be generated for you under the .playground folder

To cleanup the .playground folder run dedicated cleanup task.

## Contributing

### Commits
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<div align="center">
<a href="https://github.com/algorandfoundation/algokit-puya-template"><img src="https://bafkreihnmpvtrgloxz5exuk2ybfxkeq5b2ka5vxfjejjslswl5ecr7pvpy.ipfs.nftstorage.link/" width=60%></a>
<a href="https://github.com/algorandfoundation/algokit-python-template"><img src="https://bafkreihnmpvtrgloxz5exuk2ybfxkeq5b2ka5vxfjejjslswl5ecr7pvpy.ipfs.nftstorage.link/" width=60%></a>
</div>

<p align="center">
<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>
<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>
<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>
<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>
<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>
<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>
</p>

---

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

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.
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.

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/).

Expand Down
43 changes: 24 additions & 19 deletions copier.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
_subdirectory: template_content
_templates_suffix: ".jinja"

use_workspace:
type: bool
when: false # never prompted to user explicitly, instead expect cli to auto fill (supported cli versions > v1.13.x)
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.
default: no

# questions
# project_name should never get prompted, AlgoKit should always pass it by convention
project_name:
type: str
help: Name for this project.
placeholder: "algorand-app"

contract_name:
type: str
help: Name of the default smart contract app.
placeholder: "hello_world"
default: "hello_world"
validator: >-
{% if not (contract_name | regex_search('^[a-z]+(?:_[a-z]+)*$')) %}
contract_name must be formatted in snake case.
{% endif %}

author_name:
type: str
help: Package author name
Expand All @@ -30,6 +25,16 @@ author_email:
placeholder: "[email protected]"
default: "[email protected]"

contract_name:
type: str
help: Name of the default smart contract app.
placeholder: "hello_world"
default: "hello_world"
validator: >-
{% if not (contract_name | regex_search('^[a-z]+(?:_[a-z]+)*$')) %}
contract_name must be formatted in snake case.
{% endif %}

preset_name:
type: str
help: Name of the template preset to use.
Expand Down Expand Up @@ -57,7 +62,7 @@ ide_jetbrains:
type: bool
help: Do you want to add JetBrains configuration (primarily optimized for PyCharm CE)?
when: "{{ preset_name == 'custom' }}"
default: no
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

use_python_pytest:
type: bool
Expand All @@ -79,40 +84,40 @@ python_linter:
Ruff: "ruff"
Flake8: "flake8"
No thanks: "none"
default: "ruff"
default: "{{ 'ruff' if preset_name == 'production' else 'none' }}"

use_python_black:
type: bool
help: Do you want to use a Python formatter (via Black)?
when: "{{ preset_name == 'custom' }}"
default: yes
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

use_python_mypy:
type: bool
when: "{{ preset_name == 'custom' }}"
help: Do you want to use a Python type checker (via mypy)?
default: yes
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

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

use_github_actions:
type: bool
when: "{{ preset_name == 'custom' }}"
help: Do you want to include Github Actions workflows for build and testnet deployment?
default: yes
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

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

use_dispenser:
type: bool
when: "{{ preset_name == 'custom' }}"
help: Do you want to fund your deployment account using an optional dispenser account?
default: no
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"
Empty file removed examples/generators/.gitkeep
Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

Loading