Skip to content
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

Merged
merged 14 commits into from
Oct 4, 2022
Merged

Conversation

ddw-mike
Copy link
Contributor

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

…ace_dataset, update_project, and replace_project; remove unnecessary parameter from __build_dataset_obj and __build_project_obj
@@ -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:
Copy link

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.

Copy link
Contributor Author

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

Copy link

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(),
Copy link

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.

Copy link
Contributor Author

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

Copy link

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.

return dataset

@staticmethod
def __build_project_obj(project_constructor, file_constructor, args):
def __build_project_obj(project_constructor, args):
Copy link

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.

Copy link
Contributor Author

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

@ddw-mike
Copy link
Contributor Author

@jonaf I looked into the Project Service Implementation code and found no functionality for files (uploads or URLs) in replaceProject. Therefore I've re-removed that functionality from the equivalent Python method, and I've submitted an intake ticket to amend that part of the documentation.
On the downside, the PR is still failing the CircleCI build, and as far as I can tell (without diving into the minutia of the python test process), the method overloading is causing the failure - we may have to use dummy lambdas until the SDK can receive a proper update.

@jonaf
Copy link

jonaf commented Sep 30, 2022

@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):
Copy link

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.",
Copy link

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced

@ddw-mike ddw-mike merged commit 8f93fbd into main Oct 4, 2022
@ddw-mike ddw-mike deleted the PAPPY-277_fix branch October 4, 2022 13:18
ddw-mike added a commit that referenced this pull request Oct 11, 2022
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants