Skip to content

Commit c42e90e

Browse files
Merge pull request #14 from algorandfoundation/feat/template-deprecation
Template deprecation
2 parents 1cba086 + 4aa42ff commit c42e90e

File tree

7 files changed

+1047
-815
lines changed

7 files changed

+1047
-815
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# AlgoKit Playground Template
22

3+
---
4+
# DEPRECATED
5+
This template has been deprecated. Beaker for Algorand Smart Contract development is no longer supported. Please use Algorand Python instead. The Algorand Python template can be found at https://github.com/algorandfoundation/algokit-python-template.
6+
7+
## Introduction
8+
39
This template provides a good starting point to quickly play with writing, building and deploying/calling Beaker and PyTEAL contracts.
410

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

copier.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
_subdirectory: template_content
22

3+
use_deprecated_template:
4+
type: bool
5+
help: |
6+
WARNING: This template has been deprecated. Beaker for Algorand Smart Contract development is no longer supported.
7+
Please use Algorand Python instead. The Algorand Python template can be found at https://github.com/algorandfoundation/algokit-python-template
8+
Do you still want to proceed with using the deprecated template?
9+
default: no
10+
11+
_tasks:
12+
- '"{{ python_path if python_path else _copier_python }}" post_init.py {{ use_deprecated_template }} {{ use_workspace }}'
13+
14+
# Auto determined by algokit-cli from v1.11.3 to allow execution of python script
15+
# in binary mode.
16+
python_path:
17+
type: str
18+
help: Path to the sys.executable.
19+
when: false
20+
321
# The following should never get prompted; algokit should always pass these values through by convention
422

523
algod_token:

poetry.lock

Lines changed: 930 additions & 815 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

template_content/post_init.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import shutil
2+
import sys
3+
from pathlib import Path
4+
import os
5+
6+
7+
def main():
8+
# Get the use_deprecated_template argument
9+
use_deprecated_template = sys.argv[1].lower() in ("true", "yes", "1", "t", "y")
10+
use_workspace = sys.argv[2].lower() in ("true", "yes", "1", "t", "y")
11+
12+
if not use_deprecated_template:
13+
# Get the parent directory of this script which should be the generated project root
14+
project_dir = Path(__file__).parent
15+
project_dir = project_dir.parent.parent if use_workspace else project_dir
16+
17+
# Print warning
18+
print("WARNING: Template generation cancelled!\n")
19+
print(
20+
"This template is deprecated. Use Algorand Python instead: https://github.com/algorandfoundation/algokit-python-template\n"
21+
)
22+
23+
if project_dir.exists():
24+
try:
25+
os.chdir(project_dir.parent)
26+
shutil.rmtree(project_dir)
27+
except Exception as e:
28+
print(
29+
f"Failed to clean up {project_dir}. You will have to manually delete the project folder. Error: {str(e)}",
30+
file=sys.stderr,
31+
)
32+
33+
sys.exit(1)
34+
35+
# If we get here, template was approved to be used
36+
print("Proceeding with deprecated template generation...")
37+
38+
39+
if __name__ == "__main__":
40+
main()

tests/test_templates.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,14 @@ def run_init(
9797
return result
9898

9999

100+
@pytest.mark.skip(reason="This test is deprecated since the template is deprecated")
100101
def test_default_parameters(working_dir: Path) -> None:
101102
response = run_init(working_dir, "test_default_parameters")
102103

103104
assert response.returncode == 0
105+
106+
107+
def test_template_fail(working_dir: Path) -> None:
108+
response = run_init(working_dir, "test_template_fail")
109+
110+
assert response.returncode == 1
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# test_template_fail
2+
3+
Welcome to your new AlgoKit project!
4+
5+
This is your workspace root. A `workspace` in AlgoKit is an orchestrated collection of standalone projects (backends, smart contracts, frontend apps and etc).
6+
7+
By default, `projects_root_path` parameter is set to `projects`. Which instructs AlgoKit CLI to create a new directory under `projects` directory when new project is instantiated via `algokit init` at the root of the workspace.
8+
9+
## Getting Started
10+
11+
To get started refer to `README.md` files in respective sub-projects in the `projects` directory.
12+
13+
To learn more about algokit, visit [documentation](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/algokit.md).
14+
15+
### GitHub Codespaces
16+
17+
To get started execute:
18+
19+
1. `algokit generate devcontainer` - invoking this command from the root of this repository will create a `devcontainer.json` file with all the configuration needed to run this project in a GitHub codespace. [Run the repository inside a codespace](https://docs.github.com/en/codespaces/getting-started/quickstart) to get started.
20+
2. `algokit init` - invoke this command inside a github codespace to launch an interactive wizard to guide you through the process of creating a new AlgoKit project
21+
22+
Powered by [Copier templates](https://copier.readthedocs.io/en/stable/).
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "./",
5+
"name": "ROOT"
6+
}
7+
],
8+
"settings": {
9+
"files.exclude": {
10+
"projects/": true
11+
},
12+
"jest.disabledWorkspaceFolders": ["ROOT", "projects"]
13+
},
14+
"extensions": {
15+
"recommendations": ["joshx.workspace-terminals"]
16+
},
17+
"tasks": {
18+
"version": "2.0.0",
19+
"tasks": []
20+
},
21+
"launch": {
22+
"configurations": []
23+
}
24+
}

0 commit comments

Comments
 (0)