algokit-client-generator 2.2.1b3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- algokit_client_generator-2.2.1b3/LICENSE +21 -0
- algokit_client_generator-2.2.1b3/PKG-INFO +136 -0
- algokit_client_generator-2.2.1b3/README.md +124 -0
- algokit_client_generator-2.2.1b3/pyproject.toml +186 -0
- algokit_client_generator-2.2.1b3/pyproject.toml.orig +186 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/__init__.py +3 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/__main__.py +3 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/cli.py +95 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/context.py +102 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/document.py +98 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/generator.py +39 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/generators/__init__.py +0 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/generators/app_spec.py +11 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/generators/composer.py +202 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/generators/header_comments.py +17 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/generators/helpers.py +92 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/generators/imports.py +21 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/generators/typed_client.py +982 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/generators/typed_factory.py +607 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/py.typed +0 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/spec.py +412 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/utils.py +303 -0
- algokit_client_generator-2.2.1b3/src/algokit_client_generator/writer.py +29 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Algorand Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: algokit-client-generator
|
|
3
|
+
Version: 2.2.1b3
|
|
4
|
+
Summary: Algorand typed client Generator
|
|
5
|
+
Author: Algorand Foundation
|
|
6
|
+
Author-email: Algorand Foundation <contact@algorand.foundation>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: algokit-utils>=4.0.1,<5
|
|
10
|
+
Requires-Python: >=3.10, <4
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# AlgoKit Python client generator (algokit-client-generator-py)
|
|
14
|
+
|
|
15
|
+
This project generates a type-safe smart contract client in Python for the Algorand Blockchain that wraps the [application client](https://github.com/algorandfoundation/algokit-utils-py/blob/main/docs/src/content/docs/concepts/building/app-client.md) in [AlgoKit Utils](https://github.com/algorandfoundation/algokit-utils-py) and tailors it to a specific smart contract. It does this by reading an [ARC-56](https://github.com/algorandfoundation/ARCs/pull/258) or [ARC-32](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0032.md) application spec file and generating a client which exposes methods for each ABI method in the target smart contract, along with helpers to create, update, and delete the application.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
To be able to consume the generated file you need to include it in a Python project that has (at least) the following package installed:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
poetry add algokit-utils@^4.0.1
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
> Note: version 2 of the generator requires `algokit-utils@^4.0.1` (with py-algorand-sdk v2); it is not compatible with AlgoKit Utils v5, which decoupled from py-algorand-sdk.
|
|
28
|
+
|
|
29
|
+
### Use
|
|
30
|
+
|
|
31
|
+
To install the generator as a CLI tool:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
pipx install algokit-client-generator
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then to use it
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
algokitgen-py path/to/application.json path/to/output/client_generated.py
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Or if you have [AlgoKit](https://github.com/algorandfoundation/algokit-cli) 1.1+ installed
|
|
44
|
+
|
|
45
|
+
```commandline
|
|
46
|
+
algokit generate client path/to/application.json --output path/to/output/client_generated.py
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Generation modes
|
|
50
|
+
|
|
51
|
+
The generator supports two modes:
|
|
52
|
+
|
|
53
|
+
#### Full mode (default)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
algokitgen-py path/to/application.json path/to/output/client_generated.py
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- Includes factory class for creating and deploying smart contracts
|
|
60
|
+
- Includes deployment types and methods
|
|
61
|
+
- Includes all deployment-related metadata (source code, bytecode, template variables)
|
|
62
|
+
- Includes client class for interacting with already deployed contracts
|
|
63
|
+
- Best for development, deployment and interaction workflows or where output size is less important
|
|
64
|
+
|
|
65
|
+
#### Minimal mode
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
algokitgen-py path/to/application.json path/to/output/client_generated.py --mode minimal
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- Excludes factory class and deployment capabilities
|
|
72
|
+
- Excludes deployment-related metadata to reduce output size
|
|
73
|
+
- Only includes client class for interacting with already deployed contracts
|
|
74
|
+
- Best for scenarios that only need to interact with existing contracts
|
|
75
|
+
|
|
76
|
+
## Examples
|
|
77
|
+
|
|
78
|
+
There are a range of [examples](./examples) that you can look at to see a source smart contract (e.g. `{app_name}/contract.py`), the generated client (`artifacts/{app_name}/{app_name}_client.py`) and some tests that demonstrate how you can use the client (`tests/{app_name}_test_client.py`).
|
|
79
|
+
|
|
80
|
+
## Contributing
|
|
81
|
+
|
|
82
|
+
If you want to contribute to this project the following information will be helpful.
|
|
83
|
+
|
|
84
|
+
### Initial setup
|
|
85
|
+
|
|
86
|
+
1. Clone this repository locally
|
|
87
|
+
2. Install pre-requisites:
|
|
88
|
+
|
|
89
|
+
- Install `AlgoKit` - [Link](https://github.com/algorandfoundation/algokit-cli#install): Ensure you can execute `algokit --version`.
|
|
90
|
+
- Bootstrap your local environment; run `algokit project bootstrap all` within this folder, which will:
|
|
91
|
+
- Install `uv` - [Link](https://docs.astral.sh/uv/getting-started/installation/) if it is not already installed. Ensure you can execute `uv --version`
|
|
92
|
+
- Run `uv sync` in the root directory, which will set up a `.venv` folder with a Python virtual environment and also install all Python dependencies
|
|
93
|
+
|
|
94
|
+
3. Open the project and start debugging/developing via:
|
|
95
|
+
- VS Code
|
|
96
|
+
1. Open the repository root in VS Code
|
|
97
|
+
2. Install recommended extensions
|
|
98
|
+
3. Run tests via test explorer
|
|
99
|
+
- IDEA (e.g. PyCharm)
|
|
100
|
+
1. Open the repository root in the IDE
|
|
101
|
+
2. It should automatically detect it's a uv project and set up a Python interpreter and virtual environment.
|
|
102
|
+
3. Run tests
|
|
103
|
+
- Other
|
|
104
|
+
1. Open the repository root in your text editor of choice
|
|
105
|
+
2. Run `uv run pytest`
|
|
106
|
+
|
|
107
|
+
### Subsequently
|
|
108
|
+
|
|
109
|
+
1. If you update to the latest source code and there are new dependencies you will need to run `algokit project bootstrap all` again
|
|
110
|
+
2. Follow step 3 above
|
|
111
|
+
|
|
112
|
+
### Building examples
|
|
113
|
+
|
|
114
|
+
In the `examples` folder there is a series of example contracts along with their generated client. These contracts are originally written in various languages including [Algorand Python](https://github.com/algorandfoundation/puya), [Algorand TypeScript](https://github.com/algorandfoundation/puya-ts), and [TealScript](https://github.com/algorandfoundation/TEALScript).
|
|
115
|
+
|
|
116
|
+
Some contracts are directly imported through the ARC-32/56 app spec and not through contract source code.
|
|
117
|
+
|
|
118
|
+
If you want to make changes to any of the smart contract examples and re-generate the ARC-32/56 JSON specs files then change the corresponding `examples/smart_contracts/{app_name}/contract.py` file and then run:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
uv run python -m examples
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Or in Visual Studio Code you can use the default build task (Ctrl+Shift+B).
|
|
125
|
+
|
|
126
|
+
To regenerate the generated clients run `uv run poe update-approvals`.
|
|
127
|
+
|
|
128
|
+
This package currently depends on Python 3.10, however the development depends on Python 3.12. This is represented by the `pyproject.toml` file which requires 3.10 with additional requirements on dev dependencies.
|
|
129
|
+
|
|
130
|
+
### Continuous Integration / Continuous Deployment (CI/CD)
|
|
131
|
+
|
|
132
|
+
This project uses [GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions) to define CI/CD workflows, which are located in the [`.github/workflows`](./.github/workflows) folder.
|
|
133
|
+
|
|
134
|
+
### Approval tests
|
|
135
|
+
|
|
136
|
+
Making any changes to the generated code will result in the approval tests failing. The approval tests work by generating a version of client and outputting it to `./examples/APP_NAME/client_generated.py` then comparing to the approved version `./examples/APP_NAME/client.py`. If you make a change and break the approval tests, you will need to update the approved version by overwriting it with the generated version. You can run `uv run poe update-approvals` to update all approved clients in one go.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# AlgoKit Python client generator (algokit-client-generator-py)
|
|
2
|
+
|
|
3
|
+
This project generates a type-safe smart contract client in Python for the Algorand Blockchain that wraps the [application client](https://github.com/algorandfoundation/algokit-utils-py/blob/main/docs/src/content/docs/concepts/building/app-client.md) in [AlgoKit Utils](https://github.com/algorandfoundation/algokit-utils-py) and tailors it to a specific smart contract. It does this by reading an [ARC-56](https://github.com/algorandfoundation/ARCs/pull/258) or [ARC-32](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0032.md) application spec file and generating a client which exposes methods for each ABI method in the target smart contract, along with helpers to create, update, and delete the application.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
To be able to consume the generated file you need to include it in a Python project that has (at least) the following package installed:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
poetry add algokit-utils@^4.0.1
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
> Note: version 2 of the generator requires `algokit-utils@^4.0.1` (with py-algorand-sdk v2); it is not compatible with AlgoKit Utils v5, which decoupled from py-algorand-sdk.
|
|
16
|
+
|
|
17
|
+
### Use
|
|
18
|
+
|
|
19
|
+
To install the generator as a CLI tool:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
pipx install algokit-client-generator
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then to use it
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
algokitgen-py path/to/application.json path/to/output/client_generated.py
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or if you have [AlgoKit](https://github.com/algorandfoundation/algokit-cli) 1.1+ installed
|
|
32
|
+
|
|
33
|
+
```commandline
|
|
34
|
+
algokit generate client path/to/application.json --output path/to/output/client_generated.py
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Generation modes
|
|
38
|
+
|
|
39
|
+
The generator supports two modes:
|
|
40
|
+
|
|
41
|
+
#### Full mode (default)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
algokitgen-py path/to/application.json path/to/output/client_generated.py
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- Includes factory class for creating and deploying smart contracts
|
|
48
|
+
- Includes deployment types and methods
|
|
49
|
+
- Includes all deployment-related metadata (source code, bytecode, template variables)
|
|
50
|
+
- Includes client class for interacting with already deployed contracts
|
|
51
|
+
- Best for development, deployment and interaction workflows or where output size is less important
|
|
52
|
+
|
|
53
|
+
#### Minimal mode
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
algokitgen-py path/to/application.json path/to/output/client_generated.py --mode minimal
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- Excludes factory class and deployment capabilities
|
|
60
|
+
- Excludes deployment-related metadata to reduce output size
|
|
61
|
+
- Only includes client class for interacting with already deployed contracts
|
|
62
|
+
- Best for scenarios that only need to interact with existing contracts
|
|
63
|
+
|
|
64
|
+
## Examples
|
|
65
|
+
|
|
66
|
+
There are a range of [examples](./examples) that you can look at to see a source smart contract (e.g. `{app_name}/contract.py`), the generated client (`artifacts/{app_name}/{app_name}_client.py`) and some tests that demonstrate how you can use the client (`tests/{app_name}_test_client.py`).
|
|
67
|
+
|
|
68
|
+
## Contributing
|
|
69
|
+
|
|
70
|
+
If you want to contribute to this project the following information will be helpful.
|
|
71
|
+
|
|
72
|
+
### Initial setup
|
|
73
|
+
|
|
74
|
+
1. Clone this repository locally
|
|
75
|
+
2. Install pre-requisites:
|
|
76
|
+
|
|
77
|
+
- Install `AlgoKit` - [Link](https://github.com/algorandfoundation/algokit-cli#install): Ensure you can execute `algokit --version`.
|
|
78
|
+
- Bootstrap your local environment; run `algokit project bootstrap all` within this folder, which will:
|
|
79
|
+
- Install `uv` - [Link](https://docs.astral.sh/uv/getting-started/installation/) if it is not already installed. Ensure you can execute `uv --version`
|
|
80
|
+
- Run `uv sync` in the root directory, which will set up a `.venv` folder with a Python virtual environment and also install all Python dependencies
|
|
81
|
+
|
|
82
|
+
3. Open the project and start debugging/developing via:
|
|
83
|
+
- VS Code
|
|
84
|
+
1. Open the repository root in VS Code
|
|
85
|
+
2. Install recommended extensions
|
|
86
|
+
3. Run tests via test explorer
|
|
87
|
+
- IDEA (e.g. PyCharm)
|
|
88
|
+
1. Open the repository root in the IDE
|
|
89
|
+
2. It should automatically detect it's a uv project and set up a Python interpreter and virtual environment.
|
|
90
|
+
3. Run tests
|
|
91
|
+
- Other
|
|
92
|
+
1. Open the repository root in your text editor of choice
|
|
93
|
+
2. Run `uv run pytest`
|
|
94
|
+
|
|
95
|
+
### Subsequently
|
|
96
|
+
|
|
97
|
+
1. If you update to the latest source code and there are new dependencies you will need to run `algokit project bootstrap all` again
|
|
98
|
+
2. Follow step 3 above
|
|
99
|
+
|
|
100
|
+
### Building examples
|
|
101
|
+
|
|
102
|
+
In the `examples` folder there is a series of example contracts along with their generated client. These contracts are originally written in various languages including [Algorand Python](https://github.com/algorandfoundation/puya), [Algorand TypeScript](https://github.com/algorandfoundation/puya-ts), and [TealScript](https://github.com/algorandfoundation/TEALScript).
|
|
103
|
+
|
|
104
|
+
Some contracts are directly imported through the ARC-32/56 app spec and not through contract source code.
|
|
105
|
+
|
|
106
|
+
If you want to make changes to any of the smart contract examples and re-generate the ARC-32/56 JSON specs files then change the corresponding `examples/smart_contracts/{app_name}/contract.py` file and then run:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
uv run python -m examples
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Or in Visual Studio Code you can use the default build task (Ctrl+Shift+B).
|
|
113
|
+
|
|
114
|
+
To regenerate the generated clients run `uv run poe update-approvals`.
|
|
115
|
+
|
|
116
|
+
This package currently depends on Python 3.10, however the development depends on Python 3.12. This is represented by the `pyproject.toml` file which requires 3.10 with additional requirements on dev dependencies.
|
|
117
|
+
|
|
118
|
+
### Continuous Integration / Continuous Deployment (CI/CD)
|
|
119
|
+
|
|
120
|
+
This project uses [GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions) to define CI/CD workflows, which are located in the [`.github/workflows`](./.github/workflows) folder.
|
|
121
|
+
|
|
122
|
+
### Approval tests
|
|
123
|
+
|
|
124
|
+
Making any changes to the generated code will result in the approval tests failing. The approval tests work by generating a version of client and outputting it to `./examples/APP_NAME/client_generated.py` then comparing to the approved version `./examples/APP_NAME/client.py`. If you make a change and break the approval tests, you will need to update the approved version by overwriting it with the generated version. You can run `uv run poe update-approvals` to update all approved clients in one go.
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "algokit-client-generator"
|
|
3
|
+
version = "2.2.1-beta.3"
|
|
4
|
+
description = "Algorand typed client Generator"
|
|
5
|
+
license = "MIT"
|
|
6
|
+
license-files = ["LICENSE"]
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.10,<4"
|
|
9
|
+
dependencies = ["algokit-utils>=4.0.1,<5"]
|
|
10
|
+
|
|
11
|
+
[[project.authors]]
|
|
12
|
+
name = "Algorand Foundation"
|
|
13
|
+
email = "contact@algorand.foundation"
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
algokitgen-py = "algokit_client_generator.cli:main"
|
|
17
|
+
|
|
18
|
+
[dependency-groups]
|
|
19
|
+
dev = [
|
|
20
|
+
"ruff>=0.8.6,<0.13.0",
|
|
21
|
+
"mypy",
|
|
22
|
+
"pytest",
|
|
23
|
+
"pytest-cov",
|
|
24
|
+
"pip-audit>=2.5.5,<3",
|
|
25
|
+
"python-semantic-release>=10,<11",
|
|
26
|
+
"pre-commit>=3.3.2,<5.0.0",
|
|
27
|
+
"poethepoet>=0.20,<0.37",
|
|
28
|
+
"pytest-xdist>=3.5.0,<4",
|
|
29
|
+
"puyapy>=5.8.0,<6; python_version >= '3.12'",
|
|
30
|
+
"algorand-python>=3.4.0,<4; python_version >= '3.12'",
|
|
31
|
+
"setuptools>=83.0,<84.0",
|
|
32
|
+
"pytest-sugar>=1.0.0,<2",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[build-system]
|
|
36
|
+
requires = ["uv_build>=0.9.5,<0.12"]
|
|
37
|
+
build-backend = "uv_build"
|
|
38
|
+
|
|
39
|
+
[tool.ruff]
|
|
40
|
+
line-length = 120
|
|
41
|
+
extend-exclude = ["docs"]
|
|
42
|
+
target-version = "py310"
|
|
43
|
+
|
|
44
|
+
[tool.ruff.lint]
|
|
45
|
+
select = [
|
|
46
|
+
"F",
|
|
47
|
+
"E",
|
|
48
|
+
"W",
|
|
49
|
+
"C90",
|
|
50
|
+
"I",
|
|
51
|
+
"N",
|
|
52
|
+
"UP",
|
|
53
|
+
"YTT",
|
|
54
|
+
"ANN",
|
|
55
|
+
"FBT",
|
|
56
|
+
"B",
|
|
57
|
+
"A",
|
|
58
|
+
"C4",
|
|
59
|
+
"DTZ",
|
|
60
|
+
"T10",
|
|
61
|
+
"ISC",
|
|
62
|
+
"ICN",
|
|
63
|
+
"PIE",
|
|
64
|
+
"PYI",
|
|
65
|
+
"PT",
|
|
66
|
+
"Q",
|
|
67
|
+
"RSE",
|
|
68
|
+
"RET",
|
|
69
|
+
"SLF",
|
|
70
|
+
"SIM",
|
|
71
|
+
"TID",
|
|
72
|
+
"PTH",
|
|
73
|
+
"ERA",
|
|
74
|
+
"PGH",
|
|
75
|
+
"PL",
|
|
76
|
+
"RUF",
|
|
77
|
+
]
|
|
78
|
+
ignore = [
|
|
79
|
+
"RET505",
|
|
80
|
+
"SIM108",
|
|
81
|
+
"PLR2004",
|
|
82
|
+
"E111",
|
|
83
|
+
"E117",
|
|
84
|
+
"ISC001",
|
|
85
|
+
"ISC002",
|
|
86
|
+
"Q000",
|
|
87
|
+
"Q001",
|
|
88
|
+
"Q002",
|
|
89
|
+
"Q003",
|
|
90
|
+
"W191",
|
|
91
|
+
"B018",
|
|
92
|
+
"N815",
|
|
93
|
+
"N801",
|
|
94
|
+
"PGH004",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
[tool.ruff.lint.per-file-ignores]
|
|
98
|
+
"src/algokit_client_generator/generator.py" = ["ARG001"]
|
|
99
|
+
|
|
100
|
+
[tool.ruff.lint.flake8-annotations]
|
|
101
|
+
allow-star-arg-any = true
|
|
102
|
+
suppress-none-returning = true
|
|
103
|
+
|
|
104
|
+
[tool.poe.tasks]
|
|
105
|
+
update-approvals = "uv run python -m scripts.update_approvals"
|
|
106
|
+
|
|
107
|
+
[tool.poe.tasks.release-preview]
|
|
108
|
+
help = "Preview current and next prerelease version"
|
|
109
|
+
|
|
110
|
+
[[tool.poe.tasks.release-preview.sequence]]
|
|
111
|
+
cmd = "git describe --tags --abbrev=0"
|
|
112
|
+
|
|
113
|
+
[[tool.poe.tasks.release-preview.sequence]]
|
|
114
|
+
cmd = "uv run semantic-release version --print-tag --as-prerelease"
|
|
115
|
+
|
|
116
|
+
[tool.poe.tasks.release-dry-run-beta]
|
|
117
|
+
shell = "uv run semantic-release --noop -vv version --as-prerelease --prerelease-token beta --print-tag"
|
|
118
|
+
help = "Dry-run beta release (no changes made)"
|
|
119
|
+
|
|
120
|
+
[tool.pytest.ini_options]
|
|
121
|
+
pythonpath = [
|
|
122
|
+
"src",
|
|
123
|
+
"tests",
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
[tool.mypy]
|
|
127
|
+
files = [
|
|
128
|
+
"src",
|
|
129
|
+
"tests",
|
|
130
|
+
]
|
|
131
|
+
exclude = ["dist"]
|
|
132
|
+
python_version = "3.10"
|
|
133
|
+
warn_unused_ignores = true
|
|
134
|
+
warn_redundant_casts = true
|
|
135
|
+
warn_unused_configs = true
|
|
136
|
+
warn_unreachable = true
|
|
137
|
+
warn_return_any = true
|
|
138
|
+
strict = true
|
|
139
|
+
disallow_untyped_decorators = true
|
|
140
|
+
disallow_any_generics = false
|
|
141
|
+
implicit_reexport = false
|
|
142
|
+
show_error_codes = true
|
|
143
|
+
disable_error_code = ["return"]
|
|
144
|
+
|
|
145
|
+
[tool.semantic_release]
|
|
146
|
+
version_toml = ["pyproject.toml:project.version"]
|
|
147
|
+
build_command = "uv build"
|
|
148
|
+
major_on_zero = true
|
|
149
|
+
commit_message = """
|
|
150
|
+
{version}
|
|
151
|
+
|
|
152
|
+
skip-checks: true"""
|
|
153
|
+
tag_format = "v{version}"
|
|
154
|
+
|
|
155
|
+
[tool.semantic_release.branches.main]
|
|
156
|
+
match = "main"
|
|
157
|
+
prerelease_token = "beta"
|
|
158
|
+
prerelease = false
|
|
159
|
+
|
|
160
|
+
[tool.semantic_release.commit_parser_options]
|
|
161
|
+
allowed_tags = [
|
|
162
|
+
"build",
|
|
163
|
+
"chore",
|
|
164
|
+
"ci",
|
|
165
|
+
"docs",
|
|
166
|
+
"feat",
|
|
167
|
+
"fix",
|
|
168
|
+
"perf",
|
|
169
|
+
"style",
|
|
170
|
+
"refactor",
|
|
171
|
+
"test",
|
|
172
|
+
]
|
|
173
|
+
minor_tags = ["feat"]
|
|
174
|
+
patch_tags = [
|
|
175
|
+
"fix",
|
|
176
|
+
"perf",
|
|
177
|
+
"build",
|
|
178
|
+
"chore",
|
|
179
|
+
"refactor",
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
[tool.semantic_release.remote]
|
|
183
|
+
type = "github"
|
|
184
|
+
|
|
185
|
+
[tool.semantic_release.remote.token]
|
|
186
|
+
env = "GH_TOKEN"
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "algokit-client-generator"
|
|
3
|
+
version = "2.2.1-beta.3"
|
|
4
|
+
description = "Algorand typed client Generator"
|
|
5
|
+
authors = [
|
|
6
|
+
{ name = "Algorand Foundation", email = "contact@algorand.foundation" },
|
|
7
|
+
]
|
|
8
|
+
license = "MIT"
|
|
9
|
+
license-files = ["LICENSE"]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10,<4"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"algokit-utils>=4.0.1,<5",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
algokitgen-py = "algokit_client_generator.cli:main"
|
|
18
|
+
|
|
19
|
+
[dependency-groups]
|
|
20
|
+
dev = [
|
|
21
|
+
"ruff>=0.8.6,<0.13.0",
|
|
22
|
+
"mypy",
|
|
23
|
+
"pytest",
|
|
24
|
+
"pytest-cov",
|
|
25
|
+
"pip-audit>=2.5.5,<3",
|
|
26
|
+
"python-semantic-release>=10,<11",
|
|
27
|
+
"pre-commit>=3.3.2,<5.0.0",
|
|
28
|
+
"poethepoet>=0.20,<0.37",
|
|
29
|
+
"pytest-xdist>=3.5.0,<4",
|
|
30
|
+
"puyapy>=5.8.0,<6; python_version >= '3.12'",
|
|
31
|
+
"algorand-python>=3.4.0,<4; python_version >= '3.12'",
|
|
32
|
+
"setuptools>=83.0,<84.0",
|
|
33
|
+
"pytest-sugar>=1.0.0,<2",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[build-system]
|
|
37
|
+
requires = ["uv_build>=0.9.5,<0.12"]
|
|
38
|
+
build-backend = "uv_build"
|
|
39
|
+
|
|
40
|
+
[tool.ruff]
|
|
41
|
+
line-length = 120
|
|
42
|
+
lint.select = [
|
|
43
|
+
# all possible codes as of this ruff version are listed here,
|
|
44
|
+
# ones we don't want/need are commented out to make it clear
|
|
45
|
+
# which have been omitted on purpose vs which ones get added
|
|
46
|
+
# in new ruff releases and should be considered for enabling
|
|
47
|
+
"F", # pyflakes
|
|
48
|
+
"E",
|
|
49
|
+
"W", # pycodestyle
|
|
50
|
+
"C90", # mccabe
|
|
51
|
+
"I", # isort
|
|
52
|
+
"N", # PEP8 naming
|
|
53
|
+
"UP", # pyupgrade
|
|
54
|
+
"YTT", # flake8-2020
|
|
55
|
+
"ANN", # flake8-annotations
|
|
56
|
+
# "S", # flake8-bandit
|
|
57
|
+
# "BLE", # flake8-blind-except
|
|
58
|
+
"FBT", # flake8-boolean-trap
|
|
59
|
+
"B", # flake8-bugbear
|
|
60
|
+
"A", # flake8-builtins
|
|
61
|
+
# "COM", # flake8-commas
|
|
62
|
+
"C4", # flake8-comprehensions
|
|
63
|
+
"DTZ", # flake8-datetimez
|
|
64
|
+
"T10", # flake8-debugger
|
|
65
|
+
# "DJ", # flake8-django
|
|
66
|
+
# "EM", # flake8-errmsg
|
|
67
|
+
# "EXE", # flake8-executable
|
|
68
|
+
"ISC", # flake8-implicit-str-concat
|
|
69
|
+
"ICN", # flake8-import-conventions
|
|
70
|
+
# "G", # flake8-logging-format
|
|
71
|
+
# "INP", # flake8-no-pep420
|
|
72
|
+
"PIE", # flake8-pie
|
|
73
|
+
# "T20", # flake8-print
|
|
74
|
+
"PYI", # flake8-pyi
|
|
75
|
+
"PT", # flake8-pytest-style
|
|
76
|
+
"Q", # flake8-quotes
|
|
77
|
+
"RSE", # flake8-raise
|
|
78
|
+
"RET", # flake8-return
|
|
79
|
+
"SLF", # flake8-self
|
|
80
|
+
"SIM", # flake8-simplify
|
|
81
|
+
"TID", # flake8-tidy-imports
|
|
82
|
+
"PTH", # flake8-use-pathlib
|
|
83
|
+
"ERA", # eradicate
|
|
84
|
+
# "PD", # pandas-vet
|
|
85
|
+
"PGH", # pygrep-hooks
|
|
86
|
+
"PL", # pylint
|
|
87
|
+
# "TRY", # tryceratops
|
|
88
|
+
# "NPY", # NumPy-specific rules
|
|
89
|
+
"RUF", # Ruff-specific rules
|
|
90
|
+
]
|
|
91
|
+
lint.ignore = [
|
|
92
|
+
"RET505", # allow else after return
|
|
93
|
+
"SIM108", # allow if-else in place of ternary
|
|
94
|
+
"PLR2004", # magic values... can't configure to ignore simple low value ints like 2
|
|
95
|
+
# To avoid conflict with ruff formatter. More details on https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
|
|
96
|
+
"E111", # indentation is not a multiple of four
|
|
97
|
+
"E117", # over-indented
|
|
98
|
+
"ISC001", # single line implicit string concatenation
|
|
99
|
+
"ISC002", # multi line implicit string concatenation
|
|
100
|
+
"Q000", # bad quotes inline string
|
|
101
|
+
"Q001", # bad quotes multiline string
|
|
102
|
+
"Q002", # bad quotes docstring
|
|
103
|
+
"Q003", # avoidable escaped quotes
|
|
104
|
+
"W191", # indentation contains tabs
|
|
105
|
+
"B018", # found useless expression
|
|
106
|
+
"N815", # mixed case variable in class scope
|
|
107
|
+
"N801", # invalid class name
|
|
108
|
+
"PGH004", # blanket noqa
|
|
109
|
+
]
|
|
110
|
+
# Exclude a variety of commonly ignored directories.
|
|
111
|
+
extend-exclude = ["docs"]
|
|
112
|
+
# Assume Python 3.10.
|
|
113
|
+
target-version = "py310"
|
|
114
|
+
|
|
115
|
+
[tool.ruff.lint.per-file-ignores]
|
|
116
|
+
"src/algokit_client_generator/generator.py" = ["ARG001"]
|
|
117
|
+
|
|
118
|
+
[tool.ruff.lint.flake8-annotations]
|
|
119
|
+
allow-star-arg-any = true
|
|
120
|
+
suppress-none-returning = true
|
|
121
|
+
|
|
122
|
+
[tool.poe.tasks]
|
|
123
|
+
update-approvals = "uv run python -m scripts.update_approvals"
|
|
124
|
+
|
|
125
|
+
[tool.poe.tasks.release-preview]
|
|
126
|
+
sequence = [
|
|
127
|
+
# `git describe` only sees tags in the history of HEAD; `--print-last-released-tag` also reports the v3 line tags
|
|
128
|
+
{ cmd = "git describe --tags --abbrev=0" },
|
|
129
|
+
{ cmd = "uv run semantic-release version --print-tag --as-prerelease" },
|
|
130
|
+
]
|
|
131
|
+
help = "Preview current and next prerelease version"
|
|
132
|
+
|
|
133
|
+
[tool.poe.tasks.release-dry-run-beta]
|
|
134
|
+
shell = "uv run semantic-release --noop -vv version --as-prerelease --prerelease-token beta --print-tag"
|
|
135
|
+
help = "Dry-run beta release (no changes made)"
|
|
136
|
+
|
|
137
|
+
[tool.pytest.ini_options]
|
|
138
|
+
pythonpath = ["src", "tests"]
|
|
139
|
+
|
|
140
|
+
[tool.mypy]
|
|
141
|
+
files = ["src", "tests"]
|
|
142
|
+
exclude = ["dist"]
|
|
143
|
+
python_version = "3.10"
|
|
144
|
+
warn_unused_ignores = true
|
|
145
|
+
warn_redundant_casts = true
|
|
146
|
+
warn_unused_configs = true
|
|
147
|
+
warn_unreachable = true
|
|
148
|
+
warn_return_any = true
|
|
149
|
+
strict = true
|
|
150
|
+
disallow_untyped_decorators = true
|
|
151
|
+
disallow_any_generics = false
|
|
152
|
+
implicit_reexport = false
|
|
153
|
+
show_error_codes = true
|
|
154
|
+
disable_error_code = ['return']
|
|
155
|
+
|
|
156
|
+
[tool.semantic_release]
|
|
157
|
+
version_toml = ["pyproject.toml:project.version"]
|
|
158
|
+
build_command = "uv build"
|
|
159
|
+
major_on_zero = true
|
|
160
|
+
commit_message = "{version}\n\nskip-checks: true"
|
|
161
|
+
tag_format = "v{version}"
|
|
162
|
+
|
|
163
|
+
[tool.semantic_release.branches.main]
|
|
164
|
+
match = "main"
|
|
165
|
+
prerelease_token = "beta"
|
|
166
|
+
prerelease = false
|
|
167
|
+
|
|
168
|
+
[tool.semantic_release.commit_parser_options]
|
|
169
|
+
allowed_tags = [
|
|
170
|
+
"build",
|
|
171
|
+
"chore",
|
|
172
|
+
"ci",
|
|
173
|
+
"docs",
|
|
174
|
+
"feat",
|
|
175
|
+
"fix",
|
|
176
|
+
"perf",
|
|
177
|
+
"style",
|
|
178
|
+
"refactor",
|
|
179
|
+
"test",
|
|
180
|
+
]
|
|
181
|
+
minor_tags = ["feat"]
|
|
182
|
+
patch_tags = ["fix", "perf", "build", "chore", "refactor"]
|
|
183
|
+
|
|
184
|
+
[tool.semantic_release.remote]
|
|
185
|
+
type = "github"
|
|
186
|
+
token = { env = "GH_TOKEN" }
|