get_dataset_spec
Generate a DatasetSpecConfig string for Python config files, ensuring correct RID and version formatting. Pin explicit versions for reproducibility.
Instructions
Generate a DatasetSpecConfig string for use in Python configuration files.
Returns the exact Python code to use in hydra-zen config files. This ensures the RID and version are correctly formatted and match what's in the catalog.
IMPORTANT: Always prefer specifying explicit versions in configurations. Using current_version as a default can lead to unexpected changes in results if the dataset is modified after the configuration is written. Pin to a specific version for reproducibility.
Args: dataset_rid: The RID of the dataset (e.g., "28CT"). version: Specific version to use. If not provided, uses the dataset's current version (with a warning about reproducibility).
Returns: JSON with the Python code string and metadata including: - spec: The DatasetSpecConfig(...) string ready to paste into code - rid: The dataset RID - version: The version used - description: Dataset description for reference - warning: Present if using current_version (recommends explicit version)
Example: get_dataset_spec("28CT") -> {"spec": "DatasetSpecConfig(rid="28CT", version="0.21.0")", ...}
get_dataset_spec("28CT", "0.20.0")
-> {"spec": "DatasetSpecConfig(rid=\"28CT\", version=\"0.20.0\")", ...}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| version | No | ||
| dataset_rid | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |