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

changes to add new version to exisitng deposition #4

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

drifter089
Copy link
Owner

@drifter089 drifter089 commented Nov 12, 2024

  • set_project can now also be update parent DOI

    • it returns the latest draft or published version if given parent DOI
      parent and version ID's
    • function now gives automatically resolves to latest 113600 ID for 106299
  • new ZenodoMetaData dataclass

  • updated change_metadata function using new ZenodoMetadata class

  • ZenodoMetadata class can be extended to include these properties Zenodo docs metadata

  • update function adds publication_date to metadata if empty which is required to publish a new version

  • all internal functions are being tested

  • version update is being tested in test_vesion.py using CI

  • individual tests for create_project, set_project, change_metadata are still missing even tough they are being tested together in CI

@drifter089
Copy link
Owner Author

update and create_project functions look like this

update function looks like this

Screenshot from 2024-10-17 18-45-12

Copy link
Collaborator

@siddharth-krishna siddharth-krishna left a comment

Choose a reason for hiding this comment

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

Thanks Akshat, it looks good overall, but I left a few suggestions. Can we also change the PR title to cover all the changes: disable old tests, refactor XYZ, add new test etc?

requirements.txt Outdated Show resolved Hide resolved
@@ -351,7 +362,9 @@ def list_files(self):
# except UserWarning:
# warnings.warn("The object is not pointing to a project. Either create a project or explicity set the project'", UserWarning)

def create_project(self, title=None, upload_type=None, description=None):
def create_project(
self, title=None, upload_type=None, metadata_json=None, description=None
Copy link
Collaborator

Choose a reason for hiding this comment

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

upload_type is unused?

src/zenodopy/zenodopy.py Outdated Show resolved Hide resolved
zeno.bucket
zeno.deposition_id
zeno.sandbox
# def test_get_key():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be good to put a comment above each disabled test saying why it no longer works and when it can be brought back

Copy link
Owner Author

Choose a reason for hiding this comment

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

added a note at the start of the file

src/zenodopy/zenodopy.py Outdated Show resolved Hide resolved
Comment on lines +2 to +15
"""
This module contains tests for the zenodopy library using pytest.
Functions:
test_client: Tests the initialization of the zen.Client object with and without a token.
test_read_config: Tests the _read_config method of the zen.Client object to ensure it raises a TypeError.
test_get_baseurl: Tests the _endpoint attribute of the zen.Client object for both sandbox and production environments.
test_get_depositions: Tests the _get_depositions, _get_depositions_by_id, and _get_depositions_files methods of the zen.Client object.
test_get_bucket: Tests the _get_bucket_by_id method of the zen.Client object.
test_get_projects_and_files: Tests the list_projects and list_files properties of the zen.Client object.
Note:
The update and change_metadata functions have been updated to add new versions to existing depositions.
This functionality is being tested in test_version. We will bring back individual tests once these changes
have been merged upstream to keep the changes incremental.
"""
Copy link
Owner Author

Choose a reason for hiding this comment

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

@siddharth-krishna
does this comment convey the plan clearly ?
I can update it to be more clear

Copy link
Collaborator

Choose a reason for hiding this comment

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

It does, but I still feel each individual line is better placed as a docstring/comment for the appropriate test function. Also, that way someone who jumps to the middle of the file will see why something is disabled, or what a function is testing. But this isn't critical, can be done later too.

@drifter089 drifter089 changed the title Basic test chnages to add new version to exisitng deposition Nov 28, 2024
@drifter089 drifter089 changed the title chnages to add new version to exisitng deposition changes to add new version to exisitng deposition Nov 30, 2024
Copy link
Collaborator

@siddharth-krishna siddharth-krishna left a comment

Choose a reason for hiding this comment

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

Thanks Akshat, it looks good overall. A few suggestions:

  • When you make the upstream PR, include in the description things like: why we disabled some tests, why we deleted coverage.yaml, why we disabled tests for older python versions, why replaced tox with pytest, and of course why we had to change the way version updates work.

tests/test_version.py Outdated Show resolved Hide resolved
Comment on lines +2 to +15
"""
This module contains tests for the zenodopy library using pytest.
Functions:
test_client: Tests the initialization of the zen.Client object with and without a token.
test_read_config: Tests the _read_config method of the zen.Client object to ensure it raises a TypeError.
test_get_baseurl: Tests the _endpoint attribute of the zen.Client object for both sandbox and production environments.
test_get_depositions: Tests the _get_depositions, _get_depositions_by_id, and _get_depositions_files methods of the zen.Client object.
test_get_bucket: Tests the _get_bucket_by_id method of the zen.Client object.
test_get_projects_and_files: Tests the list_projects and list_files properties of the zen.Client object.
Note:
The update and change_metadata functions have been updated to add new versions to existing depositions.
This functionality is being tested in test_version. We will bring back individual tests once these changes
have been merged upstream to keep the changes incremental.
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

It does, but I still feel each individual line is better placed as a docstring/comment for the appropriate test function. Also, that way someone who jumps to the middle of the file will see why something is disabled, or what a function is testing. But this isn't critical, can be done later too.

@drifter089
Copy link
Owner Author

I will bring back individual tests in next PR and add coverage and other things it causes CI to fail so only testing with pytest,
learning about TOX more

remove title from create_project
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