asana-api-cli 3.1.3__tar.gz → 3.3.0__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.
- {asana_api_cli-3.1.3/src/asana_api_cli.egg-info → asana_api_cli-3.3.0}/PKG-INFO +47 -7
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/README.md +46 -6
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/pyproject.toml +5 -1
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli/cli.py +313 -117
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli/click_ext.py +43 -73
- asana_api_cli-3.3.0/src/asana_api_cli/codegen.py +721 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli/formatter.py +86 -24
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli/multibyte_filename.py +1 -1
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli/redactor.py +22 -9
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli/session.py +6 -1
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli/version.py +1 -1
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0/src/asana_api_cli.egg-info}/PKG-INFO +47 -7
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli.egg-info/SOURCES.txt +4 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_cli_invocation.py +26 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_cli_surface.py +1 -1
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_click_ext.py +96 -11
- asana_api_cli-3.3.0/tests/test_codegen.py +992 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_formatter.py +24 -24
- asana_api_cli-3.3.0/tests/test_generate_python.py +155 -0
- asana_api_cli-3.3.0/tests/test_generate_python_snapshots.py +179 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_redactor.py +105 -10
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_sdk_boilerplate.py +94 -26
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/LICENSE +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/setup.cfg +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli/__init__.py +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli/structured_arg.py +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli.egg-info/dependency_links.txt +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli.egg-info/entry_points.txt +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli.egg-info/requires.txt +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/src/asana_api_cli.egg-info/top_level.txt +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_cli.py +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_multibyte_filename.py +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_py310_compat.py +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_session.py +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_structured_arg.py +0 -0
- {asana_api_cli-3.1.3 → asana_api_cli-3.3.0}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: asana-api-cli
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.0
|
|
4
4
|
Summary: Command-line wrapper around the official Asana Python SDK
|
|
5
5
|
Author: Masanao Izumo
|
|
6
6
|
License-Expression: MIT
|
|
@@ -46,6 +46,9 @@ asana-api tasks get-tasks --project 123 --opt-fields name,assignee.name
|
|
|
46
46
|
asana.TasksApi(client).get_tasks({"project": "123", "opt_fields": "name,assignee.name"})
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
Or skip the translation entirely: `asana-api --generate-python …` writes that
|
|
50
|
+
Python for you (see [Usage](#usage)).
|
|
51
|
+
|
|
49
52
|
## Why asana-api-cli
|
|
50
53
|
|
|
51
54
|
- **Explore the whole API from the shell.** Every method of every `*Api`
|
|
@@ -132,7 +135,9 @@ automatically.
|
|
|
132
135
|
|
|
133
136
|
The token can be issued from the
|
|
134
137
|
[Asana Developer Console](https://app.asana.com/0/developer-console).
|
|
135
|
-
No token is needed for `--help` or
|
|
138
|
+
No token is needed for `--help` or command-line parsing errors. (A `--query`
|
|
139
|
+
jq filter is validated against the response, so it surfaces errors only after
|
|
140
|
+
the API call — which does need a token.)
|
|
136
141
|
|
|
137
142
|
```bash
|
|
138
143
|
export ASANA_ACCESS_TOKEN="2/12345..."
|
|
@@ -176,7 +181,7 @@ asana-api tasks get-tasks --help
|
|
|
176
181
|
# List workspaces
|
|
177
182
|
asana-api workspaces get-workspaces
|
|
178
183
|
|
|
179
|
-
# List up to 50 projects
|
|
184
|
+
# List up to 50 projects (workspace comes from $ASANA_DEFAULT_WORKSPACE)
|
|
180
185
|
asana-api projects get-projects-for-workspace --item-limit 50
|
|
181
186
|
asana-api projects get-projects --workspace <WORKSPACE_GID> --item-limit 50
|
|
182
187
|
|
|
@@ -195,10 +200,11 @@ asana-api tasks get-task --task <TASK_GID>
|
|
|
195
200
|
# Create a task (body is a JSON string)
|
|
196
201
|
asana-api tasks create-task --body '{"data":{"name":"new task","projects":["<PROJECT_GID>"]}}'
|
|
197
202
|
|
|
198
|
-
# Output formats —
|
|
199
|
-
#
|
|
200
|
-
|
|
201
|
-
asana-api tasks get-tasks --project <PROJECT_GID> --
|
|
203
|
+
# Output formats — non-JSON formats render one row per item. The default
|
|
204
|
+
# auto-paginating output is a flat list, so it is directly rowable; under
|
|
205
|
+
# --full-payload, unwrap the `{"data": [...]}` envelope first with `--query '.data'`.
|
|
206
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --output table
|
|
207
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --full-payload --query '.data' --output csv
|
|
202
208
|
|
|
203
209
|
# CSV output is UTF-8 without a BOM by default. Pass --csv-bom for Excel on
|
|
204
210
|
# Windows, which otherwise displays non-ASCII characters as garbled text.
|
|
@@ -210,6 +216,40 @@ asana-api tasks get-tasks --project <PROJECT_GID> --output csv --csv-bom > tasks
|
|
|
210
216
|
asana-api tasks delete-task --task <TASK_GID> --output none
|
|
211
217
|
```
|
|
212
218
|
|
|
219
|
+
Don't hand-translate the call yourself — `--generate-python` does it for you. It
|
|
220
|
+
prints a standalone `python-asana` script equivalent to the command instead of
|
|
221
|
+
running it (no token, no network), turning a working shell call into
|
|
222
|
+
ready-to-paste SDK code:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
asana-api --generate-python tasks get-task --task <TASK_GID>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
# Generated equivalent (header and stdio-setup boilerplate trimmed):
|
|
230
|
+
import json
|
|
231
|
+
import os
|
|
232
|
+
|
|
233
|
+
import asana
|
|
234
|
+
|
|
235
|
+
configuration = asana.Configuration()
|
|
236
|
+
configuration.access_token = os.environ['ASANA_ACCESS_TOKEN']
|
|
237
|
+
api_client = asana.ApiClient(configuration)
|
|
238
|
+
|
|
239
|
+
api_instance = asana.TasksApi(api_client)
|
|
240
|
+
opts = {}
|
|
241
|
+
|
|
242
|
+
result = api_instance.get_task('<TASK_GID>', opts)
|
|
243
|
+
|
|
244
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Redirect it to a file (`asana-api … --generate-python > fetch_task.py`) to keep
|
|
248
|
+
the script. It reproduces your configuration, output format, `--query`, `--debug`
|
|
249
|
+
(with the auth token masked), and uploads — see
|
|
250
|
+
[Generating Python code](https://github.com/izumo-m/asana-api-cli/blob/main/docs/usage.md#generating-python-code)
|
|
251
|
+
for the full behavior.
|
|
252
|
+
|
|
213
253
|
For the complete option reference — global options, pagination, output formats,
|
|
214
254
|
workspace resolution, error handling, and exit codes — see
|
|
215
255
|
[`docs/usage.md`](https://github.com/izumo-m/asana-api-cli/blob/main/docs/usage.md).
|
|
@@ -18,6 +18,9 @@ asana-api tasks get-tasks --project 123 --opt-fields name,assignee.name
|
|
|
18
18
|
asana.TasksApi(client).get_tasks({"project": "123", "opt_fields": "name,assignee.name"})
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
Or skip the translation entirely: `asana-api --generate-python …` writes that
|
|
22
|
+
Python for you (see [Usage](#usage)).
|
|
23
|
+
|
|
21
24
|
## Why asana-api-cli
|
|
22
25
|
|
|
23
26
|
- **Explore the whole API from the shell.** Every method of every `*Api`
|
|
@@ -104,7 +107,9 @@ automatically.
|
|
|
104
107
|
|
|
105
108
|
The token can be issued from the
|
|
106
109
|
[Asana Developer Console](https://app.asana.com/0/developer-console).
|
|
107
|
-
No token is needed for `--help` or
|
|
110
|
+
No token is needed for `--help` or command-line parsing errors. (A `--query`
|
|
111
|
+
jq filter is validated against the response, so it surfaces errors only after
|
|
112
|
+
the API call — which does need a token.)
|
|
108
113
|
|
|
109
114
|
```bash
|
|
110
115
|
export ASANA_ACCESS_TOKEN="2/12345..."
|
|
@@ -148,7 +153,7 @@ asana-api tasks get-tasks --help
|
|
|
148
153
|
# List workspaces
|
|
149
154
|
asana-api workspaces get-workspaces
|
|
150
155
|
|
|
151
|
-
# List up to 50 projects
|
|
156
|
+
# List up to 50 projects (workspace comes from $ASANA_DEFAULT_WORKSPACE)
|
|
152
157
|
asana-api projects get-projects-for-workspace --item-limit 50
|
|
153
158
|
asana-api projects get-projects --workspace <WORKSPACE_GID> --item-limit 50
|
|
154
159
|
|
|
@@ -167,10 +172,11 @@ asana-api tasks get-task --task <TASK_GID>
|
|
|
167
172
|
# Create a task (body is a JSON string)
|
|
168
173
|
asana-api tasks create-task --body '{"data":{"name":"new task","projects":["<PROJECT_GID>"]}}'
|
|
169
174
|
|
|
170
|
-
# Output formats —
|
|
171
|
-
#
|
|
172
|
-
|
|
173
|
-
asana-api tasks get-tasks --project <PROJECT_GID> --
|
|
175
|
+
# Output formats — non-JSON formats render one row per item. The default
|
|
176
|
+
# auto-paginating output is a flat list, so it is directly rowable; under
|
|
177
|
+
# --full-payload, unwrap the `{"data": [...]}` envelope first with `--query '.data'`.
|
|
178
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --output table
|
|
179
|
+
asana-api tasks get-tasks --project <PROJECT_GID> --full-payload --query '.data' --output csv
|
|
174
180
|
|
|
175
181
|
# CSV output is UTF-8 without a BOM by default. Pass --csv-bom for Excel on
|
|
176
182
|
# Windows, which otherwise displays non-ASCII characters as garbled text.
|
|
@@ -182,6 +188,40 @@ asana-api tasks get-tasks --project <PROJECT_GID> --output csv --csv-bom > tasks
|
|
|
182
188
|
asana-api tasks delete-task --task <TASK_GID> --output none
|
|
183
189
|
```
|
|
184
190
|
|
|
191
|
+
Don't hand-translate the call yourself — `--generate-python` does it for you. It
|
|
192
|
+
prints a standalone `python-asana` script equivalent to the command instead of
|
|
193
|
+
running it (no token, no network), turning a working shell call into
|
|
194
|
+
ready-to-paste SDK code:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
asana-api --generate-python tasks get-task --task <TASK_GID>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
# Generated equivalent (header and stdio-setup boilerplate trimmed):
|
|
202
|
+
import json
|
|
203
|
+
import os
|
|
204
|
+
|
|
205
|
+
import asana
|
|
206
|
+
|
|
207
|
+
configuration = asana.Configuration()
|
|
208
|
+
configuration.access_token = os.environ['ASANA_ACCESS_TOKEN']
|
|
209
|
+
api_client = asana.ApiClient(configuration)
|
|
210
|
+
|
|
211
|
+
api_instance = asana.TasksApi(api_client)
|
|
212
|
+
opts = {}
|
|
213
|
+
|
|
214
|
+
result = api_instance.get_task('<TASK_GID>', opts)
|
|
215
|
+
|
|
216
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Redirect it to a file (`asana-api … --generate-python > fetch_task.py`) to keep
|
|
220
|
+
the script. It reproduces your configuration, output format, `--query`, `--debug`
|
|
221
|
+
(with the auth token masked), and uploads — see
|
|
222
|
+
[Generating Python code](https://github.com/izumo-m/asana-api-cli/blob/main/docs/usage.md#generating-python-code)
|
|
223
|
+
for the full behavior.
|
|
224
|
+
|
|
185
225
|
For the complete option reference — global options, pagination, output formats,
|
|
186
226
|
workspace resolution, error handling, and exit codes — see
|
|
187
227
|
[`docs/usage.md`](https://github.com/izumo-m/asana-api-cli/blob/main/docs/usage.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "asana-api-cli"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.3.0"
|
|
4
4
|
description = "Command-line wrapper around the official Asana Python SDK"
|
|
5
5
|
authors = [{name = "Masanao Izumo"}]
|
|
6
6
|
readme = "README.md"
|
|
@@ -55,6 +55,10 @@ where = ["src"]
|
|
|
55
55
|
[tool.ruff]
|
|
56
56
|
target-version = "py310"
|
|
57
57
|
line-length = 100
|
|
58
|
+
# Generated python-asana scripts pinned as golden snapshots; they use repr/pprint
|
|
59
|
+
# literal style and are validated by ``compile()`` in the snapshot test, not by
|
|
60
|
+
# this project's lint config.
|
|
61
|
+
extend-exclude = ["tests/fixtures/generate_python"]
|
|
58
62
|
|
|
59
63
|
[tool.ruff.format]
|
|
60
64
|
docstring-code-format = true
|