Stream: python

Topic: setting a license with EasyDataverse


view this post on Zulip Philip Durbin ๐Ÿš€ (Jan 14 2025 at 17:30):

Hmm, it seems like it isn't possible to set a license with EasyDataverse: https://github.com/gdcc/easyDataverse/issues/29

For me, datasets are being created with "Custom Dataset Terms" and a blank "Terms of Use". This is suboptimal because its an invalid state. Terms of Use are required when Custom Dataset Terms is selected.

view this post on Zulip Philip Durbin ๐Ÿš€ (Jan 14 2025 at 17:30):

Screenshot 2025-01-14 at 12.29.52โ€ฏPM.png

view this post on Zulip Philip Durbin ๐Ÿš€ (Jan 14 2025 at 17:31):

What's the easiest workaround I wonder? Hit the dataset with requests to flip the license to CC0? That's the license I'd like to use. :thinking:

view this post on Zulip Philip Durbin ๐Ÿš€ (Jan 14 2025 at 19:58):

Bah. I couldn't figure out how to set a license easily with requests. So I flipped the whole thing around. I'm creating a dataset with requests and then using EasyDataverse to pull down that dataset and set the metadata fields I need.

view this post on Zulip Philip Durbin ๐Ÿš€ (Jan 14 2025 at 20:00):

# Strangely, datasets created with EasyDataverse have
# Custom Terms rather than CC0, which is the default,
# and it's not possible to change the license afterward
# using EasyDataverse: https://github.com/gdcc/easyDataverse/issues/29
# So, we create a basic dataset using requests and
# then update the fields later with EasyDataverse.
with open('initial-dataset.json') as f:
    r = requests.post(server_url + "/api/dataverses/" + collection + "/datasets", data=f, headers={"X-Dataverse-key": api_token})
    # We'll use this pid later to update the dataset
    pid = r.json()['data']['persistentId']
dataset = dataverse.load_dataset(pid)
dataset.citation.title = title
dataset.update()

view this post on Zulip Jan Range (Jan 15 2025 at 12:43):

I am happy to implement this to the Dataset class. This has been on my list for far too long now :-D About to schedule a new release this week and it would be a good opportunity to sneak it in.

view this post on Zulip Jan Range (Jan 15 2025 at 12:46):

In terms of how to tackle this some questions:

In general I would opt for an Enum approach to handle licenses. We either create them dynamically, similar to the metadata blocks, or we bake them into EasyDataverse.

view this post on Zulip Philip Durbin ๐Ÿš€ (Jan 15 2025 at 12:49):

Yes, you can them from https://demo.dataverse.org/api/licenses

view this post on Zulip Philip Durbin ๐Ÿš€ (Jan 15 2025 at 12:50):

And yes, you can add new licenses and change what the default license is: https://guides.dataverse.org/en/6.5/installation/config.html#configuring-licenses

view this post on Zulip Jan Range (Jan 15 2025 at 12:52):

Great, thanks! Thats a good start :-)


Last updated: Nov 01 2025 at 14:11 UTC