Adding to the package metadata

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.py that was created by the CLI command init-metadata.

Open up the src/diabetes_study/metadata/package.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.

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!

Creating a more complex datapackage.json file

Since 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:

src/diabetes_study/metadata/package.py
import seedcase_sprout as sp

package_properties = sp.SproutProperties(
    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. As you read in the previous section, you can save the changes to the PackageProperties to datapackage.json with write_properties(), for example:

sp.write_properties(properties=package_properties, path="../../datapackage.json")

When you rebuild the datapackage.json file, you’ll see that it contains all the metadata from the package.py. 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 package.py and then run the build.py script to regenerate datapackage.json.

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.