Using the CLI

How to use check-datapackage on the command-line.

check-datapackage has one command, check, which checks a Data Package’s metadata against the Data Package standard. The general pattern for the CLI is:

Terminal
check-datapackage COMMAND [ARGS] [OPTIONS]

To get an overview of the available commands and flags, run the following command, which is equivalent to using the --help flag:

Terminal
check-datapackage
Usage: check-datapackage COMMAND

check-datapackage checks if metadata is compliant with the  
Data Packagestandard

╭─ Commands ───────────────────────────────────────────────╮
│ <check>               Check a Data Package's metadata    │
│                       against the Data Package standard. │
│ --help                Display this message and exit.     │
│ --install-completion  Install shell completion for this  │
│                       application.                       │
│ --version             Display application version.       │
╰──────────────────────────────────────────────────────────╯

Checking Data Package metadata

Use the check command to check a Data Package’s metadata:

Terminal
check-datapackage check

By default, check looks for a datapackage.json file in the current directory. If all checks pass, the following message would be outputted to the terminal:

All checks passed!

If a check fails, you’ll get a DataPackageError with more details about what went wrong:

╭─ DataPackageError ───────────────────────────────────────╮
 1 issue was found in your datapackage.json:              
                                                          
 At top level:                                            
 |                                                        
 | id: <MISSING>                                          
 |     ^^^^^^^^^                                          
 'id' is a required property                              
                                                          
╰──────────────────────────────────────────────────────────╯

Checking metadata in a custom location

Instead of looking for datapackage.json in the current directory, you can specify a different path using the source argument:

Terminal
check-datapackage check another/directory/datapackage.json

You can also point check-datapackage to a remote Data Package by providing the full URL to datapackage.json. Let’s use this to check if the example seed beetle datapackage passes all checks:

Terminal
check-datapackage check https://raw.githubusercontent.com/seedcase-project/example-seed-beetle/refs/heads/main/datapackage.json
All checks passed!

For Data Packages on GitHub, use either a gh: or github: prefix as a shortcut instead of the full URL:

Terminal
check-datapackage check gh:seedcase-project/example-seed-beetle
All checks passed!

You can also include a branch or tag:

Terminal
check-datapackage check gh:seedcase-project/example-seed-beetle@main
All checks passed!
Important

check raises an error when checks fail. This makes it suitable for CI and pre-commit workflows where failed checks should stop execution.

Enabling strict checks

By default, check checks properties marked as “MUST” in the Data Package standard. To additionally check “SHOULD” properties, use the --strict flag:

Terminal
check-datapackage check --strict

You can set strict = true in .cdp.toml as well; command-line options override file-based configuration. See the configuration guide for details.

For more details, see the check guide or run:

Terminal
check-datapackage check --help
Usage: check-datapackage check [OPTIONS] [ARGS]

Check a Data Package's metadata against the Data Package    
standard.                                                   

Outputs a human-readable explanation of any issues found.

╭─ Arguments ──────────────────────────────────────────────╮
│ <SOURCE>  The location of a datapackage.json, defaults   │
│           to a file or folder path. Can also be an       │
│           https: source to a remote datapackage.json or  │
│           a github: / gh: pointing to a repo with a      │
│           datapackage.json in the repo root (in the      │
│           format gh:org/repo, which can also include     │
│           reference to a tag or branch, such as          │
│           gh:org/repo@main or gh:org/repo@1.0.1).        │
│           [default: datapackage.json]                    │
╰──────────────────────────────────────────────────────────╯
╭─ Parameters ─────────────────────────────────────────────╮
│ --strict  If True, check "SHOULD" properties in addition │
│           to "MUST" properties from the Data Package     │
│           standard.                                      │
│           [default: False]                               │
╰──────────────────────────────────────────────────────────╯

Global options

In addition to --help, the top-level CLI provides:

Terminal
check-datapackage --install-completion

This installs shell completion for supported shells.

Terminal
check-datapackage --version

This prints the installed check-datapackage version.