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

fix: mypy 1.11 pin; skipping clients on lsig compile; remove package-mode #74

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ test = { commands = [
'poetry run pytest',
], description = 'Run smart contract tests' }
audit = { commands = [
'poetry export --without=dev -o requirements.txt',
'poetry run pip-audit -r requirements.txt',
'poetry run pip-audit',
], description = 'Audit with pip-audit' }
lint = { commands = [
'poetry run black --check --diff .',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ jobs:
- name: Scan TEAL files for issues
run: algokit project run audit-teal --project-name 'production_python_smart_contract_python'

- name: Check output stability of the smart contracts
run: algokit project run ci-teal-diff --project-name 'production_python_smart_contract_python'
# # Uncomment to enable TEAL static analysis with snapshoting using Tealer package
# # Would first require running locally using audit-teal command and committing the snapshots into source control
# # Please note, tealer has a known bug that may result in large snapshot file sizes, track resolution here:
# # https://github.com/crytic/tealer/issues/101
# - name: Check output stability of the smart contracts
# run: algokit project run ci-teal-diff --project-name 'production_python_smart_contract_python'

- name: Run deployer against LocalNet
run: algokit project deploy localnet --project-name 'production_python_smart_contract_python'
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ node_modules

# AlgoKit
debug_traces/
.algokit/static-analysis/tealer/
.algokit/static-analysis/ # Replace with .algokit/static-analysis/tealer/ to enable snapshot checks in CI
.algokit/sources
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ repos:
minimum_pre_commit_version: '2.9.2'
files: '^(src|tests)/'

- id: tealer
name: tealer
description: "Run AlgoKit `Tealer` for TEAL static analysis"
entry: algokit
language: system
args: [project, run, "audit-teal"]
require_serial: false
additional_dependencies: []
minimum_pre_commit_version: "0"
files: '^.*\.teal$'
# # Uncomment to enable TEAL static analysis using Tealer package
# - id: tealer
# name: tealer
# description: "Run AlgoKit `Tealer` for TEAL static analysis"
# entry: algokit
# language: system
# args: [project, run, "audit-teal"]
# require_serial: false
# additional_dependencies: []
# minimum_pre_commit_version: "0"
# files: '^.*\.teal$'
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
description = "Algorand smart contracts"
authors = ["None <None>"]
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
Expand All @@ -17,7 +16,7 @@ algorand-python-testing = "^0.4.0"
algokit-client-generator = "^1.1.3"
black = {extras = ["d"], version = "*"}
ruff = "^0.1.6"
mypy = "*"
mypy = "1.11.0"
pytest = "*"
pytest-cov = "*"
pip-audit = "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ def build(output_dir: Path, contract_path: Path) -> Path:
raise Exception(f"Could not build contract:\n{build_result.stdout}")

app_spec_file_names = [file.name for file in output_dir.glob("*.arc32.json")]

app_spec_file_name = None
for app_spec_file_name in app_spec_file_names:
if app_spec_file_name is None:
raise Exception(
"Could not generate typed client, .arc32.json file not found"
logger.warning(
"No '*.arc32.json' file found (likely a logic signature being compiled). Skipping client generation."
)
continue
print(app_spec_file_name)
generate_result = subprocess.run(
[
Expand All @@ -72,4 +73,4 @@ def build(output_dir: Path, contract_path: Path) -> Path:
f"Could not generate typed client:\n{generate_result.stdout}"
)

return output_dir / app_spec_file_name
return output_dir / app_spec_file_name if app_spec_file_name else output_dir
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ test = { commands = [
'npm run test',
], description = 'Run smart contract tests using Jest' }
audit = { commands = [
'poetry export --without=dev -o requirements.txt',
'poetry run pip-audit -r requirements.txt',
'poetry run pip-audit',
], description = 'Audit with pip-audit' }
lint = { commands = [
'poetry run black --check --diff .',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ jobs:
- name: Scan TEAL files for issues
run: algokit project run audit-teal --project-name 'production_python_smart_contract_typescript'

- name: Check output stability of the smart contracts
run: algokit project run ci-teal-diff --project-name 'production_python_smart_contract_typescript'
# # Uncomment to enable TEAL static analysis with snapshoting using Tealer package
# # Would first require running locally using audit-teal command and committing the snapshots into source control
# # Please note, tealer has a known bug that may result in large snapshot file sizes, track resolution here:
# # https://github.com/crytic/tealer/issues/101
# - name: Check output stability of the smart contracts
# run: algokit project run ci-teal-diff --project-name 'production_python_smart_contract_typescript'

- name: Run deployer against LocalNet
run: algokit project deploy localnet --project-name 'production_python_smart_contract_typescript'
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ node_modules

# AlgoKit
debug_traces/
.algokit/static-analysis/tealer/
.algokit/static-analysis/ # Replace with .algokit/static-analysis/tealer/ to enable snapshot checks in CI
.algokit/sources
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ repos:
minimum_pre_commit_version: '2.9.2'
files: '^(src|tests)/'

- id: tealer
name: tealer
description: "Run AlgoKit `Tealer` for TEAL static analysis"
entry: algokit
language: system
args: [project, run, "audit-teal"]
require_serial: false
additional_dependencies: []
minimum_pre_commit_version: "0"
files: '^.*\.teal$'
# # Uncomment to enable TEAL static analysis using Tealer package
# - id: tealer
# name: tealer
# description: "Run AlgoKit `Tealer` for TEAL static analysis"
# entry: algokit
# language: system
# args: [project, run, "audit-teal"]
# require_serial: false
# additional_dependencies: []
# minimum_pre_commit_version: "0"
# files: '^.*\.teal$'
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
description = "Algorand smart contracts"
authors = ["None <None>"]
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
Expand All @@ -16,7 +15,7 @@ algorand-python-testing = "^0.4.0"
[tool.poetry.group.dev.dependencies]
black = {extras = ["d"], version = "*"}
ruff = "^0.1.6"
mypy = "*"
mypy = "1.11.0"
pip-audit = "*"
pre-commit = "*"
puyapy = "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ def build(output_dir: Path, contract_path: Path) -> Path:
raise Exception(f"Could not build contract:\n{build_result.stdout}")

app_spec_file_names = [file.name for file in output_dir.glob("*.arc32.json")]

app_spec_file_name = None
for app_spec_file_name in app_spec_file_names:
if app_spec_file_name is None:
raise Exception(
"Could not generate typed client, .arc32.json file not found"
logger.warning(
"No '*.arc32.json' file found (likely a logic signature being compiled). Skipping client generation."
)
continue
print(app_spec_file_name)
generate_result = subprocess.run(
[
Expand All @@ -72,4 +73,4 @@ def build(output_dir: Path, contract_path: Path) -> Path:
f"Could not generate typed client:\n{generate_result.stdout}"
)

return output_dir / app_spec_file_name
return output_dir / app_spec_file_name if app_spec_file_name else output_dir
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ node_modules

# AlgoKit
debug_traces/
.algokit/static-analysis/tealer/
.algokit/static-analysis/ # Replace with .algokit/static-analysis/tealer/ to enable snapshot checks in CI
.algokit/sources
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
description = "Algorand smart contracts"
authors = ["None <None>"]
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ def build(output_dir: Path, contract_path: Path) -> Path:
raise Exception(f"Could not build contract:\n{build_result.stdout}")

app_spec_file_names = [file.name for file in output_dir.glob("*.arc32.json")]

app_spec_file_name = None
for app_spec_file_name in app_spec_file_names:
if app_spec_file_name is None:
raise Exception(
"Could not generate typed client, .arc32.json file not found"
logger.warning(
"No '*.arc32.json' file found (likely a logic signature being compiled). Skipping client generation."
)
continue
print(app_spec_file_name)
generate_result = subprocess.run(
[
Expand All @@ -72,4 +73,4 @@ def build(output_dir: Path, contract_path: Path) -> Path:
f"Could not generate typed client:\n{generate_result.stdout}"
)

return output_dir / app_spec_file_name
return output_dir / app_spec_file_name if app_spec_file_name else output_dir
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ node_modules

# AlgoKit
debug_traces/
.algokit/static-analysis/tealer/
.algokit/static-analysis/ # Replace with .algokit/static-analysis/tealer/ to enable snapshot checks in CI
.algokit/sources
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
description = "Algorand smart contracts"
authors = ["None <None>"]
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ def build(output_dir: Path, contract_path: Path) -> Path:
raise Exception(f"Could not build contract:\n{build_result.stdout}")

app_spec_file_names = [file.name for file in output_dir.glob("*.arc32.json")]

app_spec_file_name = None
for app_spec_file_name in app_spec_file_names:
if app_spec_file_name is None:
raise Exception(
"Could not generate typed client, .arc32.json file not found"
logger.warning(
"No '*.arc32.json' file found (likely a logic signature being compiled). Skipping client generation."
)
continue
print(app_spec_file_name)
generate_result = subprocess.run(
[
Expand All @@ -72,4 +73,4 @@ def build(output_dir: Path, contract_path: Path) -> Path:
f"Could not generate typed client:\n{generate_result.stdout}"
)

return output_dir / app_spec_file_name
return output_dir / app_spec_file_name if app_spec_file_name else output_dir
3 changes: 1 addition & 2 deletions examples/production_python/.algokit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ test = { commands = [
'poetry run pytest',
], description = 'Run smart contract tests' }
audit = { commands = [
'poetry export --without=dev -o requirements.txt',
'poetry run pip-audit -r requirements.txt',
'poetry run pip-audit',
], description = 'Audit with pip-audit' }
lint = { commands = [
'poetry run black --check --diff .',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ jobs:
- name: Scan TEAL files for issues
run: algokit project run audit-teal --project-name 'production_python'

- name: Check output stability of the smart contracts
run: algokit project run ci-teal-diff --project-name 'production_python'
# # Uncomment to enable TEAL static analysis with snapshoting using Tealer package
# # Would first require running locally using audit-teal command and committing the snapshots into source control
# # Please note, tealer has a known bug that may result in large snapshot file sizes, track resolution here:
# # https://github.com/crytic/tealer/issues/101
# - name: Check output stability of the smart contracts
# run: algokit project run ci-teal-diff --project-name 'production_python'

- name: Run deployer against LocalNet
run: algokit project deploy localnet --project-name 'production_python'
2 changes: 1 addition & 1 deletion examples/production_python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ node_modules

# AlgoKit
debug_traces/
.algokit/static-analysis/tealer/
.algokit/static-analysis/ # Replace with .algokit/static-analysis/tealer/ to enable snapshot checks in CI
.algokit/sources
21 changes: 11 additions & 10 deletions examples/production_python/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ repos:
minimum_pre_commit_version: '2.9.2'
files: '^(src|tests)/'

- id: tealer
name: tealer
description: "Run AlgoKit `Tealer` for TEAL static analysis"
entry: algokit
language: system
args: [project, run, "audit-teal"]
require_serial: false
additional_dependencies: []
minimum_pre_commit_version: "0"
files: '^.*\.teal$'
# # Uncomment to enable TEAL static analysis using Tealer package
# - id: tealer
# name: tealer
# description: "Run AlgoKit `Tealer` for TEAL static analysis"
# entry: algokit
# language: system
# args: [project, run, "audit-teal"]
# require_serial: false
# additional_dependencies: []
# minimum_pre_commit_version: "0"
# files: '^.*\.teal$'
3 changes: 1 addition & 2 deletions examples/production_python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
description = "Algorand smart contracts"
authors = ["None <None>"]
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
Expand All @@ -17,7 +16,7 @@ algorand-python-testing = "^0.4.0"
algokit-client-generator = "^1.1.3"
black = {extras = ["d"], version = "*"}
ruff = "^0.1.6"
mypy = "*"
mypy = "1.11.0"
pytest = "*"
pytest-cov = "*"
pip-audit = "*"
Expand Down
9 changes: 5 additions & 4 deletions examples/production_python/smart_contracts/_helpers/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ def build(output_dir: Path, contract_path: Path) -> Path:
raise Exception(f"Could not build contract:\n{build_result.stdout}")

app_spec_file_names = [file.name for file in output_dir.glob("*.arc32.json")]

app_spec_file_name = None
for app_spec_file_name in app_spec_file_names:
if app_spec_file_name is None:
raise Exception(
"Could not generate typed client, .arc32.json file not found"
logger.warning(
"No '*.arc32.json' file found (likely a logic signature being compiled). Skipping client generation."
)
continue
print(app_spec_file_name)
generate_result = subprocess.run(
[
Expand All @@ -72,4 +73,4 @@ def build(output_dir: Path, contract_path: Path) -> Path:
f"Could not generate typed client:\n{generate_result.stdout}"
)

return output_dir / app_spec_file_name
return output_dir / app_spec_file_name if app_spec_file_name else output_dir
2 changes: 1 addition & 1 deletion examples/starter_python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,5 @@ node_modules

# AlgoKit
debug_traces/
.algokit/static-analysis/tealer/
.algokit/static-analysis/ # Replace with .algokit/static-analysis/tealer/ to enable snapshot checks in CI
.algokit/sources
1 change: 0 additions & 1 deletion examples/starter_python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
description = "Algorand smart contracts"
authors = ["None <None>"]
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
Expand Down
Loading