cthoyt / zenodo-client

A tool for automated uploading and version management of scientific data to Zenodo
MIT License
24 stars 5 forks source link

Add support for create without publish #21

Open nuest opened 11 months ago

nuest commented 11 months ago

I would like to use the tool in a workflow where I want to use the prereserved DOI before publishing the record. Therefore I need to run create and upload, but not publish.

Working on a PR now, let me know if this would be a welcome feature.

cthoyt commented 11 months ago

sure! if you are able to model some tests based on the existing ones that would be great. Similarly, some high-level documentation about this workflow would go a long way

nuest commented 11 months ago

Sure - didn't finish yesterday, more complicated for me to get into the new codebase than anticipated hoped, but I hope to have something by the end of the week.

nuest commented 11 months ago

Quick update: I have a working development version locally now and started some tests.

@cthoyt Can you briefly confirm that none of the existing functions support the updating of a not yet published deposit? update(..) immediately creates a new version, which I don't need.

Do you have a preference how to solve this? Extend the update() function (if updating a record, then make a new version; if updating a draft, just upload files and overwrite all metadata), or add a new function update_draft() ?

cthoyt commented 11 months ago

You should read the ZenodoClient.create() function, which in three parts:

  1. creates a record
  2. uploads files to a record
  3. publishes a record

https://github.com/cthoyt/zenodo-client/blob/7347be278b888bfa1c88709690a4beac5ca72509/src/zenodo_client/api.py#L107-L138

It might be sufficient to add a flag to explicitly not publish a record in this function, which leaves it in "editable" mode. Alternatively, this function can be factored into smaller pieces

nuest commented 11 months ago

I did add that flag, see work in progress here: https://github.com/cthoyt/zenodo-client/pull/23

When I want to then upload files, the only option I see is ZenodoClient.update(), but that always starts with a new version, which I do not want.

I changed the code so that my use case should work (would like to finish that implementation first, but I think with the new parameters there should be a few more tests, to have more combinations of data/publish/new_version/files given or missing for the update() method. That is, if you think the current approach is viable.

elichad commented 3 months ago

I've just started a project using zenodo-client and I'd find this publish toggle feature useful - @nuest @cthoyt do you have plans to finish up PR #28 soon?

cthoyt commented 3 months ago

@elichad the status is that the PR is nicely tested, but unfortunately there is a merge conflict due to changes I had to make based on updates to the zenodo API. If we can get those conflicts addressed, then there is a quick road towards finishing the PR

cthoyt commented 2 months ago

@elichad @nuest I just merged #28 and made a new release to PyPI. Is this issue complete now?