Skip to content

feat: v2 - leveraging new AlgoKit interfaces and support for algokit-utils-py v3 #33

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

Merged
merged 27 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
328cd47
chore: initial wip on rewriting generator to support new interfaces
aorumbayev Jan 7, 2025
195d8b0
feat: splitting generator.py into a set of abstraction specific gener…
aorumbayev Jan 7, 2025
9259ad0
chore: refreshing dependencies; ruff and mypy tweaks in progress
aorumbayev Jan 7, 2025
01f26b4
refactor: further aligning with typescript generator; passing args vi…
aorumbayev Jan 9, 2025
f4d6956
chore: wip
aorumbayev Jan 17, 2025
504d938
chore: wip
aorumbayev Jan 18, 2025
c7fd4cd
fix: handling default values for args from type hints (WIP)
aorumbayev Jan 18, 2025
a50704c
chore: fixing composer generation; fixing default args handlers
aorumbayev Jan 18, 2025
f0ed864
chore: moving examples from ts (part 1); adding handlers for parsing …
aorumbayev Jan 19, 2025
023aa3d
refactor: simplifying import statements
aorumbayev Jan 19, 2025
5becc0d
test: wip on moving tests from utils
aorumbayev Jan 20, 2025
f4031c2
chore: wip moving rest of examples (arc56, reti, nfd, duplicate_struc…
aorumbayev Jan 20, 2025
04933ff
refactor: output ARC56 spec on one line (similar to typescript)
aorumbayev Jan 20, 2025
55951eb
refactor: finalizing edge cases for arc56_test
aorumbayev Jan 21, 2025
40bcd99
test: add remaining test from ts
aorumbayev Jan 21, 2025
c787d8a
chore: mypy cleanup
aorumbayev Jan 21, 2025
c672af1
chore: mypy tweaks
aorumbayev Jan 22, 2025
e7bc9ee
ci: add matrix to run on 3.10 3.11 3.12
aorumbayev Jan 22, 2025
bc4e161
chore: mypy and ruff tweaks
aorumbayev Jan 22, 2025
20db644
refactor: removing AlgorandClientProtocol
aorumbayev Jan 22, 2025
7b4fcaf
feat: adding support for cover_app_call_inner_txn_fees
aorumbayev Jan 25, 2025
a602063
refactor: simplifying and removing duplicated common txn field input …
aorumbayev Jan 27, 2025
dbb6206
refactor: addressing pr comments
aorumbayev Jan 27, 2025
41d7e75
chore: fixing typo in abi_type_to_python; static arrays are mapped to…
aorumbayev Jan 28, 2025
01e1751
refactor: adding extra edge case for nested structs; adding extra exa…
aorumbayev Jan 28, 2025
d6265b5
docs: initial usage and migration guide
aorumbayev Jan 29, 2025
a04f15a
chore: bump to v3 prerelease of algokit-utils
aorumbayev Jan 29, 2025
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
101 changes: 50 additions & 51 deletions .github/workflows/build-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,63 @@ name: Build, Test and Publish Python
on: [workflow_call]

jobs:
build-python:
strategy:
matrix:
os: ["ubuntu-latest"]
# TODO: fix setuptools bug in 3.12, steps to reproduce (add 3.12 below)
python: ["3.10", "3.11"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
build-python:
strategy:
matrix:
os: ["ubuntu-latest"]
python: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install pipx
run: |
python -m pip install --upgrade pip
python -m pip install pipx
python -m pipx ensurepath
- name: Install pipx
run: |
python -m pip install --upgrade pip
python -m pip install pipx
python -m pipx ensurepath

- name: Cache Poetry
uses: actions/cache@v2
with:
path: ~/.local/share/pipx/venvs/poetry
key: ${{ runner.os }}-poetry-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python }}-
- name: Cache Poetry
uses: actions/cache@v4
with:
path: ~/.local/share/pipx/venvs/poetry
key: ${{ runner.os }}-poetry-${{ matrix.python }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python }}-

- name: Install poetry
run: pipx install poetry
- name: Install poetry
run: pipx install poetry

- name: Install dependencies
run: poetry install --no-interaction
- name: Install dependencies
run: poetry install --no-interaction

- name: Start LocalNet
shell: bash
run: |
pipx install algokit
algokit -v localnet start
sleep 10 # workaround for slow startup
- name: Start LocalNet
shell: bash
run: |
pipx install algokit
algokit -v localnet start
sleep 10 # workaround for slow startup

- name: pytest + coverage
shell: bash
run: poetry run pytest --junitxml=pytest-junit.xml --cov-report=term-missing:skip-covered --cov=src | tee pytest-coverage.txt
- name: pytest + coverage
shell: bash
run: poetry run pytest -n auto --junitxml=pytest-junit.xml --cov-report=term-missing:skip-covered --cov=src | tee pytest-coverage.txt

- name: Stop LocalNet
shell: bash
run: algokit localnet stop
- name: Stop LocalNet
shell: bash
run: algokit localnet stop

- name: pytest coverage comment - using Python 3.10 on ubuntu-latest
if: matrix.python == '3.10' && matrix.os == 'ubuntu-latest'
uses: MishaKav/pytest-coverage-comment@main
continue-on-error: true # forks fail to add a comment, so continue any way
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest-junit.xml
- name: pytest coverage comment - using Python 3.10 on ubuntu-latest
if: matrix.python == '3.10' && matrix.os == 'ubuntu-latest'
uses: MishaKav/pytest-coverage-comment@main
continue-on-error: true # forks fail to add a comment, so continue any way
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest-junit.xml

- name: Build Wheel
run: poetry build --format wheel
- name: Build Wheel
run: poetry build --format wheel
144 changes: 72 additions & 72 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
name: Continuous Delivery of Python package

on:
push:
branches:
- main
workflow_dispatch:
inputs:
production_release:
description: "Production release?"
type: boolean
required: true
default: true
push:
branches:
- main
workflow_dispatch:
inputs:
production_release:
description: "Production release?"
type: boolean
required: true
default: true

concurrency: release

permissions:
contents: write
packages: read
contents: write
packages: read

jobs:
ci-check-python:
name: Check Python
uses: ./.github/workflows/check-python.yaml
ci-check-python:
name: Check Python
uses: ./.github/workflows/check-python.yaml

ci-build-python:
name: Build Python
uses: ./.github/workflows/build-python.yaml
needs: ci-check-python
ci-build-python:
name: Build Python
uses: ./.github/workflows/build-python.yaml
needs: ci-check-python

release:
name: Release Library
needs: ci-build-python
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: write
packages: read
release:
name: Release Library
needs: ci-build-python
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: write
packages: read

steps:
- uses: actions/checkout@v3
with:
# Fetch entire repository history so we can determine version number from it
fetch-depth: 0
steps:
- uses: actions/checkout@v3
with:
# Fetch entire repository history so we can determine version number from it
fetch-depth: 0

- name: Install poetry
run: pipx install poetry
- name: Install poetry
run: pipx install poetry

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

- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Install dependencies
run: poetry install --no-interaction --no-root

- name: Get branch name
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
id: get_branch
- name: Get branch name
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
id: get_branch

- name: Set Git user as GitHub actions
run: git config --global user.email "actions@github.com" && git config --global user.name "github-actions"
- name: Set Git user as GitHub actions
run: git config --global user.email "actions@github.com" && git config --global user.name "github-actions"

- name: Create Continuous Deployment - Beta (non-prod)
if: steps.get_branch.outputs.branch == 'main' && !inputs.production_release
run: |
poetry run semantic-release \
-v DEBUG \
--prerelease \
--define=branch=main \
publish
gh release edit --prerelease "v$(poetry run semantic-release print-version --current)"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Continuous Deployment - Beta (non-prod)
if: steps.get_branch.outputs.branch == 'main' && !inputs.production_release
run: |
poetry run semantic-release \
-v DEBUG \
--prerelease \
--define=branch=main \
publish
gh release edit --prerelease "v$(poetry run semantic-release print-version --current)"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Continuous Deployment - Production
if: steps.get_branch.outputs.branch == 'main' && inputs.production_release
run: |
poetry run semantic-release \
-v DEBUG \
--define=version_source="commit" \
--define=patch_without_tag=true \
--define=branch=main \
publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Continuous Deployment - Production
if: steps.get_branch.outputs.branch == 'main' && inputs.production_release
run: |
poetry run semantic-release \
-v DEBUG \
--define=version_source="commit" \
--define=patch_without_tag=true \
--define=branch=main \
publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
113 changes: 58 additions & 55 deletions .github/workflows/check-python.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,63 @@
name: Check Python Code

on:
workflow_call:
workflow_call:

jobs:
check-python:
runs-on: "ubuntu-latest"
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install pipx
run: |
python -m pip install --upgrade pip
python -m pip install pipx
python -m pipx ensurepath

- name: Cache Poetry
uses: actions/cache@v2
with:
path: ~/.local/share/pipx/venvs/poetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-

- name: Install poetry
run: pipx install poetry

- name: Install dependencies
run: poetry install --no-interaction --no-root

- name: Audit with pip-audit
run: |
# audit non dev dependencies, no exclusions
poetry export --without=dev > requirements.txt && poetry run pip-audit -r requirements.txt

# audit all dependencies, with exclusions.
# If a vulnerability is found in a dev dependency without an available fix,
# it can be temporarily ignored by adding --ignore-vuln e.g.
# --ignore-vuln "GHSA-hcpj-qp55-gfph" # GitPython vulnerability, dev only dependency
poetry run pip-audit

- name: Check formatting with Ruff
run: |
# stop the build if there are files that don't meet formatting requirements
poetry run ruff format --check .

- name: Check linting with Ruff
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run ruff .

- name: Check types with mypy
run: poetry run mypy
check-python:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install pipx
run: |
python -m pip install --upgrade pip
python -m pip install pipx
python -m pipx ensurepath

- name: Cache Poetry
uses: actions/cache@v4
with:
path: ~/.local/share/pipx/venvs/poetry
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python-version }}-

- name: Install poetry
run: pipx install poetry

- name: Install dependencies
run: poetry install --no-interaction --no-root

- name: Audit with pip-audit
run: |
# audit non dev dependencies, no exclusions
poetry export --without=dev > requirements.txt && poetry run pip-audit -r requirements.txt

# audit all dependencies, with exclusions.
# If a vulnerability is found in a dev dependency without an available fix,
# it can be temporarily ignored by adding --ignore-vuln e.g.
# --ignore-vuln "GHSA-hcpj-qp55-gfph" # GitPython vulnerability, dev only dependency
poetry run pip-audit

- name: Check formatting with Ruff
run: |
# stop the build if there are files that don't meet formatting requirements
poetry run ruff format --check .

- name: Check linting with Ruff
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run ruff check .

- name: Check types with mypy
run: poetry run mypy
Loading