Skip to content

Commit 775b1f7

Browse files
committed
Update API to 1.5.4
1 parent d2fb8a5 commit 775b1f7

File tree

5 files changed

+46
-25
lines changed

5 files changed

+46
-25
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
====
33

4+
#### 1.5.4
5+
Release date: 5/28/19
6+
* Make kernels init more friendly
7+
* Make directories if needed for kernels output
8+
49
#### 1.5.3
510
Release date: 2/20/19
611
* Bump urllib3 version

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ required arguments:
590590
-v VALUE, --value VALUE
591591
Value of the configuration parameter, valid values depending on name
592592
- competition: Competition URL suffix (use "kaggle competitions list" to show options)
593-
                       - path: Folder where file(s) will be downloaded, defaults to current working directory
593+
- path: Folder where file(s) will be downloaded, defaults to current working directory
594594
- proxy: Proxy for HTTP requests
595595
```
596596

@@ -619,4 +619,4 @@ Kernel support is preliminary and may have some issues.
619619

620620
## License
621621

622-
The Kaggle API is released under the [Apache 2.0 license](LICENSE).
622+
The Kaggle API is released under the [Apache 2.0 license](LICENSE).

kaggle/api/kaggle_api_extended.py

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363

6464
class KaggleApi(KaggleApi):
65-
__version__ = '1.5.3'
65+
__version__ = '1.5.4'
6666

6767
CONFIG_NAME_PROXY = 'proxy'
6868
CONFIG_NAME_COMPETITION = 'competition'
@@ -92,29 +92,36 @@ class KaggleApi(KaggleApi):
9292
valid_list_languages = ['all', 'python', 'r', 'sqlite', 'julia']
9393
valid_list_kernel_types = ['all', 'script', 'notebook']
9494
valid_list_output_types = ['all', 'visualization', 'data']
95-
valid_list_sort_by = ['hotness', 'commentCount', 'dateCreated', 'dateRun',
96-
'relevance', 'scoreAscending', 'scoreDescending', 'viewCount', 'voteCount']
95+
valid_list_sort_by = [
96+
'hotness', 'commentCount', 'dateCreated', 'dateRun', 'relevance',
97+
'scoreAscending', 'scoreDescending', 'viewCount', 'voteCount'
98+
]
9799

98100
# Competitoins valid types
99101
valid_competition_groups = ['general', 'entered', 'inClass']
100102
valid_competition_categories = [
101-
'all', 'featured', 'research', 'recruitment', 'gettingStarted', 'masters', 'playground']
102-
valid_competition_sort_by = ['grouped', 'prize', 'earliestDeadline',
103-
'latestDeadline', 'numberOfTeams', 'recentlyCreated']
103+
'all', 'featured', 'research', 'recruitment', 'gettingStarted',
104+
'masters', 'playground'
105+
]
106+
valid_competition_sort_by = [
107+
'grouped', 'prize', 'earliestDeadline', 'latestDeadline',
108+
'numberOfTeams', 'recentlyCreated'
109+
]
104110

105111
# Datasets valid types
106112
valid_dataset_file_types = ['all', 'csv', 'sqlite', 'json', 'bigQuery']
107113
valid_dataset_license_names = ['all', 'cc', 'gpl', 'odb', 'other']
108114
valid_dataset_sizes = ['all', 'small', 'medium', 'large']
109-
valid_dataset_sort_bys = ['hottest', 'votes',
110-
'updated', 'active', 'published']
115+
valid_dataset_sort_bys = [
116+
'hottest', 'votes', 'updated', 'active', 'published'
117+
]
111118

112119
# Hack for https://github.com/Kaggle/kaggle-api/issues/22 / b/78194015
113120
if six.PY2:
114121
reload(sys)
115122
sys.setdefaultencoding('latin1')
116123

117-
## Authentication
124+
## Authentication
118125

119126
def authenticate(self):
120127
"""authenticate the user with the Kaggle API. This method will generate
@@ -164,7 +171,7 @@ def read_config_environment(self, config_data=None, quiet=False):
164171

165172
return config_data
166173

167-
## Configuration
174+
## Configuration
168175

169176
def _load_config(self, config_data):
170177
"""the final step of the authenticate steps, where we load the values
@@ -386,8 +393,7 @@ def print_config_values(self, prefix='- '):
386393
self.print_config_value(self.CONFIG_NAME_PROXY, prefix=prefix)
387394
self.print_config_value(self.CONFIG_NAME_COMPETITION, prefix=prefix)
388395

389-
390-
## Competitions
396+
## Competitions
391397

392398
def competitions_list(self,
393399
group=None,
@@ -1561,7 +1567,7 @@ def kernels_list(self,
15611567
raise ValueError(
15621568
'Invalid output type specified. Valid options are ' +
15631569
str(self.valid_list_output_types))
1564-
1570+
15651571
if sort_by and sort_by not in self.valid_list_sort_by:
15661572
raise ValueError(
15671573
'Invalid sort by type specified. Valid options are ' +
@@ -1651,14 +1657,24 @@ def kernels_initialize(self, folder):
16511657

16521658
username = self.get_config_value(self.CONFIG_NAME_USER)
16531659
meta_data = {
1654-
'id': username + '/INSERT_KERNEL_SLUG_HERE',
1655-
'title': 'INSERT_TITLE_HERE',
1656-
'code_file': 'INSERT_CODE_FILE_PATH_HERE',
1657-
'language': 'Pick one of: {' + ','.join(x for x in self.valid_push_language_types) + '}',
1658-
'kernel_type': 'Pick one of: {' + ','.join(x for x in self.valid_push_kernel_types) + '}',
1659-
'is_private': 'true',
1660-
'enable_gpu': 'false',
1661-
'enable_internet': 'false',
1660+
'id':
1661+
username + '/INSERT_KERNEL_SLUG_HERE',
1662+
'title':
1663+
'INSERT_TITLE_HERE',
1664+
'code_file':
1665+
'INSERT_CODE_FILE_PATH_HERE',
1666+
'language':
1667+
'Pick one of: {' + ','.join(
1668+
x for x in self.valid_push_language_types) + '}',
1669+
'kernel_type':
1670+
'Pick one of: {' + ','.join(
1671+
x for x in self.valid_push_kernel_types) + '}',
1672+
'is_private':
1673+
'true',
1674+
'enable_gpu':
1675+
'false',
1676+
'enable_internet':
1677+
'false',
16621678
'dataset_sources': [],
16631679
'competition_sources': [],
16641680
'kernel_sources': [],

kaggle/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ class Help(object):
10521052
param_kernel_dataset = ('Find kernels for a given dataset slug. Format is '
10531053
'{username/dataset-slug}')
10541054
param_kernel_user = 'Find kernels created by a given username'
1055-
# TODO: Pull these from the same spot as the api impl
1055+
# TODO(b/129357583): Pull these from the same spot as the api impl
10561056
param_kernel_language = (
10571057
'Specify the language the kernel is written in. Default is \'all\'. '
10581058
'Valid options are \'all\', \'python\', \'r\', \'sqlite\', and '

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
setup(
2121
name='kaggle',
22-
version='1.5.3',
22+
version='1.5.4',
2323
description='Kaggle API',
2424
long_description=
2525
('Official API for https://www.kaggle.com, accessible using a command line '

0 commit comments

Comments
 (0)