main.py
import seedcase_sprout as sp
def main():
# Create the properties script in the default location.
sp.create_properties_script()
if __name__ == "__main__":
main()In the previous guide, we created a Data Package and saw how to write a minimal set of metadata properties to datapackage.json. Here, we’ll take a closer look at the full package_properties.py that’s created by create_properties_script().
Before we get started with this section, it’s necessary to delete any previously created scripts/package_properties.py since create_properties_script() does not overwrite this file if it already exists.
First, change your main.py to look like this:
Now run the script from terminal:
If you now view the created package_properties.py script, you’ll see that it includes a template containing many of the most commonly used metadata names together with comments indicating which are required and which are optional:
scripts/package_properties.py
import seedcase_sprout as sp
# from .resource_properties import resource_properties
package_properties = sp.PackageProperties(
## Required:
name="diabetes-study",
title="",
description="",
licenses=[
sp.LicenseProperties(
## Required:
name="",
## Optional:
# path="",
# title="",
),
],
## Optional:
# homepage="",
# contributors=[
# sp.ContributorProperties(
# ## Required:
# title="",
# ## Optional:
# path="",
# email="",
# given_name="",
# family_name="",
# organization="",
# roles=[""],
# ),
# ],
# keywords=[""],
# image="",
# sources=[
# sp.SourceProperties(
# ## Required:
# title="",
# ## Optional:
# path="",
# email="",
# version="",
# ),
# ],
# resources=[
# resource_properties,
# ],
## Autogenerated:
id="4048473e-bccf-4739-bc3b-efc04b7215dd",
version="0.1.0",
created="2026-01-13T15:53:49+00:00",
)As you can see, there are a lot of available metadata properties. However, as we saw in the previous section and as you can see from the comments in this template script, there aren’t that many required metadata. So you can quickly get started creating a Data Package and add more metadata later as needed.
Sometimes it might feel tedious to fill out metadata properties at all and you might be tempted to skip creating a Data Package for your data. But it’s important to remember just how vital these metadata actually are. Without them, your data are simply a collection of files without any context or meaning. The metadata (properties) are crucially important for understanding and actually using the data in your data package!
datapackage.json fileSince metadata is so important, Sprout encourages users to include it by making it easier to manage it through the use of Python classes as we saw in the previous section. In the example above, you can see a couple of additional classes ContributorProperties and SourceProperties. Let’s create a slightly more complex example using one of these other classes:
scripts/package_properties.py
import seedcase_sprout as sp
package_properties = sp.PackageProperties(
name="diabetes-study",
title="A Study on Diabetes",
# You can write Markdown below, with the helper `sp.dedent()`.
description=sp.dedent("""
# Data from a 2021 study on diabetes prevalence
This data package contains data from a study conducted in 2021 on the
*prevalence* of diabetes in various populations. The data includes:
- demographic information
- health metrics
- survey responses about lifestyle
"""),
contributors=[
sp.ContributorProperties(
title="Jamie Jones",
email="jamie_jones@example.com",
path="example.com/jamie_jones",
roles=["creator"],
),
sp.ContributorProperties(
title="Zdena Ziri",
email="zdena_ziri@example.com",
path="example.com/zdena_ziri",
roles=["creator"],
)
],
licenses=[
sp.LicenseProperties(
name="ODC-BY-1.0",
path="https://opendatacommons.org/licenses/by",
title="Open Data Commons Attribution License 1.0",
)
],
## Autogenerated:
id="8f301286-2327-45bf-bbc8-09696d059499",
version="0.1.0",
created="2025-11-07T11:12:56+01:00",
)You can see that we included a more involved description of the package using the helper function dedent() and that we used the ContributorProperties class twice as we set the contributors parameter to a list of two contributors who co-created this example Data Package.
Now you can edit your main.py file to again include the write_properties() function:
main.py
import seedcase_sprout as sp
from scripts.package_properties import package_properties
def main():
# Create the metadata properties script in default location.
sp.create_properties_script()
# Write metadata properties from properties script to `datapackage.json`.
sp.write_properties(properties=package_properties)
if __name__ == "__main__":
main()Then, use uv to run the script from the Terminal.
When you inspect the created datapackage.json file, you’ll see that it contains all the metadata from the scripts/package_properties.py:
datapackage.json
{
"name": "diabetes-study",
"id": "8f301286-2327-45bf-bbc8-09696d059499",
"title": "A Study on Diabetes",
"description": "# Data from a 2021 study on diabetes prevalence\n\nThis data package contains data from a study conducted in 2021 on the\n*prevalence* of diabetes in various populations. The data includes:\n\n- demographic information\n- health metrics\n- survey responses about lifestyle\n",
"version": "0.1.0",
"created": "2025-11-07T11:12:56+01:00",
"contributors": [
{
"title": "Jamie Jones",
"path": "example.com/jamie_jones",
"email": "jamie_jones@example.com",
"roles": [
"creator"
]
},
{
"title": "Zdena Ziri",
"path": "example.com/zdena_ziri",
"email": "zdena_ziri@example.com",
"roles": [
"creator"
]
}
],
"licenses": [
{
"name": "ODC-BY-1.0",
"path": "https://opendatacommons.org/licenses/by",
"title": "Open Data Commons Attribution License 1.0"
}
]
}If you made a mistake and want to update the properties in the current datapackage.json, remember that you never need to edit the JSON file directly. Instead, you edit the scripts/package_properties.py and then run the main.py script to regenerate datapackage.json.
Having a human-readable version of what is contained in the datapackage.json file is useful for others who may be working with or wanting to learn more about your data package. You can use as_readme_text() to convert the properties into text that can be added to a README file. Let’s create a README file with the properties of the data package you just created by writing it in the main.py file.
main.py
import seedcase_sprout as sp
from scripts.package_properties import package_properties
def main():
# Create the properties script in default location.
sp.create_properties_script()
# Save the properties to `datapackage.json`.
sp.write_properties(properties=package_properties)
# Create text for a README of the data package.
readme_text = sp.as_readme_text(package_properties)
# Write the README text to a `README.md` file.
sp.write_file(readme_text, sp.PackagePath().readme())
if __name__ == "__main__":
main()Sprout splits the README creation functionality into two steps: One to make the text and one to write to the file. That way, if you want to add or manipulate the text, you can do so before writing it to the file. This is useful if you want to add information to the README that you don’t want included in the datapackage.json file. For this guide we won’t cover how or why to do this.
Next, run this command in the Terminal to make the README file. The write_file() will always overwrite the existing README file.
Now you can see that the README.md file has been created in your data package:
📁 diabetes-study/
├─📁 scripts/
│ └─📄 package_properties.py
├─📄 .gitignore
├─📄 .python-version
├─📄 README.md
├─📄 datapackage.json
├─📄 main.py
└─📄 pyproject.toml
Now that you know how to create and manage metadata at the project-level, it is time to learn how to add data to the project and manage its metadata.