Skip to content

Conversation

@JR-1991
Copy link
Member

@JR-1991 JR-1991 commented Jun 7, 2025

This PR introduces a new feature that allows users to specify the type of dataset when creating one. This functionality was first introduced in the Dataverse 6.4 release. Users can now set the dataset_type attribute on a Dataset instance. Upon assignment, the validity of the dataset type is checked by calling the api/datasets/datasetTypes endpoint.

Additionally, users can inspect the available dataset types by using the list_dataset_types method or the dataset_types method once connected to a Dataverse instance or class. While the list_dataset_types method is primarily intended for printing purposes, the dataset_types method provides a more detailed response from the api/datasets/datasetTypes endpoint, allowing for a more comprehensive access to the dataset type.

Since this is a relatively new feature, version checks are performed upon assignment, and unsupported versions will simply skip the dataset type logic. Tests have been added to verify the functionality of this new feature.

Example

from easyDataverse import Dataverse

dataverse = Dataverse(...)
dataset = dataverse.create_dataset()

# List dataset type
demo_dv.list_dataset_types()

# Set the dataset type
dataset.dataset_type = "software"

# Upload and re-fetch to access the type
pid = dataset.upload("some_dv")

nu_dataset = demo_dv.load_dataset(pid)
print(nu_dataset.dataset_type)

For an interactive version, checkout this Colab Notebook.

Closes

@JR-1991 JR-1991 added this to the v0.4.4 milestone Jun 7, 2025
@JR-1991 JR-1991 self-assigned this Jun 7, 2025
@JR-1991 JR-1991 added the enhancement New feature or request label Jun 7, 2025
@JR-1991 JR-1991 moved this to Ready for Review in PyDataverse Working Group Jun 7, 2025
@JR-1991 JR-1991 merged commit 1eccb26 into main Jun 24, 2025
13 checks passed
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in PyDataverse Working Group Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

2 participants