kaggle 1.8.2__py3-none-any.whl → 1.8.4__py3-none-any.whl

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 (143) hide show
  1. kaggle/__init__.py +1 -1
  2. kaggle/api/kaggle_api_extended.py +206 -75
  3. kaggle/cli.py +36 -28
  4. kaggle/models/upload_file.py +4 -4
  5. {kaggle-1.8.2.dist-info → kaggle-1.8.4.dist-info}/METADATA +66 -75
  6. kaggle-1.8.4.dist-info/RECORD +15 -0
  7. {kaggle-1.8.2.dist-info → kaggle-1.8.4.dist-info}/WHEEL +1 -1
  8. kaggle/models/api_blob_type.py +0 -4
  9. kaggle/models/dataset_column.py +0 -228
  10. kaggle/models/dataset_new_request.py +0 -443
  11. kaggle/models/dataset_new_version_request.py +0 -319
  12. kaggle/models/dataset_update_settings_request.py +0 -344
  13. kaggle/models/kernel_push_request.py +0 -608
  14. kaggle/models/model_instance_new_version_request.py +0 -145
  15. kaggle/models/model_instance_update_request.py +0 -451
  16. kaggle/models/model_new_instance_request.py +0 -552
  17. kaggle/models/model_new_request.py +0 -329
  18. kaggle/models/model_update_request.py +0 -300
  19. kaggle/models/start_blob_upload_request.py +0 -240
  20. kaggle/models/start_blob_upload_response.py +0 -142
  21. kaggle-1.8.2.dist-info/RECORD +0 -148
  22. kagglesdk/LICENSE +0 -201
  23. kagglesdk/__init__.py +0 -6
  24. kagglesdk/admin/__init__.py +0 -0
  25. kagglesdk/admin/services/__init__.py +0 -0
  26. kagglesdk/admin/services/inbox_file_service.py +0 -22
  27. kagglesdk/admin/types/__init__.py +0 -0
  28. kagglesdk/admin/types/inbox_file_service.py +0 -74
  29. kagglesdk/benchmarks/__init__.py +0 -0
  30. kagglesdk/benchmarks/services/__init__.py +0 -0
  31. kagglesdk/benchmarks/services/benchmarks_api_service.py +0 -19
  32. kagglesdk/benchmarks/types/__init__.py +0 -0
  33. kagglesdk/benchmarks/types/benchmark_types.py +0 -307
  34. kagglesdk/benchmarks/types/benchmarks_api_service.py +0 -243
  35. kagglesdk/blobs/__init__.py +0 -0
  36. kagglesdk/blobs/services/__init__.py +0 -0
  37. kagglesdk/blobs/services/blob_api_service.py +0 -25
  38. kagglesdk/blobs/types/__init__.py +0 -0
  39. kagglesdk/blobs/types/blob_api_service.py +0 -177
  40. kagglesdk/common/__init__.py +0 -0
  41. kagglesdk/common/services/__init__.py +0 -0
  42. kagglesdk/common/services/operations_service.py +0 -46
  43. kagglesdk/common/types/__init__.py +0 -0
  44. kagglesdk/common/types/file_download.py +0 -102
  45. kagglesdk/common/types/http_redirect.py +0 -105
  46. kagglesdk/common/types/operations.py +0 -194
  47. kagglesdk/common/types/operations_service.py +0 -48
  48. kagglesdk/community/__init__.py +0 -0
  49. kagglesdk/community/types/__init__.py +0 -0
  50. kagglesdk/community/types/content_enums.py +0 -44
  51. kagglesdk/community/types/organization.py +0 -410
  52. kagglesdk/competitions/__init__.py +0 -0
  53. kagglesdk/competitions/services/__init__.py +0 -0
  54. kagglesdk/competitions/services/competition_api_service.py +0 -178
  55. kagglesdk/competitions/types/__init__.py +0 -0
  56. kagglesdk/competitions/types/competition.py +0 -14
  57. kagglesdk/competitions/types/competition_api_service.py +0 -2393
  58. kagglesdk/competitions/types/competition_enums.py +0 -53
  59. kagglesdk/competitions/types/search_competitions.py +0 -28
  60. kagglesdk/competitions/types/submission_status.py +0 -9
  61. kagglesdk/datasets/__init__.py +0 -0
  62. kagglesdk/datasets/databundles/__init__.py +0 -0
  63. kagglesdk/datasets/databundles/types/__init__.py +0 -0
  64. kagglesdk/datasets/databundles/types/databundle_api_types.py +0 -540
  65. kagglesdk/datasets/services/__init__.py +0 -0
  66. kagglesdk/datasets/services/dataset_api_service.py +0 -195
  67. kagglesdk/datasets/types/__init__.py +0 -0
  68. kagglesdk/datasets/types/dataset_api_service.py +0 -3047
  69. kagglesdk/datasets/types/dataset_enums.py +0 -103
  70. kagglesdk/datasets/types/dataset_service.py +0 -145
  71. kagglesdk/datasets/types/dataset_types.py +0 -646
  72. kagglesdk/datasets/types/search_datasets.py +0 -6
  73. kagglesdk/discussions/__init__.py +0 -0
  74. kagglesdk/discussions/types/__init__.py +0 -0
  75. kagglesdk/discussions/types/search_discussions.py +0 -43
  76. kagglesdk/discussions/types/writeup_enums.py +0 -11
  77. kagglesdk/education/__init__.py +0 -0
  78. kagglesdk/education/services/__init__.py +0 -0
  79. kagglesdk/education/services/education_api_service.py +0 -19
  80. kagglesdk/education/types/__init__.py +0 -0
  81. kagglesdk/education/types/education_api_service.py +0 -248
  82. kagglesdk/education/types/education_service.py +0 -139
  83. kagglesdk/kaggle_client.py +0 -101
  84. kagglesdk/kaggle_creds.py +0 -148
  85. kagglesdk/kaggle_env.py +0 -104
  86. kagglesdk/kaggle_http_client.py +0 -269
  87. kagglesdk/kaggle_oauth.py +0 -200
  88. kagglesdk/kaggle_object.py +0 -344
  89. kagglesdk/kernels/__init__.py +0 -0
  90. kagglesdk/kernels/services/__init__.py +0 -0
  91. kagglesdk/kernels/services/kernels_api_service.py +0 -146
  92. kagglesdk/kernels/types/__init__.py +0 -0
  93. kagglesdk/kernels/types/kernels_api_service.py +0 -2451
  94. kagglesdk/kernels/types/kernels_enums.py +0 -39
  95. kagglesdk/kernels/types/search_kernels.py +0 -6
  96. kagglesdk/licenses/__init__.py +0 -0
  97. kagglesdk/licenses/types/__init__.py +0 -0
  98. kagglesdk/licenses/types/licenses_types.py +0 -182
  99. kagglesdk/models/__init__.py +0 -0
  100. kagglesdk/models/services/__init__.py +0 -0
  101. kagglesdk/models/services/model_api_service.py +0 -280
  102. kagglesdk/models/services/model_service.py +0 -19
  103. kagglesdk/models/types/__init__.py +0 -0
  104. kagglesdk/models/types/model_api_service.py +0 -4069
  105. kagglesdk/models/types/model_enums.py +0 -68
  106. kagglesdk/models/types/model_service.py +0 -275
  107. kagglesdk/models/types/model_types.py +0 -1338
  108. kagglesdk/models/types/search_models.py +0 -8
  109. kagglesdk/search/__init__.py +0 -0
  110. kagglesdk/search/services/__init__.py +0 -0
  111. kagglesdk/search/services/search_api_service.py +0 -19
  112. kagglesdk/search/types/__init__.py +0 -0
  113. kagglesdk/search/types/search_api_service.py +0 -2435
  114. kagglesdk/search/types/search_content_shared.py +0 -50
  115. kagglesdk/search/types/search_enums.py +0 -45
  116. kagglesdk/search/types/search_service.py +0 -303
  117. kagglesdk/security/__init__.py +0 -0
  118. kagglesdk/security/services/__init__.py +0 -0
  119. kagglesdk/security/services/iam_service.py +0 -31
  120. kagglesdk/security/services/oauth_service.py +0 -58
  121. kagglesdk/security/types/__init__.py +0 -0
  122. kagglesdk/security/types/authentication.py +0 -171
  123. kagglesdk/security/types/iam_service.py +0 -496
  124. kagglesdk/security/types/oauth_service.py +0 -1181
  125. kagglesdk/security/types/roles.py +0 -8
  126. kagglesdk/security/types/security_types.py +0 -159
  127. kagglesdk/test/__init__.py +0 -0
  128. kagglesdk/test/test_client.py +0 -41
  129. kagglesdk/users/__init__.py +0 -0
  130. kagglesdk/users/services/__init__.py +0 -0
  131. kagglesdk/users/services/account_service.py +0 -31
  132. kagglesdk/users/services/group_api_service.py +0 -31
  133. kagglesdk/users/types/__init__.py +0 -0
  134. kagglesdk/users/types/account_service.py +0 -345
  135. kagglesdk/users/types/group_api_service.py +0 -315
  136. kagglesdk/users/types/group_types.py +0 -165
  137. kagglesdk/users/types/groups_enum.py +0 -8
  138. kagglesdk/users/types/progression_service.py +0 -9
  139. kagglesdk/users/types/search_users.py +0 -23
  140. kagglesdk/users/types/user_avatar.py +0 -226
  141. kagglesdk/users/types/users_enums.py +0 -22
  142. {kaggle-1.8.2.dist-info → kaggle-1.8.4.dist-info}/entry_points.txt +0 -0
  143. {kaggle-1.8.2.dist-info → kaggle-1.8.4.dist-info}/licenses/LICENSE.txt +0 -0
kaggle/cli.py CHANGED
@@ -35,8 +35,8 @@ def main() -> None:
35
35
  "-v",
36
36
  "--version",
37
37
  action="version",
38
- help="Print the Kaggle API version",
39
- version="Kaggle API " + kaggle.__version__,
38
+ help="Print the Kaggle CLI version",
39
+ version="Kaggle CLI " + kaggle.__version__,
40
40
  )
41
41
  parser.add_argument(
42
42
  "-W",
@@ -550,6 +550,7 @@ def parse_kernels(subparsers) -> None:
550
550
  parser_kernels_push_optional.add_argument(
551
551
  "-t", "--timeout", type=int, dest="timeout", help=Help.param_kernel_timeout
552
552
  )
553
+ parser_kernels_push_optional.add_argument("--accelerator", dest="acc", help=Help.param_kernel_acc)
553
554
  parser_kernels_push._action_groups.append(parser_kernels_push_optional)
554
555
  parser_kernels_push.set_defaults(func=api.kernels_push_cli)
555
556
 
@@ -592,6 +593,9 @@ def parse_kernels(subparsers) -> None:
592
593
  parser_kernels_output_optional.add_argument(
593
594
  "-q", "--quiet", dest="quiet", action="store_true", required=False, help=Help.param_quiet
594
595
  )
596
+ parser_kernels_output_optional.add_argument(
597
+ "--file-pattern", dest="file_pattern", required=False, help=Help.param_kernel_output_file_pattern
598
+ )
595
599
  parser_kernels_output._action_groups.append(parser_kernels_output_optional)
596
600
  parser_kernels_output.set_defaults(func=api.kernels_output_cli)
597
601
 
@@ -1083,9 +1087,9 @@ class Help(object):
1083
1087
  + ", ".join(kernels_choices)
1084
1088
  + "}\nmodels {"
1085
1089
  + ", ".join(models_choices)
1086
- + "}\nmodels instances {"
1090
+ + "}\nmodels variations {"
1087
1091
  + ", ".join(model_instances_choices)
1088
- + "}\nmodels instances versions {"
1092
+ + "}\nmodels variations versions {"
1089
1093
  + ", ".join(model_instance_versions_choices)
1090
1094
  + "}\nconfig {"
1091
1095
  + ", ".join(config_choices)
@@ -1098,8 +1102,8 @@ class Help(object):
1098
1102
  group_datasets = "Commands related to Kaggle datasets"
1099
1103
  group_kernels = "Commands related to Kaggle kernels"
1100
1104
  group_models = "Commands related to Kaggle models"
1101
- group_model_instances = "Commands related to Kaggle model instances"
1102
- group_model_instance_versions = "Commands related to Kaggle model instance versions"
1105
+ group_model_instances = "Commands related to Kaggle model variations"
1106
+ group_model_instance_versions = "Commands related to Kaggle model variations versions"
1103
1107
  group_files = "Commands related files"
1104
1108
  group_config = "Configuration settings"
1105
1109
  group_auth = "Commands related to authentication"
@@ -1174,7 +1178,7 @@ class Help(object):
1174
1178
  "File for upload (full path), or the name of the output file produced by a kernel (for code competitions)"
1175
1179
  )
1176
1180
  param_code_kernel = "Name of kernel (notebook) to submit to a code competition"
1177
- param_code_version = 'Version of kernel to submit to a code competition, e.g. "Version 1"'
1181
+ param_code_version = 'Version of kernel to submit to a code competition, e.g. "3"'
1178
1182
  param_csv = "Print results in CSV format (if not set print in table format)"
1179
1183
  param_page = "Page number for results paging. Page size is 20 by default"
1180
1184
  # NOTE: Default and max page size are set by the mid-tier code.
@@ -1226,7 +1230,7 @@ class Help(object):
1226
1230
  param_dataset_upfile = (
1227
1231
  "Folder for upload, containing data files and a "
1228
1232
  "special datasets-metadata.json file "
1229
- "(https://github.com/Kaggle/kaggle-api/wiki/Dataset-Metadata). "
1233
+ "(https://github.com/Kaggle/kaggle-cli/blob/main/docs/datasets_metadata.md). "
1230
1234
  "Defaults to current working directory"
1231
1235
  )
1232
1236
  param_dataset_sort_by = (
@@ -1258,7 +1262,7 @@ class Help(object):
1258
1262
  param_kernel_upfile = (
1259
1263
  "Folder for upload, containing data files and a "
1260
1264
  "special kernel-metadata.json file "
1261
- "(https://github.com/Kaggle/kaggle-api/wiki/Kernel-Metadata). "
1265
+ "(https://github.com/Kaggle/kaggle-cli/blob/main/docs/kernels_metadata.md). "
1262
1266
  "Defaults to current working directory"
1263
1267
  )
1264
1268
  param_kernel_parent = "Find children of the specified parent kernel"
@@ -1293,6 +1297,10 @@ class Help(object):
1293
1297
  "is only applicable if a search term is specified."
1294
1298
  )
1295
1299
  param_kernel_pull_metadata = "Generate metadata when pulling kernel"
1300
+ param_kernel_output_file_pattern = (
1301
+ "Regex pattern to match against filenames. Only files matching the pattern will be downloaded."
1302
+ )
1303
+ param_kernel_acc = "Specify the type of accelerator to use for the kernel run"
1296
1304
 
1297
1305
  # Models params
1298
1306
  param_model = "Model URL suffix in format <owner>/<model-name>"
@@ -1303,47 +1311,47 @@ class Help(object):
1303
1311
  param_model_owner = "Find public models owned by a specific user or organization"
1304
1312
  param_model_downfile = (
1305
1313
  "Folder containing the special model-metadata.json file "
1306
- "(https://github.com/Kaggle/kaggle-api/wiki/Model-Metadata)."
1314
+ "(https://github.com/Kaggle/kaggle-cli/blob/main/docs/models_metadata.md)."
1307
1315
  )
1308
1316
  param_model_upfile = (
1309
1317
  "Folder containing the special model-metadata.json file "
1310
- "(https://github.com/Kaggle/kaggle-api/wiki/Model-Metadata). "
1318
+ "(https://github.com/Kaggle/kaggle-cli/blob/main/docs/models_metadata.md). "
1311
1319
  "Defaults to current working directory"
1312
1320
  )
1313
1321
 
1314
1322
  # Model Instances params
1315
- param_model_instance = "Model Instance URL suffix in format <owner>/<model-name>/<framework>/<instance-slug>"
1316
- command_model_instances_get = "Get a model instance"
1317
- command_model_instances_init = "Initialize metadata file for model instance creation"
1318
- command_model_instances_files = "List files for the current version of a model instance"
1319
- command_model_instances_list = "List instances of a model"
1320
- command_model_instances_new = "Create a new model instance"
1323
+ param_model_instance = "Model variation URL suffix in format <owner>/<model-name>/<framework>/<instance-slug>"
1324
+ command_model_instances_get = "Get a model variation"
1325
+ command_model_instances_init = "Initialize metadata file for model variation creation"
1326
+ command_model_instances_files = "List files for the current version of a model variation"
1327
+ command_model_instances_list = "List variations of a model"
1328
+ command_model_instances_new = "Create a new model variation"
1321
1329
  param_model_instance_downfile = (
1322
1330
  "Folder for downloading the special model-instance-metadata.json file "
1323
- "(https://github.com/Kaggle/kaggle-api/wiki/Model-Metadata#model-instance). "
1331
+ "(https://github.com/Kaggle/kaggle-cli/blob/main/docs/models_metadata.md#model-instance). "
1324
1332
  )
1325
1333
  param_model_instance_upfile = (
1326
1334
  "Folder for upload, containing data files and a "
1327
1335
  "special model-instance-metadata.json file "
1328
- "(https://github.com/Kaggle/kaggle-api/wiki/Model-Metadata#model-instance). "
1336
+ "(https://github.com/Kaggle/kaggle-cli/blob/main/docs/models_metadata.md#model-instance). "
1329
1337
  "Defaults to current working directory"
1330
1338
  )
1331
- command_model_instances_delete = "Delete a model instance"
1332
- command_model_instances_update = "Update a model instance"
1339
+ command_model_instances_delete = "Delete a model variation"
1340
+ command_model_instances_update = "Update a model variation"
1333
1341
 
1334
1342
  # Model Instance Versions params
1335
1343
  param_model_instance_version = (
1336
- "Model Instance Version URL suffix in format <owner>/<model-name>/<framework>/<instance-slug>/<version-number>"
1344
+ "Model variation version URL suffix in format <owner>/<model-name>/<framework>/<variation-slug>/<version-number>"
1337
1345
  )
1338
1346
 
1339
1347
  # Model Instance Versions params
1340
- command_model_instance_versions_new = "Create a new model instance version"
1348
+ command_model_instance_versions_new = "Create a new model variation version"
1341
1349
  param_model_instance_version_upfile = "Folder for upload. Defaults to current working directory"
1342
- command_model_instance_versions_delete = "Delete a model instance version"
1343
- command_model_instance_versions_download = "Download model instance version files"
1344
- command_model_instance_versions_files = "List model instance version files"
1345
- command_model_instance_versions_list = "List model instance versions"
1346
- param_model_instance_version_notes = "Version notes to record for the new model instance version"
1350
+ command_model_instance_versions_delete = "Delete a model variation version"
1351
+ command_model_instance_versions_download = "Download model variation version files"
1352
+ command_model_instance_versions_files = "List model variation version files"
1353
+ command_model_instance_versions_list = "List model variation versions"
1354
+ param_model_instance_version_notes = "Version notes to record for the new model variation version"
1347
1355
 
1348
1356
  # Files params
1349
1357
  param_files_upload_inbox_path = "Virtual path on the server where the uploaded files will be stored"
@@ -21,7 +21,7 @@ import re # noqa: F401
21
21
 
22
22
  import six
23
23
 
24
- from kaggle.models.dataset_column import DatasetColumn # noqa: F401,E501
24
+ from kagglesdk.datasets.types.dataset_api_service import ApiDatasetColumn
25
25
 
26
26
 
27
27
  class UploadFile(object):
@@ -33,7 +33,7 @@ class UploadFile(object):
33
33
  and the value is json key in definition.
34
34
  """
35
35
 
36
- column_types = {"token": "str", "description": "str", "columns": "list[DatasetColumn]"}
36
+ column_types = {"token": "str", "description": "str", "columns": "list[ApiDatasetColumn]"}
37
37
 
38
38
  attribute_map = {"token": "token", "description": "description", "columns": "columns"}
39
39
 
@@ -107,7 +107,7 @@ class UploadFile(object):
107
107
  A list of dataset column metadata # noqa: E501
108
108
 
109
109
  :return: The columns of this UploadFile. # noqa: E501
110
- :rtype: list[DatasetColumn]
110
+ :rtype: list[ApiDatasetColumn]
111
111
  """
112
112
  return self._columns
113
113
 
@@ -118,7 +118,7 @@ class UploadFile(object):
118
118
  A list of dataset column metadata # noqa: E501
119
119
 
120
120
  :param columns: The columns of this UploadFile. # noqa: E501
121
- :type: list[DatasetColumn]
121
+ :type: list[ApiDatasetColumn]
122
122
  """
123
123
 
124
124
  self._columns = columns
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kaggle
3
- Version: 1.8.2
3
+ Version: 1.8.4
4
4
  Summary: Access Kaggle resources anywhere
5
- Project-URL: Homepage, https://github.com/Kaggle/kaggle-api
6
- Project-URL: Issues, https://github.com/Kaggle/kaggle-api/issues
5
+ Project-URL: Homepage, https://github.com/Kaggle/kaggle-cli
6
+ Project-URL: Issues, https://github.com/Kaggle/kaggle-cli/issues
7
7
  Author-email: Kaggle <support@kaggle.com>
8
8
  License: Apache License
9
9
  Version 2.0, January 2004
@@ -212,46 +212,57 @@ Classifier: License :: OSI Approved :: Apache Software License
212
212
  Classifier: Operating System :: OS Independent
213
213
  Classifier: Programming Language :: Python :: 3
214
214
  Requires-Python: >=3.11
215
- Requires-Dist: black>=24.10.0
216
215
  Requires-Dist: bleach
217
- Requires-Dist: kagglesdk
218
- Requires-Dist: mypy>=1.15.0
216
+ Requires-Dist: kagglesdk<1.0,>=0.1.15
217
+ Requires-Dist: packaging
219
218
  Requires-Dist: protobuf
220
219
  Requires-Dist: python-dateutil
221
220
  Requires-Dist: python-slugify
222
221
  Requires-Dist: requests
223
- Requires-Dist: setuptools>=21.0.0
224
- Requires-Dist: six>=1.10
225
222
  Requires-Dist: tqdm
226
- Requires-Dist: types-requests
227
- Requires-Dist: types-tqdm
228
223
  Requires-Dist: urllib3>=1.15.1
229
224
  Description-Content-Type: text/markdown
230
225
 
231
- # Kaggle API
226
+ # Kaggle CLI
232
227
 
233
- Official API for https://www.kaggle.com, accessible using a command line tool implemented in Python 3.
228
+ The official CLI to interact with [Kaggle](https://www.kaggle.com).
229
+
230
+ ---
234
231
 
235
232
  [User documentation](docs/README.md)
236
233
 
237
- ## Installation
234
+ ---
238
235
 
239
- Ensure you have Python 3 and the package manager `pip` installed.
236
+ ## Key Features
240
237
 
241
- Run the following command to access the Kaggle API using the command line:
238
+ Some of the key features are:
239
+
240
+ * List competitions, download competition data, submit to a competition.
241
+ * List, create, update, download or delete datasets.
242
+ * List, create, update, download or delete models & model variations.
243
+ * List, update & run, download code & output or delete kernels (notebooks).
244
+
245
+ ## Installation
246
+
247
+ Install the `kaggle` package with [pip](https://pypi.org/project/pip/):
242
248
 
243
249
  ```sh
244
250
  pip install kaggle
245
251
  ```
246
252
 
247
- ## Development
253
+ Additional installation instructions can be found [here](docs/README.md#installation).
248
254
 
249
- ### Kaggle Internal
255
+ ## Quick start
250
256
 
251
- Obviously, this depends on Kaggle services. When you're extending the API and modifying
252
- or adding to those services, you should be working in your Kaggle mid-tier development
253
- environment. You'll run Kaggle locally, in the container, and test the Python code by
254
- running it in the container so it can connect to your local testing environment.
257
+ Explore the available commands by running:
258
+
259
+ ```sh
260
+ kaggle --help
261
+ ```
262
+
263
+ See the [User documentation](docs/README.md) for more examples & tutorials.
264
+
265
+ ## Development
255
266
 
256
267
  ### Prerequisites
257
268
 
@@ -259,87 +270,67 @@ We use [hatch](https://hatch.pypa.io) to manage this project.
259
270
 
260
271
  Follow these [instructions](https://hatch.pypa.io/latest/install/) to install it.
261
272
 
262
- If you are working in a managed environment, you may want to use `pipx`. If it isn't already installed
263
- try `sudo apt install pipx`. Then you should be able to proceed with `pipx install hatch`.
273
+ ### Run `kaggle` from source
264
274
 
265
- ### Dependencies
275
+ #### Option 1: Execute a one-liner of code from the command line
266
276
 
267
277
  ```sh
268
- hatch run install-deps
278
+ hatch run kaggle datasets list
269
279
  ```
270
280
 
271
- ### Compile
281
+ #### Option 2: Run many commands in a shell
272
282
 
273
283
  ```sh
274
- hatch run compile
284
+ hatch shell
285
+
286
+ # Inside the shell, you can run many commands
287
+ kaggle datasets list
288
+ kaggle competitions list
289
+ ...
275
290
  ```
276
291
 
277
- The compiled files are generated in the `kaggle/` directory from the `src/` directory.
292
+ ### Lint / Format
278
293
 
279
- All the changes must be done in the `src/` directory.
294
+ ```sh
295
+ # Lint check
296
+ hatch run lint:style
297
+ hatch run lint:typing
298
+ hatch run lint:all # for both
280
299
 
281
- ### Run
300
+ # Format
301
+ hatch run lint:fmt
302
+ ```
282
303
 
283
- Use `hatch run install` to compile the program and install it in the default `hatch` environment.
284
- To run that version locally for testing, use hatch: `hatch run kaggle -v`. If you'd rather not
285
- type `hatch run` every time, launch a new shell in the hatch environment: `hatch shell`.
304
+ ### Tests
286
305
 
287
- You can also run the code in python directly:
306
+ Note: These tests are not true unit tests and are calling the Kaggle web server.
288
307
 
289
308
  ```sh
290
- hatch run python
291
- ```
292
-
293
- ```python
294
- import kaggle
295
- from kaggle.api.kaggle_api_extended import KaggleApi
296
- api = KaggleApi()
297
- api.authenticate()
298
- api.model_list_cli()
299
-
300
- Next Page Token = [...]
301
- [...]
309
+ # Run against kaggle.com
310
+ hatch run test:prod
302
311
 
312
+ # Run against a local web server (Kaggle engineers only)
313
+ hatch run test:local
303
314
  ```
304
315
 
305
- Or in a single command:
306
-
307
- ```sh
308
- hatch run python -c "import kaggle; from kaggle.api.kaggle_api_extended import KaggleApi; api = KaggleApi(); api.authenticate(); api.model_list_cli()"
309
- ```
316
+ ### Integration Tests
310
317
 
311
- ### Example
318
+ To run integration tests on your local machine, you need to set up your Kaggle credentials. You can do this by following the [authentication instructions](docs/README.md#authentication).
312
319
 
313
- Let's change the `model_list_cli` method in the source file:
320
+ After setting up your credentials, you can run the integration tests as follows:
314
321
 
315
322
  ```sh
316
- git diff src/kaggle/api/kaggle_api_extended.py
317
- [...]
318
- + print('hello Kaggle CLI update')^M
319
- models = self.model_list(sort_by, search, owner, page_size, page_token)
320
- [...]
321
-
322
- ❯ hatch run compile
323
- [...]
324
-
325
- ❯ hatch run python -c "import kaggle; from kaggle.api.kaggle_api_extended import KaggleApi; api = KaggleApi(); api.authenticate(); api.model_list_cli()"
326
- hello Kaggle CLI update
327
- Next Page Token = [...]
323
+ hatch run test:integration
328
324
  ```
329
325
 
330
- ### Integration Tests
326
+ ## Changelog
331
327
 
332
- To run integration tests on your local machine, you need to set up your Kaggle API credentials. You can do this in one of these two ways described [this doc](docs/README.md). Refer to the sections:
333
- - Using environment variables
334
- - Using credentials file
328
+ See [CHANGELOG](CHANGELOG.md).
335
329
 
336
- After setting up your credentials by any of these methods, you can run the integration tests as follows:
330
+ ## Contributing
337
331
 
338
- ```sh
339
- # Run all tests
340
- hatch run integration-test
341
- ```
332
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
342
333
 
343
334
  ## License
344
335
 
345
- The Kaggle API is released under the [Apache 2.0 license](LICENSE).
336
+ The Kaggle CLI is released under the [Apache 2.0 license](LICENSE.txt).
@@ -0,0 +1,15 @@
1
+ kaggle/LICENSE,sha256=PN5H3cwV3xW9nvUXKcB_XOH60cWqne6qK3SAE8NI74s,11340
2
+ kaggle/__init__.py,sha256=fUks8_ewdXRldJ0jq82KRKgsyUae8DtxU6QFrGtaxeE,280
3
+ kaggle/cli.py,sha256=f6RX_XZJNwMkbj5ftDSHcHGrV_czqwWrfRqK63y-Lx0,69820
4
+ kaggle/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ kaggle/api/kaggle_api.py,sha256=k_Fm5TxiUM6O19dMy43XTdYyBNIWWGWDE9QRf6otwUE,25521
6
+ kaggle/api/kaggle_api_extended.py,sha256=H50hT_jbQcD0DirfX89jT3HvqGiX6Eko3LyAx_gulFI,228320
7
+ kaggle/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ kaggle/models/kaggle_models_extended.py,sha256=w-IEn0AQvIZRj3ialSoOMOJm8vu48whqte36IdggI7Q,7997
9
+ kaggle/models/upload_file.py,sha256=i_8CfypwOToCoxAvG96Gle3IgNkrVnc38Y4oMHKqNjg,5081
10
+ kaggle/test/test_authenticate.py,sha256=6HvLhQ4noCXs3hVJpQP-tlSYv1_I9kKfAT2Nu3PeC7Q,1185
11
+ kaggle-1.8.4.dist-info/METADATA,sha256=KD5dM79V1y57b-X76cdRuWi0pvmn45oMYOkR1y0fpTA,15925
12
+ kaggle-1.8.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
13
+ kaggle-1.8.4.dist-info/entry_points.txt,sha256=hl3dQAS4qpVkC5FWiqfnU6qKJU924OEN6PsHEiw-FGg,43
14
+ kaggle-1.8.4.dist-info/licenses/LICENSE.txt,sha256=IzhfWrxIlFAci3lzZCg5WWHZJBI1QSzsHxO0plI63vk,11541
15
+ kaggle-1.8.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,4 +0,0 @@
1
- class ApiBlobType(object):
2
- DATASET = "dataset"
3
- MODEL = "model"
4
- INBOX = "inbox"
@@ -1,228 +0,0 @@
1
- #!/usr/bin/python
2
- #
3
- # Copyright 2024 Kaggle Inc
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- # coding: utf-8
18
-
19
- import pprint
20
- import re # noqa: F401
21
-
22
- import six
23
-
24
-
25
- class DatasetColumn(object):
26
- """
27
- Attributes:
28
- column_types (dict): The key is attribute name
29
- and the value is attribute type.
30
- attribute_map (dict): The key is attribute name
31
- and the value is json key in definition.
32
- """
33
-
34
- column_types = {"order": "float", "name": "str", "type": "str", "original_type": "str", "description": "str"}
35
-
36
- attribute_map = {
37
- "order": "order",
38
- "name": "name",
39
- "type": "type",
40
- "original_type": "originalType",
41
- "description": "description",
42
- }
43
-
44
- def __init__(self, order=None, name=None, type=None, original_type=None, description=None): # noqa: E501
45
- """DatasetColumn - a model defined in Swagger""" # noqa: E501
46
-
47
- self._order = None
48
- self._name = None
49
- self._type = None
50
- self._original_type = None
51
- self._description = None
52
- self.discriminator = None
53
-
54
- if order is not None:
55
- self.order = order
56
- if name is not None:
57
- self.name = name
58
- if type is not None:
59
- self.type = type
60
- if original_type is not None:
61
- self.original_type = original_type
62
- if description is not None:
63
- self.description = description
64
-
65
- @property
66
- def order(self):
67
- """Gets the order of this DatasetColumn. # noqa: E501.
68
-
69
- The order that the column comes in, 0-based. (The first column is 0,
70
- second is 1, etc.) # noqa: E501
71
-
72
- :return: The order of this DatasetColumn. # noqa: E501
73
- :rtype: float
74
- """
75
- return self._order
76
-
77
- @order.setter
78
- def order(self, order):
79
- """Sets the order of this DatasetColumn.
80
-
81
- The order that the column comes in, 0-based. (The first column is 0,
82
- second is 1, etc.) # noqa: E501
83
-
84
- :param order: The order of this DatasetColumn. # noqa: E501
85
- :type: float
86
- """
87
-
88
- self._order = order
89
-
90
- @property
91
- def name(self):
92
- """Gets the name of this DatasetColumn. # noqa: E501.
93
-
94
- The column name # noqa: E501
95
-
96
- :return: The name of this DatasetColumn. # noqa: E501
97
- :rtype: str
98
- """
99
- return self._name
100
-
101
- @name.setter
102
- def name(self, name):
103
- """Sets the name of this DatasetColumn.
104
-
105
- The column name # noqa: E501
106
-
107
- :param name: The name of this DatasetColumn. # noqa: E501
108
- :type: str
109
- """
110
-
111
- self._name = name
112
-
113
- @property
114
- def type(self):
115
- """Gets the type of this DatasetColumn. # noqa: E501.
116
-
117
- The type of all of the fields in the column. Please see the data
118
- types on
119
- https://github.com/Kaggle/kaggle-api/wiki/Dataset-Metadata
120
- # noqa: E501
121
-
122
- :return: The type of this DatasetColumn. # noqa: E501
123
- :rtype: str
124
- """
125
- return self._type
126
-
127
- @type.setter
128
- def type(self, type):
129
- """Sets the type of this DatasetColumn.
130
-
131
- The type of all of the fields in the column. Please see the data
132
- types on
133
- https://github.com/Kaggle/kaggle-api/wiki/Dataset-Metadata
134
- # noqa: E501
135
-
136
- :param type: The type of this DatasetColumn. # noqa: E501
137
- :type: str
138
- """
139
-
140
- self._type = type
141
-
142
- @property
143
- def original_type(self):
144
- """Gets the original_type of this DatasetColumn. # noqa: E501.
145
-
146
- Used to store the original type of the column, which will be converted to Kaggle's types. For example, an `originalType` of `\"integer\"` would convert to a `type` of `\"numeric\"` # noqa: E501
147
-
148
- :return: The original_type of this DatasetColumn. # noqa: E501
149
- :rtype: str
150
- """
151
- return self._original_type
152
-
153
- @original_type.setter
154
- def original_type(self, original_type):
155
- """Sets the original_type of this DatasetColumn.
156
-
157
- Used to store the original type of the column, which will be converted to Kaggle's types. For example, an `originalType` of `\"integer\"` would convert to a `type` of `\"numeric\"` # noqa: E501
158
-
159
- :param original_type: The original_type of this DatasetColumn. # noqa: E501
160
- :type: str
161
- """
162
-
163
- self._original_type = original_type
164
-
165
- @property
166
- def description(self):
167
- """Gets the description of this DatasetColumn. # noqa: E501.
168
-
169
- The description of the column # noqa: E501
170
-
171
- :return: The description of this DatasetColumn. # noqa: E501
172
- :rtype: str
173
- """
174
- return self._description
175
-
176
- @description.setter
177
- def description(self, description):
178
- """Sets the description of this DatasetColumn.
179
-
180
- The description of the column # noqa: E501
181
-
182
- :param description: The description of this DatasetColumn. # noqa:
183
- E501
184
- :type: str
185
- """
186
-
187
- self._description = description
188
-
189
- def to_dict(self):
190
- """Returns the model properties as a dict."""
191
- result = {}
192
-
193
- for attr, _ in six.iteritems(self.column_types):
194
- value = getattr(self, attr)
195
- if isinstance(value, list):
196
- result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
197
- elif hasattr(value, "to_dict"):
198
- result[attr] = value.to_dict()
199
- elif isinstance(value, dict):
200
- result[attr] = dict(
201
- map(
202
- lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
203
- value.items(),
204
- )
205
- )
206
- else:
207
- result[attr] = value
208
-
209
- return result
210
-
211
- def to_str(self):
212
- """Returns the string representation of the model."""
213
- return pprint.pformat(self.to_dict())
214
-
215
- def __repr__(self):
216
- """For `print` and `pprint`"""
217
- return self.to_str()
218
-
219
- def __eq__(self, other):
220
- """Returns true if both objects are equal."""
221
- if not isinstance(other, DatasetColumn):
222
- return False
223
-
224
- return self.__dict__ == other.__dict__
225
-
226
- def __ne__(self, other):
227
- """Returns true if both objects are not equal."""
228
- return not self == other