Skip to content

Commit

Permalink
Address review comments; add work-around for autogen.sh failure
Browse files Browse the repository at this point in the history
  • Loading branch information
stevemessick committed May 1, 2024
1 parent 9aed8a1 commit 5e4664f
Show file tree
Hide file tree
Showing 11 changed files with 1,204 additions and 962 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,28 @@ pip install kaggle

## Development

### Kaggle Internal

Obviously, this depends on Kaggle services. When you're extending the API and modifying
or adding to those services, you should be working in your Kaggle mid-tier development
environment. You'll run Kaggle locally, in the container, and test the Python code by
running it in the container so it can connect to your local testing environment.

Also, run the following command to get `autogen.sh` installed: ```bash
rm -rf /tmp/autogen && mkdir -p /tmp/autogen && unzip -qo /tmp/autogen.zip -d /tmp/autogen &&
mv /tmp/autogen/autogen-*/* /tmp/autogen && rm -rf /tmp/autogen/autogen-* &&
sudo chmod a+rx /tmp/autogen/autogen.sh
```
### Prerequisites
We use [hatch](https://hatch.pypa.io) to manage this project.
Follow these [instructions](https://hatch.pypa.io/latest/install/) to install it.
If you are working in a managed environment, you may want to use `pipx`. If it isn't already installed
try `sudo apt install pipx`. Then you should be able to proceed with `pipx install hatch`.

If you are working in a managed environment, you may want to use `pipx`. If it isn't already installed
try `sudo apt install pipx`. Then you should be able to proceed with `pipx install hatch`.
### Dependencies
```sh
Expand Down
166 changes: 84 additions & 82 deletions docs/KaggleApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ Method | HTTP request | Description
[**kernels_list_files**](KaggleApi.md#kernels_list_files) | **GET** /kernels/files | List kernel files
[**metadata_get**](KaggleApi.md#metadata_get) | **GET** /datasets/metadata/{ownerSlug}/{datasetSlug} | Get the metadata for a dataset
[**metadata_post**](KaggleApi.md#metadata_post) | **POST** /datasets/metadata/{ownerSlug}/{datasetSlug} | Update the metadata for a dataset
[**model_instance_files**](KaggleApi.md#model_instance_files) | **GET** /models/{ownerSlug}/{modelSlug}/{framework}/{instanceSlug}/files | List model instance files for the current version
[**model_instance_version_files**](KaggleApi.md#model_instance_version_files) | **GET** /models/{ownerSlug}/{modelSlug}/{framework}/{instanceSlug}/{versionNumber}/files | List model instance version files
[**model_instance_versions_download**](KaggleApi.md#model_instance_versions_download) | **GET** /models/{ownerSlug}/{modelSlug}/{framework}/{instanceSlug}/{versionNumber}/download | Download model instance version files
[**model_instance_versions_files**](KaggleApi.md#model_instance_versions_files) | **GET** /models/{ownerSlug}/{modelSlug}/{framework}/{instanceSlug}/{versionNumber}/files | List model instance version files
[**models_create_instance**](KaggleApi.md#models_create_instance) | **POST** /models/{ownerSlug}/{modelSlug}/create/instance | Create a new model instance
[**models_create_instance_version**](KaggleApi.md#models_create_instance_version) | **POST** /models/{ownerSlug}/{modelSlug}/{framework}/{instanceSlug}/create/version | Create a new model instance version
[**models_create_new**](KaggleApi.md#models_create_new) | **POST** /models/create/new | Create a new model
[**models_list**](KaggleApi.md#models_list) | **GET** /models/list | Lists models
[**models_list_files**](KaggleApi.md#models_list_files) | **GET** /models/list/{ownerSlug}/{modelSlug} | List model files
[**update_model**](KaggleApi.md#update_model) | **POST** /models/{ownerSlug}/{modelSlug}/update | Update a model
[**update_model_instance**](KaggleApi.md#update_model_instance) | **POST** /models/{ownerSlug}/{modelSlug}/{framework}/{instanceSlug}/update | Update a model
[**upload_file**](KaggleApi.md#upload_file) | **POST** /blobs/upload | Start uploading a file
Expand Down Expand Up @@ -1605,7 +1605,7 @@ configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = kaggle.KaggleApi(kaggle.ApiClient(configuration))
page = 1 # int | Page number (optional) (default to 1)
page_size = 20 # int | Page size (optional) (default to 20)
page_size = 20 # int | Number of items per page (default 20) (optional) (default to 20)
search = '' # str | Search terms (optional) (default to )
group = 'everyone' # str | Display only your kernels (optional) (default to everyone)
user = 'user_example' # str | Display kernels by a particular group (optional)
Expand All @@ -1630,7 +1630,7 @@ except ApiException as e:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**page** | **int**| Page number | [optional] [default to 1]
**page_size** | **int**| Page size | [optional] [default to 20]
**page_size** | **int**| Number of items per page (default 20) | [optional] [default to 20]
**search** | **str**| Search terms | [optional] [default to ]
**group** | **str**| Display only your kernels | [optional] [default to everyone]
**user** | **str**| Display kernels by a particular group | [optional]
Expand Down Expand Up @@ -1680,7 +1680,7 @@ api_instance = kaggle.KaggleApi(kaggle.ApiClient(configuration))
user_name = 'user_name_example' # str | Kernel owner
kernel_slug = 'kernel_slug_example' # str | Kernel name
kernel_version_number = 'kernel_version_number_example' # str | Kernel version number (optional)
page_size = 20 # int | Page size (optional) (default to 20)
page_size = 20 # int | Number of items per page (default 20) (optional) (default to 20)
page_token = 'page_token_example' # str | Page token for pagination (optional)

try:
Expand All @@ -1698,7 +1698,7 @@ Name | Type | Description | Notes
**user_name** | **str**| Kernel owner |
**kernel_slug** | **str**| Kernel name |
**kernel_version_number** | **str**| Kernel version number | [optional]
**page_size** | **int**| Page size | [optional] [default to 20]
**page_size** | **int**| Number of items per page (default 20) | [optional] [default to 20]
**page_token** | **str**| Page token for pagination | [optional]

### Return type
Expand Down Expand Up @@ -1824,10 +1824,10 @@ Name | Type | Description | Notes

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **model_instance_versions_download**
> Result model_instance_versions_download(owner_slug, model_slug, framework, instance_slug, version_number)
# **model_instance_files**
> Result model_instance_files(owner_slug, model_slug, framework, instance_slug, page_size=page_size, page_token=page_token)
Download model instance version files
List model instance files for the current version

### Example
```python
Expand All @@ -1848,14 +1848,15 @@ owner_slug = 'owner_slug_example' # str | Model owner
model_slug = 'model_slug_example' # str | Model name
framework = 'framework_example' # str | Model instance framework
instance_slug = 'instance_slug_example' # str | Model instance slug
version_number = 'version_number_example' # str | Model instance version number
page_size = 20 # int | Number of items per page (default 20) (optional) (default to 20)
page_token = 'page_token_example' # str | Page token for pagination (optional)

try:
# Download model instance version files
api_response = api_instance.model_instance_versions_download(owner_slug, model_slug, framework, instance_slug, version_number)
# List model instance files for the current version
api_response = api_instance.model_instance_files(owner_slug, model_slug, framework, instance_slug, page_size=page_size, page_token=page_token)
pprint(api_response)
except ApiException as e:
print("Exception when calling KaggleApi->model_instance_versions_download: %s\n" % e)
print("Exception when calling KaggleApi->model_instance_files: %s\n" % e)
```

### Parameters
Expand All @@ -1866,7 +1867,8 @@ Name | Type | Description | Notes
**model_slug** | **str**| Model name |
**framework** | **str**| Model instance framework |
**instance_slug** | **str**| Model instance slug |
**version_number** | **str**| Model instance version number |
**page_size** | **int**| Number of items per page (default 20) | [optional] [default to 20]
**page_token** | **str**| Page token for pagination | [optional]

### Return type

Expand All @@ -1879,12 +1881,12 @@ Name | Type | Description | Notes
### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: file
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **model_instance_versions_files**
> Result model_instance_versions_files(owner_slug, model_slug, framework, instance_slug, version_number, page_size=page_size, page_token=page_token)
# **model_instance_version_files**
> Result model_instance_version_files(owner_slug, model_slug, framework, instance_slug, version_number, page_size=page_size, page_token=page_token)
List model instance version files

Expand All @@ -1908,15 +1910,15 @@ model_slug = 'model_slug_example' # str | Model name
framework = 'framework_example' # str | Model instance framework
instance_slug = 'instance_slug_example' # str | Model instance slug
version_number = 'version_number_example' # str | Model instance version number
page_size = 20 # int | Page size (optional) (default to 20)
page_size = 20 # int | Number of items per page (default 20) (optional) (default to 20)
page_token = 'page_token_example' # str | Page token for pagination (optional)

try:
# List model instance version files
api_response = api_instance.model_instance_versions_files(owner_slug, model_slug, framework, instance_slug, version_number, page_size=page_size, page_token=page_token)
api_response = api_instance.model_instance_version_files(owner_slug, model_slug, framework, instance_slug, version_number, page_size=page_size, page_token=page_token)
pprint(api_response)
except ApiException as e:
print("Exception when calling KaggleApi->model_instance_versions_files: %s\n" % e)
print("Exception when calling KaggleApi->model_instance_version_files: %s\n" % e)
```

### Parameters
Expand All @@ -1928,7 +1930,7 @@ Name | Type | Description | Notes
**framework** | **str**| Model instance framework |
**instance_slug** | **str**| Model instance slug |
**version_number** | **str**| Model instance version number |
**page_size** | **int**| Page size | [optional] [default to 20]
**page_size** | **int**| Number of items per page (default 20) | [optional] [default to 20]
**page_token** | **str**| Page token for pagination | [optional]

### Return type
Expand All @@ -1946,6 +1948,65 @@ Name | Type | Description | Notes

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **model_instance_versions_download**
> Result model_instance_versions_download(owner_slug, model_slug, framework, instance_slug, version_number)
Download model instance version files

### Example
```python
from __future__ import print_function
import time
import kaggle
from kaggle.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basicAuth
configuration = kaggle.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = kaggle.KaggleApi(kaggle.ApiClient(configuration))
owner_slug = 'owner_slug_example' # str | Model owner
model_slug = 'model_slug_example' # str | Model name
framework = 'framework_example' # str | Model instance framework
instance_slug = 'instance_slug_example' # str | Model instance slug
version_number = 'version_number_example' # str | Model instance version number

try:
# Download model instance version files
api_response = api_instance.model_instance_versions_download(owner_slug, model_slug, framework, instance_slug, version_number)
pprint(api_response)
except ApiException as e:
print("Exception when calling KaggleApi->model_instance_versions_download: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**owner_slug** | **str**| Model owner |
**model_slug** | **str**| Model name |
**framework** | **str**| Model instance framework |
**instance_slug** | **str**| Model instance slug |
**version_number** | **str**| Model instance version number |

### Return type

[**Result**](Result.md)

### Authorization

[basicAuth](../README.md#basicAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: file

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **models_create_instance**
> Result models_create_instance(owner_slug, model_slug, model_new_instance_request)
Expand Down Expand Up @@ -2134,7 +2195,7 @@ api_instance = kaggle.KaggleApi(kaggle.ApiClient(configuration))
search = '' # str | Search terms (optional) (default to )
sort_by = 'hotness' # str | Sort the results (optional) (default to hotness)
owner = 'owner_example' # str | Display models by a specific user or organization (optional)
page_size = 20 # int | Page size (optional) (default to 20)
page_size = 20 # int | Number of items per page (default 20) (optional) (default to 20)
page_token = 'page_token_example' # str | Page token for pagination (optional)

try:
Expand All @@ -2152,66 +2213,7 @@ Name | Type | Description | Notes
**search** | **str**| Search terms | [optional] [default to ]
**sort_by** | **str**| Sort the results | [optional] [default to hotness]
**owner** | **str**| Display models by a specific user or organization | [optional]
**page_size** | **int**| Page size | [optional] [default to 20]
**page_token** | **str**| Page token for pagination | [optional]

### Return type

[**Result**](Result.md)

### Authorization

[basicAuth](../README.md#basicAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **models_list_files**
> Result models_list_files(owner_slug, model_slug, model_version_number=model_version_number, page_size=page_size, page_token=page_token)
List model files

### Example
```python
from __future__ import print_function
import time
import kaggle
from kaggle.rest import ApiException
from pprint import pprint

# Configure HTTP basic authorization: basicAuth
configuration = kaggle.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = kaggle.KaggleApi(kaggle.ApiClient(configuration))
owner_slug = 'owner_slug_example' # str | Model owner
model_slug = 'model_slug_example' # str | Model name
model_version_number = 'model_version_number_example' # str | Model version number (optional)
page_size = 20 # int | Page size (optional) (default to 20)
page_token = 'page_token_example' # str | Page token for pagination (optional)

try:
# List model files
api_response = api_instance.models_list_files(owner_slug, model_slug, model_version_number=model_version_number, page_size=page_size, page_token=page_token)
pprint(api_response)
except ApiException as e:
print("Exception when calling KaggleApi->models_list_files: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**owner_slug** | **str**| Model owner |
**model_slug** | **str**| Model name |
**model_version_number** | **str**| Model version number | [optional]
**page_size** | **int**| Page size | [optional] [default to 20]
**page_size** | **int**| Number of items per page (default 20) | [optional] [default to 20]
**page_token** | **str**| Page token for pagination | [optional]

### Return type
Expand Down
Loading

0 comments on commit 5e4664f

Please sign in to comment.