-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PAPPY-277: Remove outdated file functionality (new PR) #133
Conversation
…ace_dataset, update_project, and replace_project; remove unnecessary parameter from __build_dataset_obj and __build_project_obj
datadotworld/client/api.py
Outdated
@@ -143,14 +143,6 @@ def create_dataset(self, owner_id, **kwargs): | |||
lambda: _swagger.DatasetCreateRequest( | |||
title=kwargs.get('title'), | |||
visibility=kwargs.get('visibility')), | |||
lambda name, url, expand_archive, description, labels: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you cab still add files on dataset create ? But only via url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had removed it after seeing this comment; I can put it back and use the dummy lambdas in update_dataset
and replace_dataset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think dummy lambdas are a good idea in any case. You probably want method overloading. But what you ultimately want is the python SDK to exactly reflect the Public API spec.
@@ -190,15 +180,6 @@ def update_dataset(self, dataset_key, **kwargs): | |||
""" | |||
request = self.__build_dataset_obj( | |||
lambda: _swagger.DatasetPatchRequest(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the DatasetPatchRequest model need updating? Same question for the other dataset requests models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming all of the models need updating; if this one is in-scope, I'll update it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They probably do, but like you said, we're only concerned with the models in scope of this ticket, which should be limited to the "DatasetRequest" and "ProjectRequest" models.
datadotworld/client/api.py
Outdated
return dataset | ||
|
||
@staticmethod | ||
def __build_project_obj(project_constructor, file_constructor, args): | ||
def __build_project_obj(project_constructor, args): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we disable the files property on projects too? Or was it exclusively datasets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The files property was removed from update_project
, but URLs are still enabled for create_project
and replace_project
. Will update
…ect, and replace_project
@jonaf I looked into the Project Service Implementation code and found no functionality for files (uploads or URLs) in |
@ddw-mike it looks like the failure is actually just a PEP8 linter claiming that some of the methods aren't in use. Did you update the call sites? |
@@ -1583,15 +1544,33 @@ def __build_dataset_obj(dataset_constructor, file_constructor, args): | |||
return dataset | |||
|
|||
@staticmethod | |||
def __build_project_obj(project_constructor, file_constructor, args): | |||
def __build_dataset_obj_no_files(dataset_constructor, args): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can probably DRY this up since __build_dataset_obj_no_files
is a superset of __build_dataset_obj
now. I'm thinking something like
@staticmethod
def __build_dataset_obj(dataset_constructor, file_constructor, args):
dataset = __build_dataset_obj_no_files(dataset_constructor, args)
# ...the files = ([file_constructor(...)]) bits
dataset.files = files
@@ -871,17 +856,19 @@ | |||
"type": "string" | |||
}, | |||
"visibility": { | |||
"description": "Dataset visibility. `OPEN` if the dataset can be seen by any member of data.world. `PRIVATE` if the dataset can be seen by its owner and authorized collaborators. `DISCOVERABLE` if the dataset can be seen by any member of data.world, but only files marked `sample` or `preview` are visible", | |||
"description": "Dataset visibility. `OPEN` if the dataset can be seen by any member of data.world. `PRIVATE` if the dataset can be seen by its owner and authorized collaborators.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, why was DISCOVERABLE
removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DISCOVERABLE
does not appear in the public API swagger spec: https://github.com/datadotworld/platform/blob/27e8adcf742a3bf27401cb3f0ae654208905496a/dw-api/public-api/src/main/resources/META-INF/assets/swagger/swagger.json#L11015
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but why was it removed in this PR? That swagger spec is not directly published, and the published swagger spec may still include it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced
* Update python sdk (#120) * Update swagger generated API files * Update authentication method to token * Fix oauth and switch to new swagger file * update comment in configuration.py with link to issue * Implement search endpoint * Format files according to flake8 * disable failing test * remove support for python 2.7 (Deprecated) * update readme and contributing docs * increment version number in __init__.py file Co-authored-by: Danial Betres <danialbetres@Danials-MacBook-Pro.local> * Add table and connection endpoints (#121) * Update references to new main branch (#123) * Change doc html name to match GitHub expectation (#124) * Update DOCTYPE format to fix GitHub pages build (#125) * Fix to install the python sdk with pandas for python version > 3.7 (#128) * Fix to install the python sdk with pandas for python version >= 3.7 * Updated circle ci to use pyenv-tox:1.0.0 docker image * Update circle ci config to setup pyenv 3.7.12 3.8.12 3.9.10 3.10.2 * Updated classifiers * [PAP-174] python SDK uses an older version of click library (#129) * [PAP-34] Update python SDK to remove information about searching using resource_id (#130) * PAPPY-277: Remove outdated file functionality (new PR) (#133) * PAPPY-277: remove file upload functionality from update_dataset, replace_dataset, update_project, and replace_project; remove unnecessary parameter from __build_dataset_obj and __build_project_obj * PAPPY-277: Add back file functionality to create_dataset, create_project, and replace_project * PAPPY-277: Update create, patch, and put APIs for datasets and projects * PAPPY-277: Update dataset and project request models * PAPPY-277: Remove file functionality from replace_project * PAPPY-277: Replace dummy lambdas with method overloading * PAPPY-277: Support method overloading with multipledispatch * PAPPY-277: Rename duplicate methods * PAPPY-277: Remove if statements in builders (with files) * PAPPY-277: Remove duplicate code * PAPPY-277: Fix method calls * PAPPY-277: Fix line length * PAPPY-277: Fix static method calls * PAPPY-277: Re-add 'DISCOVERABLE' visibility for datasets Co-authored-by: Danial Betres <danial.betres@data.world> Co-authored-by: Danial Betres <danialbetres@Danials-MacBook-Pro.local> Co-authored-by: Danial Betres <dbetres@uwaterloo.ca> Co-authored-by: Marie Chatfield Rivas <marie.rivas@data.world> Co-authored-by: nikhilhegde-ddw <96458241+nikhilhegde-ddw@users.noreply.github.com>
remove file upload functionality from update_dataset, replace_dataset, update_project, and replace_project; remove unnecessary parameter from __build_dataset_obj and __build_project_obj
Issue: https://dataworld.atlassian.net/browse/PAPPY-277
Re-creating this PR from #132 because it was easier than re-reverting the swagger changes