kaggle 2.2.1__tar.gz → 2.2.3__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.
Files changed (95) hide show
  1. {kaggle-2.2.1 → kaggle-2.2.3}/.gitignore +1 -0
  2. {kaggle-2.2.1 → kaggle-2.2.3}/CHANGELOG.md +23 -0
  3. {kaggle-2.2.1 → kaggle-2.2.3}/PKG-INFO +2 -2
  4. {kaggle-2.2.1 → kaggle-2.2.3}/docs/README.md +4 -0
  5. {kaggle-2.2.1 → kaggle-2.2.3}/docs/benchmarks.md +4 -0
  6. {kaggle-2.2.1 → kaggle-2.2.3}/docs/datasets_metadata.md +2 -2
  7. {kaggle-2.2.1 → kaggle-2.2.3}/docs/kernels.md +97 -2
  8. {kaggle-2.2.1 → kaggle-2.2.3}/docs/kernels_metadata.md +2 -0
  9. kaggle-2.2.3/docs/output_format.md +140 -0
  10. {kaggle-2.2.1 → kaggle-2.2.3}/pyproject.toml +5 -6
  11. kaggle-2.2.3/skills/SKILL.md +95 -0
  12. kaggle-2.2.3/skills/references/auth.md +137 -0
  13. {kaggle-2.2.1 → kaggle-2.2.3}/skills/references/benchmarks.md +289 -31
  14. kaggle-2.2.3/skills/references/competitions.md +452 -0
  15. kaggle-2.2.3/skills/references/configuration.md +122 -0
  16. kaggle-2.2.3/skills/references/datasets.md +346 -0
  17. kaggle-2.2.3/skills/references/files.md +70 -0
  18. kaggle-2.2.3/skills/references/forums.md +127 -0
  19. kaggle-2.2.3/skills/references/kernels.md +273 -0
  20. kaggle-2.2.3/skills/references/model_variations.md +206 -0
  21. kaggle-2.2.3/skills/references/model_variations_versions.md +156 -0
  22. kaggle-2.2.3/skills/references/models.md +250 -0
  23. kaggle-2.2.3/skills/references/quota.md +65 -0
  24. {kaggle-2.2.1 → kaggle-2.2.3}/src/kaggle/__init__.py +1 -1
  25. {kaggle-2.2.1 → kaggle-2.2.3}/src/kaggle/api/kaggle_api_extended.py +955 -188
  26. {kaggle-2.2.1 → kaggle-2.2.3}/src/kaggle/cli.py +127 -60
  27. kaggle-2.2.1/tests/unit_tests.py → kaggle-2.2.3/tests/backend/backend_tests.py +11 -4
  28. {kaggle-2.2.1 → kaggle-2.2.3}/tests/run_tests.sh +2 -2
  29. {kaggle-2.2.1 → kaggle-2.2.3}/tests/test_commands.sh +5 -0
  30. {kaggle-2.2.1/src/kaggle/test → kaggle-2.2.3/tests/unit}/test_benchmarks_cli.py +95 -10
  31. kaggle-2.2.3/tests/unit/test_dataset_metadata_update.py +133 -0
  32. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/unit}/test_dataset_status.py +1 -1
  33. {kaggle-2.2.1/src/kaggle/test → kaggle-2.2.3/tests/unit}/test_discussions_cli.py +288 -21
  34. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/unit}/test_kernel_parsing.py +1 -1
  35. kaggle-2.2.3/tests/unit/test_kernels_logs.py +504 -0
  36. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/unit}/test_kernels_pull.py +1 -1
  37. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/unit}/test_quota.py +102 -1
  38. kaggle-2.2.3/tests/unit/test_team_submissions.py +182 -0
  39. {kaggle-2.2.1 → kaggle-2.2.3}/tools/releases/requirements.txt +99 -99
  40. kaggle-2.2.1/skills/SKILL.md +0 -44
  41. kaggle-2.2.1/src/kaggle/models/__init__.py +0 -0
  42. kaggle-2.2.1/tests/__init__.py +0 -0
  43. kaggle-2.2.1/tests/test_kernels_logs.py +0 -202
  44. kaggle-2.2.1/tests/test_team_submissions.py +0 -96
  45. {kaggle-2.2.1 → kaggle-2.2.3}/.gcloudignore +0 -0
  46. {kaggle-2.2.1 → kaggle-2.2.3}/CONTRIBUTING.md +0 -0
  47. {kaggle-2.2.1 → kaggle-2.2.3}/Dockerfile +0 -0
  48. {kaggle-2.2.1 → kaggle-2.2.3}/GEMINI.md +0 -0
  49. {kaggle-2.2.1 → kaggle-2.2.3}/LICENSE.txt +0 -0
  50. {kaggle-2.2.1 → kaggle-2.2.3}/README.md +0 -0
  51. {kaggle-2.2.1 → kaggle-2.2.3}/SECURITY.md +0 -0
  52. {kaggle-2.2.1 → kaggle-2.2.3}/docker-hatch +0 -0
  53. {kaggle-2.2.1 → kaggle-2.2.3}/docs/Makefile +0 -0
  54. {kaggle-2.2.1 → kaggle-2.2.3}/docs/competitions.md +0 -0
  55. {kaggle-2.2.1 → kaggle-2.2.3}/docs/conf.py +0 -0
  56. {kaggle-2.2.1 → kaggle-2.2.3}/docs/configuration.md +0 -0
  57. {kaggle-2.2.1 → kaggle-2.2.3}/docs/datasets.md +0 -0
  58. {kaggle-2.2.1 → kaggle-2.2.3}/docs/forums.md +0 -0
  59. {kaggle-2.2.1 → kaggle-2.2.3}/docs/index.rst +0 -0
  60. {kaggle-2.2.1 → kaggle-2.2.3}/docs/make.bat +0 -0
  61. {kaggle-2.2.1 → kaggle-2.2.3}/docs/model_variations.md +0 -0
  62. {kaggle-2.2.1 → kaggle-2.2.3}/docs/model_variations_versions.md +0 -0
  63. {kaggle-2.2.1 → kaggle-2.2.3}/docs/models.md +0 -0
  64. {kaggle-2.2.1 → kaggle-2.2.3}/docs/models_metadata.md +0 -0
  65. {kaggle-2.2.1 → kaggle-2.2.3}/docs/simulation_competitions.md +0 -0
  66. {kaggle-2.2.1 → kaggle-2.2.3}/docs/tutorials.md +0 -0
  67. {kaggle-2.2.1 → kaggle-2.2.3}/requirements-lint.in +0 -0
  68. {kaggle-2.2.1 → kaggle-2.2.3}/requirements-lint.lock +0 -0
  69. {kaggle-2.2.1 → kaggle-2.2.3}/requirements-test.in +0 -0
  70. {kaggle-2.2.1 → kaggle-2.2.3}/requirements-test.lock +0 -0
  71. {kaggle-2.2.1 → kaggle-2.2.3}/requirements.lock +0 -0
  72. {kaggle-2.2.1 → kaggle-2.2.3}/src/kaggle/LICENSE +0 -0
  73. {kaggle-2.2.1 → kaggle-2.2.3}/src/kaggle/__main__.py +0 -0
  74. {kaggle-2.2.1/integration_tests → kaggle-2.2.3/src/kaggle/api}/__init__.py +0 -0
  75. {kaggle-2.2.1 → kaggle-2.2.3}/src/kaggle/api/kaggle_api.py +0 -0
  76. {kaggle-2.2.1/src/kaggle/api → kaggle-2.2.3/src/kaggle/models}/__init__.py +0 -0
  77. {kaggle-2.2.1 → kaggle-2.2.3}/src/kaggle/models/kaggle_models_extended.py +0 -0
  78. {kaggle-2.2.1 → kaggle-2.2.3}/src/kaggle/models/upload_file.py +0 -0
  79. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/backend}/dataset/data.csv +0 -0
  80. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/backend}/kernel/testing-x.ipynb +0 -0
  81. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/backend}/model/instance/data.csv +0 -0
  82. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/backend}/model/instance/version/metadata.json +0 -0
  83. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/backend}/sample_submission.csv +0 -0
  84. {kaggle-2.2.1/integration_tests → kaggle-2.2.3/tests/integration}/test_models.py +0 -0
  85. {kaggle-2.2.1/src/kaggle/test → kaggle-2.2.3/tests/unit}/conftest.py +0 -0
  86. {kaggle-2.2.1/src/kaggle/test → kaggle-2.2.3/tests/unit}/test_authenticate.py +0 -0
  87. {kaggle-2.2.1/tests → kaggle-2.2.3/tests/unit}/test_retry_after.py +0 -0
  88. {kaggle-2.2.1 → kaggle-2.2.3}/tools/cicd/Dockerfile +0 -0
  89. {kaggle-2.2.1 → kaggle-2.2.3}/tools/cicd/cloudbuild.yaml +0 -0
  90. {kaggle-2.2.1 → kaggle-2.2.3}/tools/cicd/integration-tests.yaml +0 -0
  91. {kaggle-2.2.1 → kaggle-2.2.3}/tools/releases/Dockerfile +0 -0
  92. {kaggle-2.2.1 → kaggle-2.2.3}/tools/releases/cloudbuild.yaml +0 -0
  93. {kaggle-2.2.1 → kaggle-2.2.3}/tools/releases/requirements.in +0 -0
  94. {kaggle-2.2.1 → kaggle-2.2.3}/tools/use-localhost.sh +0 -0
  95. {kaggle-2.2.1 → kaggle-2.2.3}/tools/use-prod.sh +0 -0
@@ -49,6 +49,7 @@ coverage.xml
49
49
  *,cover
50
50
  .hypothesis/
51
51
  venv/
52
+ .venv
52
53
  .python-version
53
54
 
54
55
  # Translations
@@ -3,6 +3,29 @@ Changelog
3
3
 
4
4
  ### Next
5
5
 
6
+ ### 2.2.3
7
+
8
+ * Update --format help text to reference output_format.md (#1074)
9
+ * Update kernel pull docs with version example (#1072)
10
+ * Reorganize tests and rename unit_tests.py to backend_tests.py (#1071)
11
+ * Add support for formatting projections (#1068)
12
+ * Rewrite `kaggle kernels logs --follow` to use SSE log stream (#999)
13
+ * Add --format option to CLI commands supporting --csv (#1062)
14
+
15
+ ### 2.2.2
16
+
17
+ * Clarify LLMS_AVAILABLE vs. full model set in benchmarks docs (#1061)
18
+ * Add kernels topics command (#1056)
19
+ * Improve benchmark task error messages in kaggle CLI (#1057)
20
+ * Fix dataset metadata column/file description updates and docs (#1055)
21
+ * Expand Kaggle CLI skill references (#1054)
22
+ * Tag benchmarks token requests with CLI source for analytics (#1050)
23
+ * Add machine_shape to kernels_initialize metadata template and docs (#1048)
24
+ * Fix 403 for dataset, model, and benchmark topics list (#1051)
25
+ * Fix test_benchmarks_cli.py assertions (#1049)
26
+ * Add paginated downloads for kernel output files (#1046)
27
+ * fix(tests): resolve infinite loop in test_kernels_d_status (#1043)
28
+
6
29
  ### 2.2.1
7
30
 
8
31
  * Add `kaggle competitions team-submissions` command (#1036)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kaggle
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: Access Kaggle resources anywhere
5
5
  Project-URL: Homepage, https://github.com/Kaggle/kaggle-cli
6
6
  Project-URL: Issues, https://github.com/Kaggle/kaggle-cli/issues
@@ -214,7 +214,7 @@ Classifier: Programming Language :: Python :: 3
214
214
  Requires-Python: >=3.11
215
215
  Requires-Dist: bleach
216
216
  Requires-Dist: jupytext
217
- Requires-Dist: kagglesdk<1.0,>=0.1.27
217
+ Requires-Dist: kagglesdk<1.0,>=0.1.30
218
218
  Requires-Dist: packaging
219
219
  Requires-Dist: protobuf
220
220
  Requires-Dist: python-dateutil
@@ -62,6 +62,10 @@ The Kaggle CLI is organized into several command groups:
62
62
  * [Benchmarks](./benchmarks.md): Define evaluation tasks, run them against LLM models, and download results.
63
63
  * [Configuration](./configuration.md): Configure the Kaggle CLI.
64
64
 
65
+ Many commands produce output, which can be formatted for different purposes:
66
+
67
+ * [Output Format](./output_format.md): Control the format of output.
68
+
65
69
  ## Tutorials
66
70
 
67
71
  Explore these tutorials to learn how to perform common tasks:
@@ -77,6 +77,8 @@ In addition to the three credential variables written by `auth`, `init` also wri
77
77
  * `LLM_DEFAULT_EVAL` — Default model slug for evaluation.
78
78
  * `LLMS_AVAILABLE` — Comma-separated list of available model slugs.
79
79
 
80
+ > **Note:** `LLMS_AVAILABLE` is a curated subset of models intended for local development and testing — it is **not** the full set of available models, and the Model Proxy token itself is not restricted to these models. To see all available models, use `kaggle benchmarks tasks models`. To run a task against any model (including those not in `LLMS_AVAILABLE`), use `kaggle benchmarks tasks run`, which executes on Kaggle's infrastructure with access to the full model catalog.
81
+
80
82
  `init` also creates two files alongside the example file:
81
83
 
82
84
  * **`example_task.py`** (or custom name via `--example-file`) — A starter Python script demonstrating how to define a benchmark task using `@task` decorators and the `kaggle_benchmarks` library.
@@ -271,6 +273,8 @@ kaggle benchmarks tasks status <TASK> [options]
271
273
 
272
274
  Prints the task's metadata (slug, creation status, creation time, URL) followed by a table of all runs. Each run row shows the model name, run state, start time, and end time. Any errored runs display their error messages below the table.
273
275
 
276
+ If task creation itself failed, the `Status:` line shows the failure *kind* — the cleaned creation-state enum, titlecased (e.g. `Kernel_Without_Run`, `No_Model_Specified`, `Validation_Failed`, `Errored`) — and an `Error:` line is appended below it with the server-provided `creation_error_message` explaining what went wrong.
277
+
274
278
  ---
275
279
 
276
280
  ### `kaggle benchmarks tasks download`
@@ -74,7 +74,7 @@ The following metadata is currently supported:
74
74
  * `schema`: File schema (definition below):
75
75
  * `fields`: Array of fields in the dataset. Please note that this needs to include ALL of the fields in the data in order or they will not be matched up correctly. A later version of the API will fix this bug.
76
76
  * `name`: Field name
77
- * `title`: Field description
77
+ * `description`: Field description (Note: `title` is also accepted for backward compatibility, but `description` is preferred)
78
78
  * `type`: Field type. A best-effort list of types will be kept at the bottom of this page, but new types may be added that are not documented here.
79
79
  * `keywords`: Contains an array of strings that correspond to an existing tag on Kaggle. If a specified tag doesn't exist, the upload will continue, but that specific tag won't be added.
80
80
  * `kaggle datasets version` (create a new version for an existing Dataset):
@@ -88,7 +88,7 @@ The following metadata is currently supported:
88
88
  * `schema`: File schema (definition below):
89
89
  * `fields`: Array of fields in the dataset. Please note that this needs to include ALL of the fields in the data in order or they will not be matched up correctly. A later version of the API will fix this bug.
90
90
  * `name`: Field name
91
- * `title`: Field description
91
+ * `description`: Field description (Note: `title` is also accepted for backward compatibility, but `description` is preferred)
92
92
  * `type`: Field type. A best-effort list of types will be kept at the bottom of this page, but new types may be added that are not documented here.
93
93
  * `keywords`: Contains an array of strings that correspond to an existing tag on Kaggle. If a specified tag doesn't exist, the upload will continue, but that specific tag won't be added.
94
94
  * `kaggle datasets metadata --update` (update metadata for an existing Dataset) supports all fields mentioned above for `kaggle datasets version`, and additionally:
@@ -179,7 +179,7 @@ kaggle kernels pull <KERNEL> [options]
179
179
 
180
180
  **Arguments:**
181
181
 
182
- * `<KERNEL>`: Kernel URL suffix (format: `owner/kernel-slug`, e.g., `$KAGGLE_DEVELOPER/exercise-as-with`).
182
+ * `<KERNEL>`: Kernel URL suffix (format: `owner/kernel-slug` or `owner/kernel-slug/version`, e.g., `$KAGGLE_DEVELOPER/exercise-as-with` or `$KAGGLE_DEVELOPER/exercise-as-with/2`).
183
183
 
184
184
  **Options:**
185
185
 
@@ -201,6 +201,12 @@ kaggle kernels pull <KERNEL> [options]
201
201
  kaggle kernels pull --wp $KAGGLE_DEVELOPER/exercise-as-with
202
202
  ```
203
203
 
204
+ 3. Pull version 2 of the kernel `$KAGGLE_DEVELOPER/exercise-as-with` into the current working directory:
205
+
206
+ ```bash
207
+ kaggle kernels pull --wp $KAGGLE_DEVELOPER/exercise-as-with/2
208
+ ```
209
+
204
210
  **Purpose:**
205
211
 
206
212
  This command allows you to download the source code and optionally the metadata of a kernel from Kaggle to your local machine.
@@ -226,6 +232,8 @@ kaggle kernels output <KERNEL> [options]
226
232
  * `-o, --force`: Force download, overwriting existing files.
227
233
  * `-q, --quiet`: Suppress verbose output.
228
234
  * `--file-pattern <REGEX>`: Regex pattern to match against filenames. Only files matching the pattern will be downloaded.
235
+ * `--page-size <SIZE>`: Number of output files to request per page. Default size is 20, max is 200.
236
+ * `--page-token <TOKEN>`: Download files from a specific output page. If Kaggle returns another page token, it is printed after the download.
229
237
 
230
238
  **Example:**
231
239
 
@@ -240,9 +248,27 @@ Download PNG files only:
240
248
  kaggle kernels output <kernel> --file-pattern ".*\.png$" # Only PNG files
241
249
  ```
242
250
 
251
+ Download matching PNG files across all output pages:
252
+
253
+ ```bash
254
+ kaggle kernels output <kernel> --file-pattern ".*\.png$"
255
+ ```
256
+
257
+ Download files from a specific output page:
258
+
259
+ ```bash
260
+ kaggle kernels output <kernel> --page-token <TOKEN>
261
+ ```
262
+
263
+ Download files in smaller pages:
264
+
265
+ ```bash
266
+ kaggle kernels output <kernel> --page-size 50
267
+ ```
268
+
243
269
  **Purpose:**
244
270
 
245
- Use this command to retrieve the files generated by a kernel run, such as submission files, processed data, or visualizations.
271
+ Use this command to retrieve the files generated by a kernel run, such as submission files, processed data, or visualizations. By default, output downloads scan every available output page, so `--file-pattern` can match files beyond the first page. Use `--page-size` to control how many files are requested on each page, and use `--page-token` when you only want to download files from one specific page.
246
272
 
247
273
  ## `kaggle kernels status`
248
274
 
@@ -299,3 +325,72 @@ kaggle kernels delete $KAGGLE_DEVELOPER/exercise-delete --yes
299
325
  **Purpose:**
300
326
 
301
327
  This command permanently removes one of your kernels from Kaggle. Use with caution.
328
+
329
+ ## `kaggle kernels topics list`
330
+
331
+ Lists discussion topics for a kernel.
332
+
333
+ **Usage:**
334
+
335
+ ```bash
336
+ kaggle kernels topics list <KERNEL> [options]
337
+ ```
338
+
339
+ **Arguments:**
340
+
341
+ * `<KERNEL>`: Kernel ref in format `<owner>/<kernel-slug>` (e.g., `owner/kernel-slug`).
342
+
343
+ **Options:**
344
+
345
+ * `--sort-by <SORT_BY>`: Sort order. Valid options: `hot`, `top`, `new`, `recent`, `active`, `relevance`.
346
+ * `-s, --search <SEARCH_TERM>`: Search query to filter topics.
347
+ * `--page-size <PAGE_SIZE>`: Number of items per page.
348
+ * `--page-token <PAGE_TOKEN>`: Page token for pagination.
349
+ * `-v, --csv`: Print results in CSV format.
350
+ * `-q, --quiet`: Suppress verbose output.
351
+
352
+ **Example:**
353
+
354
+ List recent topics for the `owner/kernel-slug` kernel:
355
+
356
+ ```bash
357
+ kaggle kernels topics list owner/kernel-slug --sort-by recent
358
+ ```
359
+
360
+ **Purpose:**
361
+
362
+ This command lets you browse discussion topics for a specific kernel.
363
+
364
+ ## `kaggle kernels topics show`
365
+
366
+ Displays a kernel discussion topic with all comments in tree form.
367
+
368
+ **Usage:**
369
+
370
+ ```bash
371
+ kaggle kernels topics show <TOPIC_REF> [options]
372
+ ```
373
+
374
+ **Arguments:**
375
+
376
+ * `<TOPIC_REF>`: A topic reference, which can be:
377
+ * `<kernel>/<topic-id>` (e.g., `owner/kernel-slug/12345`)
378
+ * `<kernel> <topic-id>` (two separate arguments, where `<topic-id>` is passed as second argument)
379
+ * `<topic-id>` (bare numeric ID)
380
+
381
+ **Options:**
382
+
383
+ * `--page-size <PAGE_SIZE>`: Number of comments to show per page.
384
+ * `--page-token <PAGE_TOKEN>`: Page token for comment pagination.
385
+ * `-v, --csv`: Print results in CSV format.
386
+ * `-q, --quiet`: Suppress verbose output.
387
+
388
+ **Example:**
389
+
390
+ ```bash
391
+ kaggle kernels topics show owner/kernel-slug/12345
392
+ ```
393
+
394
+ **Purpose:**
395
+
396
+ This command displays a full discussion topic along with all of its comments rendered in an indented tree structure.
@@ -12,6 +12,7 @@ Here's a basic example for `kernel-metadata.json`:
12
12
  "is_private": "false",
13
13
  "enable_gpu": "false",
14
14
  "enable_internet": "false",
15
+ "machine_shape": "",
15
16
  "dataset_sources": ["timoboz/my-awesome-dataset"],
16
17
  "competition_sources": [],
17
18
  "kernel_sources": [],
@@ -34,6 +35,7 @@ We currently support the following metadata fields for kernels.
34
35
  * `is_private`: Whether or not the kernel should be private. If not specified, will be `true`.
35
36
  * `enable_gpu`: Whether or not the kernel should run on a GPU. If not specified, will be `false`.
36
37
  * `enable_internet`: Whether or not the kernel should be able to access the internet. If not specified, will be `false`.
38
+ * `machine_shape`: The accelerator/GPU type to use (e.g., `NvidiaTeslaT4`, `NvidiaTeslaP100`, or `Tpu1VmV38`).
37
39
  * `dataset_sources`: A list of dataset sources, specified as `"username/dataset-slug"`
38
40
  * `competition_sources`: A list of competition sources, specified as `"competition-slug"`
39
41
  * `kernel_sources`: A list of kernel sources, specified as `"username/kernel-slug"`
@@ -0,0 +1,140 @@
1
+ # Kaggle CLI Output Formatting Documentation
2
+
3
+ This documentation describes the output formatting options available in the Kaggle CLI.
4
+
5
+ ## Output Format Options
6
+
7
+ The Kaggle CLI supports choosing the output format for various commands that list information.
8
+
9
+ ### `--csv` (or `-v`)
10
+
11
+ Historically, many commands supported a `-v` or `--csv` option to display output as comma-separated values (CSV) instead of a formatted table.
12
+
13
+ Example:
14
+ ```sh
15
+ kaggle competitions list --csv
16
+ ```
17
+
18
+ ### `--format`
19
+
20
+ We have introduced a new `--format` option to provide a unified way to specify the output format.
21
+ It accepts the following values:
22
+ * `csv`: Display output as comma-separated values.
23
+ * `table`: Display output as a formatted table (default).
24
+ * `json`: Display output as JSON.
25
+
26
+ Example:
27
+ ```sh
28
+ kaggle competitions list --format csv
29
+ kaggle competitions list --format table
30
+ kaggle competitions list --format json
31
+ ```
32
+
33
+ For most commands, the JSON output is a list of objects representing the rows, with keys corresponding to the column headers. For detailed commands like `topics show`, it returns a structured object:
34
+ ```json
35
+ {
36
+ "topic": { ... },
37
+ "comments": [ ... ]
38
+ }
39
+ ```
40
+
41
+ ### Projections (Field Selection)
42
+
43
+ The `--format` option supports optional `gcloud`-style field selection (projections) by appending a comma-separated list of fields in parentheses to the format name. This allows you to limit the output to only the specified fields and control their order.
44
+
45
+ Projections are supported for all formats (`csv`, `table`, `json`).
46
+
47
+ Example:
48
+ ```sh
49
+ # Only show 'ref' and 'reward' columns for competitions in a table
50
+ kaggle competitions list --format "table(ref,reward)"
51
+
52
+ # Export only 'id' and 'publicScore' to JSON for team submissions
53
+ kaggle competitions team-submissions --format "json(id,publicScore)" <team_id>
54
+
55
+ # Export only 'name' and 'size' to CSV for dataset files
56
+ kaggle datasets files -d zillow/zecon --format "csv(name,size)"
57
+ ```
58
+
59
+ You can specify fields using either their field names (e.g. `totalBytes`) or their display labels (e.g. `size`). If a field is not recognized, the CLI will display an error listing the allowed fields.
60
+
61
+ #### Special Case: Topics Show
62
+
63
+ For `topics show` commands, which output both a parent topic and a list of comments, the projection is applied to both types of objects. Fields matching the topic are applied to the topic output, and fields matching comments are applied to the comment output.
64
+
65
+ Example:
66
+ ```sh
67
+ kaggle forums topics show 123 --format "json(title,content)"
68
+ ```
69
+ In this case, `title` (which is a topic field) will be preserved in the topic output, and `content` (which is a comment field) will be preserved in the comments output.
70
+ ```json
71
+ {
72
+ "topic": {
73
+ "title": "Test Title"
74
+ },
75
+ "comments": [
76
+ {
77
+ "content": "Comment Content"
78
+ }
79
+ ]
80
+ }
81
+ ```
82
+
83
+ ### Mutual Exclusion
84
+
85
+ The `--csv` (or `-v`) option and the `--format` option are **mutually exclusive**. You cannot specify both at the same time.
86
+
87
+ If you attempt to use both, the CLI will display an error:
88
+ ```sh
89
+ kaggle competitions list --csv --format csv
90
+ # Error: argument --format: not allowed with argument -v/--csv
91
+ ```
92
+
93
+ ## Supported Commands
94
+
95
+ The following commands support both `--csv` (legacy) and `--format` options:
96
+
97
+ ### Competitions
98
+ * `kaggle competitions list`
99
+ * `kaggle competitions files`
100
+ * `kaggle competitions submissions`
101
+ * `kaggle competitions leaderboard`
102
+ * `kaggle competitions team-submissions`
103
+ * `kaggle competitions episodes`
104
+ * `kaggle competitions pages`
105
+ * `kaggle competitions topic-messages`
106
+ * `kaggle competitions topics list`
107
+ * `kaggle competitions topics show`
108
+
109
+ ### Datasets
110
+ * `kaggle datasets list`
111
+ * `kaggle datasets files`
112
+ * `kaggle datasets topics list`
113
+ * `kaggle datasets topics show`
114
+
115
+ ### Kernels
116
+ * `kaggle kernels list`
117
+ * `kaggle kernels files`
118
+ * `kaggle kernels topics list`
119
+ * `kaggle kernels topics show`
120
+
121
+ ### Models
122
+ * `kaggle models list`
123
+ * `kaggle models topics list`
124
+ * `kaggle models topics show`
125
+ * `kaggle models instances list`
126
+ * `kaggle models instances files`
127
+ * `kaggle models instances versions list`
128
+ * `kaggle models instances versions files`
129
+
130
+ ### Forums
131
+ * `kaggle forums list`
132
+ * `kaggle forums topics list`
133
+ * `kaggle forums topics show`
134
+
135
+ ### Benchmarks
136
+ * `kaggle benchmarks topics list`
137
+ * `kaggle benchmarks topics show`
138
+
139
+ ### Quota
140
+ * `kaggle quota`
@@ -24,7 +24,7 @@ keywords = ["Kaggle", "API"]
24
24
  requires-python = ">= 3.11"
25
25
  dependencies = [
26
26
  "bleach",
27
- "kagglesdk >= 0.1.27, < 1.0", # sync with kagglehub
27
+ "kagglesdk >= 0.1.30, < 1.0", # sync with kagglehub
28
28
  "python-slugify",
29
29
  "requests",
30
30
  "python-dateutil",
@@ -55,9 +55,9 @@ dependencies = [
55
55
  ]
56
56
 
57
57
  [tool.hatch.envs.test.scripts]
58
- local = "source tools/use-localhost.sh; cd tests; python unit_tests.py --failfast"
59
- prod = "source tools/use-prod.sh; cd tests; python unit_tests.py --failfast"
60
- integration = "pytest integration_tests"
58
+ local = "source tools/use-localhost.sh; cd tests/backend; python backend_tests.py --failfast"
59
+ prod = "source tools/use-prod.sh; cd tests/backend; python backend_tests.py --failfast"
60
+ integration = "pytest tests/integration"
61
61
 
62
62
  [tool.hatch.envs.lint]
63
63
  detached = true
@@ -105,7 +105,6 @@ ignore_missing_imports = true
105
105
 
106
106
  [tool.pytest.ini_options]
107
107
  testpaths = [
108
- "src/kaggle/test",
109
- "tests",
108
+ "tests/unit",
110
109
  ]
111
110
  pythonpath = ["src"]
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: kaggle-cli
3
+ description: >
4
+ Use the local Kaggle CLI skill for command guidance, workflows, and
5
+ troubleshooting across competitions, datasets, kernels/notebooks, models,
6
+ model variations and versions, inbox file uploads, forums/discussions,
7
+ benchmarks, configuration, OAuth/API-token authentication, and accelerator
8
+ quota. Activate this skill when the user asks about kaggle CLI commands,
9
+ examples, flags, metadata files, download/upload flows, submissions,
10
+ benchmark tasks, or Kaggle CLI behavior.
11
+ ---
12
+
13
+ # Kaggle CLI
14
+
15
+ Use this skill to answer or operate on the `kaggle` command-line tool. Treat
16
+ this skill and its references as the available command guide.
17
+
18
+ ## Quick Start
19
+
20
+ ```bash
21
+ pip install kaggle
22
+ kaggle --help
23
+ ```
24
+
25
+ Authentication options:
26
+
27
+ ```bash
28
+ kaggle auth login
29
+ # or set KAGGLE_API_TOKEN
30
+ # or place an access token in ~/.kaggle/access_token
31
+ # or use legacy ~/.kaggle/kaggle.json credentials
32
+ ```
33
+
34
+ ## Command Tree
35
+
36
+ ```text
37
+ kaggle
38
+ ├── competitions | c
39
+ │ ├── list, files, download, submit, submissions, leaderboard
40
+ │ ├── team-submissions, episodes, replay, logs, pages
41
+ │ └── topics {list, show}, topic-messages
42
+ ├── datasets | d
43
+ │ ├── list, files, download, init, create, version
44
+ │ ├── metadata, status, delete
45
+ │ └── topics {list, show}
46
+ ├── kernels | k
47
+ │ └── list, files, init, push|update, pull|get, output, status, logs, delete
48
+ ├── models | m
49
+ │ ├── list, init, create, get, update, delete
50
+ │ ├── topics {list, show}
51
+ │ └── variations | instances | v | i
52
+ │ ├── get, init, create, files, list, update, delete
53
+ │ └── versions | v {list, create, download, files, delete}
54
+ ├── files {upload}
55
+ ├── forums | f {list, topics {list, show}}
56
+ ├── benchmarks | b
57
+ │ ├── auth, init
58
+ │ ├── tasks | t {push, run, list, status, download, log|logs, models, delete, publish}
59
+ │ └── topics {list, show}
60
+ ├── config {view, set, unset}
61
+ ├── auth {login, print-access-token, revoke}
62
+ └── quota
63
+ ```
64
+
65
+ Note: the CLI accepts aliases such as `kernels get` for `kernels pull` and
66
+ `kernels update` for `kernels push`. Do not recommend
67
+ `models variations versions init`; use `models variations init` for variation
68
+ metadata instead.
69
+
70
+ ## Reference Map
71
+
72
+ Read only the reference needed for the user's task:
73
+
74
+ - [Competitions](references/competitions.md) - competition discovery, files, downloads, submissions, leaderboards, simulations, pages, topics.
75
+ - [Datasets](references/datasets.md) - dataset search, files, downloads, metadata, create/version/status/delete, topics.
76
+ - [Kernels](references/kernels.md) - notebook/script discovery, metadata, push/pull, outputs, status, logs, delete.
77
+ - [Models](references/models.md) - model records, metadata, create/get/update/delete, model topics.
78
+ - [Model Variations](references/model_variations.md) - create and manage framework-specific model variations.
79
+ - [Model Variation Versions](references/model_variations_versions.md) - create, list, download, inspect, and delete variation versions.
80
+ - [Files](references/files.md) - inbox uploads, resumable uploads, directory compression behavior.
81
+ - [Forums](references/forums.md) - global discussion forums, topics, and comments.
82
+ - [Benchmarks](references/benchmarks.md) - benchmark auth/init, task push/run/status/download/log/model flows, benchmark topics.
83
+ - [Configuration](references/configuration.md) - config file, default path, proxy, default competition.
84
+ - [Authentication](references/auth.md) - OAuth login, access token printing, revocation, token/key sources.
85
+ - [Quota](references/quota.md) - weekly GPU/TPU accelerator quota.
86
+
87
+ ## Operating Guidance
88
+
89
+ - Read only the reference needed for the user's task.
90
+ - Prefer `kaggle <group> --help` or `kaggle <group> <command> --help` when a flag
91
+ is uncertain in the installed CLI.
92
+ - For metadata files, prefer the relevant `init` command to generate a starter
93
+ file before editing it.
94
+ - Do not invent commands that are not listed in this skill. If live `--help`
95
+ output differs, report it as a version-specific difference.
@@ -0,0 +1,137 @@
1
+ # Authentication CLI Reference
2
+
3
+ Use `kaggle auth` to run OAuth login, print an OAuth access token, or revoke the
4
+ active OAuth refresh token. The CLI also supports non-command authentication via
5
+ `KAGGLE_API_TOKEN`, `~/.kaggle/access_token`, and legacy API key credentials.
6
+
7
+ ## Prerequisites
8
+
9
+ - Python 3.11+ with the `kaggle` package installed.
10
+ - A Kaggle account.
11
+ - Browser access for the default OAuth login flow, or use `--no-launch-browser`
12
+ to print a URL.
13
+
14
+ ## Command Hierarchy
15
+
16
+ ```text
17
+ kaggle auth
18
+ ├── login
19
+ ├── print-access-token
20
+ └── revoke
21
+ ```
22
+
23
+ ## Authentication Sources
24
+
25
+ The CLI authentication flow tries these sources:
26
+
27
+ 1. Access token sources such as `KAGGLE_API_TOKEN` or
28
+ `~/.kaggle/access_token`.
29
+ 2. Legacy API key config from environment/config values `username` and `key`.
30
+ 3. OAuth credentials created by `kaggle auth login`.
31
+
32
+ If none succeed, the CLI prints auth help and exits.
33
+
34
+ Some commands are allowed logged out, including help/version and selected
35
+ public dataset file/download flows.
36
+
37
+ ## `kaggle auth login`
38
+
39
+ Runs Kaggle OAuth login.
40
+
41
+ **Usage:**
42
+
43
+ ```bash
44
+ kaggle auth login [options]
45
+ ```
46
+
47
+ **Options:**
48
+
49
+ - `--no-launch-browser`: Do not launch a browser; print an auth URL instead.
50
+ - `--force`: Re-run login even if already logged in.
51
+
52
+ **Examples:**
53
+
54
+ ```bash
55
+ kaggle auth login
56
+ kaggle auth login --no-launch-browser
57
+ kaggle auth login --force
58
+ ```
59
+
60
+ **Purpose:** Store OAuth credentials for the active Kaggle account.
61
+
62
+ **Behavior details:**
63
+
64
+ - If credentials already exist and `--force` is not set, the command prints the
65
+ current account and exits with instructions to use `--force`.
66
+ - The OAuth flow requests the default scope `resources.admin:*`.
67
+
68
+ ## `kaggle auth print-access-token`
69
+
70
+ Prints an access token for the active OAuth account.
71
+
72
+ **Usage:**
73
+
74
+ ```bash
75
+ kaggle auth print-access-token [options]
76
+ ```
77
+
78
+ **Options:**
79
+
80
+ - `--expiration <DURATION>`: Override token duration.
81
+
82
+ **Examples:**
83
+
84
+ ```bash
85
+ kaggle auth print-access-token
86
+ ```
87
+
88
+ **Purpose:** Emit a token that can be placed in `KAGGLE_API_TOKEN` or another
89
+ supported token source.
90
+
91
+ **Behavior details:**
92
+
93
+ - Requires OAuth credentials from `kaggle auth login`.
94
+ - If no OAuth credentials exist, the command tells the user to run
95
+ `kaggle auth login`.
96
+ - Some CLI help examples use short forms such as `6h`. For automation, omit
97
+ `--expiration` unless the accepted duration format has been verified with
98
+ the installed CLI.
99
+
100
+ ## `kaggle auth revoke`
101
+
102
+ Revokes the active OAuth refresh token.
103
+
104
+ **Usage:**
105
+
106
+ ```bash
107
+ kaggle auth revoke [options]
108
+ ```
109
+
110
+ **Options:**
111
+
112
+ - `--reason <TEXT>`: Reason sent to the server.
113
+
114
+ **Examples:**
115
+
116
+ ```bash
117
+ kaggle auth revoke
118
+ kaggle auth revoke --reason "rotating credentials"
119
+ ```
120
+
121
+ **Purpose:** Invalidate the active OAuth credential.
122
+
123
+ **Behavior details:**
124
+
125
+ - If no OAuth credentials exist, the command prints `There is no token to
126
+ revoke.` and exits successfully.
127
+ - If no reason is provided, the default reason is
128
+ `Manually revoked by user with kaggle-cli`.
129
+
130
+ ## Legacy And Token Auth Notes
131
+
132
+ - `KAGGLE_API_TOKEN` can authenticate without a legacy username/key pair when
133
+ the token introspection succeeds.
134
+ - Legacy config can come from `~/.kaggle/kaggle.json` or environment variables
135
+ such as `KAGGLE_USERNAME` and `KAGGLE_KEY`.
136
+ - Prefer `kaggle auth login` for OAuth credentials or `KAGGLE_API_TOKEN` for
137
+ non-interactive authentication.