Skip to content

Beaker & PyTeal deprecation#34

Merged
CiottiGiorgio merged 46 commits intomainfrom
feature/beaker-deprecation
Feb 7, 2025
Merged

Beaker & PyTeal deprecation#34
CiottiGiorgio merged 46 commits intomainfrom
feature/beaker-deprecation

Conversation

@CiottiGiorgio
Copy link
Copy Markdown
Contributor

This PR consists of replacing the smart contracts in the examples folder with new ones written in Algorand Python.

@aorumbayev
Copy link
Copy Markdown
Contributor

@CiottiGiorgio i'd suggest holding this off until #33 is merged. PR will align examples with examples available on ts generator, the remaining steps on this pr would just imply fixing some merge conflicts (replacing non puya with puya).

@CiottiGiorgio
Copy link
Copy Markdown
Contributor Author

Thank you for heads up.

@CiottiGiorgio CiottiGiorgio requested a review from lempira January 24, 2025 15:45
# Conflicts:
#	examples/__main__.py
#	examples/helloworld/application.json
#	examples/helloworld/helloworld.py
#	examples/lifecycle/application.json
#	examples/lifecycle/lifecycle.py
#	examples/minimal/application.json
#	examples/minimal/minimal.py
#	examples/smart_contracts/artifacts/hello_world/hello_world_client.py
#	examples/smart_contracts/artifacts/lifecycle/lifecycle_client.py
#	examples/smart_contracts/artifacts/minimal/minimal_client.py
#	examples/smart_contracts/artifacts/state/state_client.py
#	examples/state/application.json
#	examples/state/state.py
#	examples/tests/test_hello_world_client.py
#	examples/tests/test_lifecycle_client.py
#	examples/tests/test_minimal_client.py
#	examples/tests/test_state_client.py
#	examples/tests/test_voting_client.py
#	examples/voting/application.json
#	examples/voting/client.py
#	examples/voting/voting.py
#	poetry.lock
#	pyproject.toml
#	scripts/update_approvals.py
#	tests/test_generator.py
# Conflicts:
#	examples/helloworld/test_client.py
#	examples/lifecycle/test_client.py
#	examples/smart_contracts/artifacts/hello_world/hello_world_client.py
#	examples/smart_contracts/artifacts/lifecycle/lifecycle_client.py
#	examples/smart_contracts/artifacts/minimal/minimal_client.py
#	examples/smart_contracts/artifacts/state/state_client.py
#	examples/state/test_client.py
#	examples/voting/client.py
#	examples/voting/test_client.py
#	poetry.lock
#	pyproject.toml
#	scripts/update_approvals.py
#	tests/test_generator.py
@CiottiGiorgio CiottiGiorgio marked this pull request as ready for review February 5, 2025 17:57
# Conflicts:
#	examples/smart_contracts/artifacts/hello_world/hello_world_client.py
#	examples/smart_contracts/artifacts/lifecycle/lifecycle_client.py
#	examples/smart_contracts/artifacts/minimal/minimal_client.py
#	examples/smart_contracts/artifacts/state/state_client.py
#	examples/tests/test_lifecycle_client.py
#	examples/voting/client.py
#	poetry.lock
#	pyproject.toml
@CiottiGiorgio
Copy link
Copy Markdown
Contributor Author

CiottiGiorgio commented Feb 6, 2025

@aorumbayev I noticed how the dev dependency for the latest compiler and algopy language bumped Python to 3.12.
This is even when the client generator is only used and not developed on. Is this problematic?

@aorumbayev
Copy link
Copy Markdown
Contributor

aorumbayev commented Feb 6, 2025

@CiottiGiorgio good point will double check in an hour or so if it's an issue (intent was likely to bump it only on dev dependencies)

@CiottiGiorgio
Copy link
Copy Markdown
Contributor Author

This happened on my side when I installed puya and algopy on this branch as dev deps. Looking forward to know if this causes issues but I'll look more into having two python version requirements for dev group and main group.

@CiottiGiorgio CiottiGiorgio force-pushed the feature/beaker-deprecation branch from 50415f7 to d3ecdf4 Compare February 6, 2025 14:55
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 6, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit_client_generator
   __main__.py220%1–3
   cli.py48480%1–87
   document.py82791%44, 47, 49–50, 55, 74–75
   generator.py31197%23
   spec.py2071692%86, 116–119, 219–223, 253, 269, 350–351, 395, 410
   utils.py2194878%11, 20, 24, 28, 32, 36, 40, 44, 55, 58, 63–64, 75–76, 82–84, 89–91, 94–96, 99, 102, 105, 108–110, 159–160, 194, 198, 201–202, 218, 220, 231–232, 249, 261–264, 268, 278, 281, 283
src/algokit_client_generator/generators
   composer.py51198%29
   typed_client.py328898%59, 188, 287, 590, 680, 690, 729, 840
   typed_factory.py213399%64, 94, 227
TOTAL125213489% 

Tests Skipped Failures Errors Time
42 0 💤 0 ❌ 0 🔥 20.012s ⏱️

@aorumbayev aorumbayev self-requested a review February 6, 2025 15:17
…use it was manually recompiled with a version of puya that contains the bugfix
@CiottiGiorgio
Copy link
Copy Markdown
Contributor Author

This PR is waiting for this fix (algorandfoundation/puya#389) to make it into a release of puya because at the moment the state contract is manually recompiled using a nightly release.

pyproject.toml Outdated
algorand-python = { version = "^2.4.1", python = "^3.12" }
setuptools = "^75.8.0"
pytest-sugar = "^1.0.0"
inflection = "^0.5.1"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CiottiGiorgio do you really need an whole dependency for a single to camel case use case? Also looks like the dependency is not actively maintained https://github.com/jpvanhal/inflection (no commits since 2020)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CiottiGiorgio see utils.py file in src, there are various formatters and sanitizers you can reuse, for instance you can make to_camel_case by reusing the to_pascal_case method and making first char lowercase?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def to_camel_case(value: str) -> str:
    pascal_case = to_pascal_case(value)
    return pascal_case[0].lower() + pascal_case[1:]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@CiottiGiorgio
Copy link
Copy Markdown
Contributor Author

Review comments and bugfixes are addressed. Ready for a last pass of review if necessary

@CiottiGiorgio CiottiGiorgio merged commit f9ef7a1 into main Feb 7, 2025
6 checks passed
@CiottiGiorgio CiottiGiorgio deleted the feature/beaker-deprecation branch February 10, 2025 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants