The `datapackage-py` library is a Python implementation of the Data Package standard, focusing on utilities to create, read, and validate data packages as defined by frictionlessdata.io specifications. It provides a simple API for interacting with `datapackage.json` files and their associated resources. The current version is 1.15.4, and it follows a minor release cadence as needed for bug fixes and small enhancements.
pip install datapackageVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a `datapackage.json` and a resource file, then load, validate, and read data from a `datapackage.Package` object. It includes an example of accessing resources and iterating through their data.
Update your code to use properties like `package.resources`, `resource.descriptor`, and `resource.read()` instead of deprecated methods. Consult the v1.0.0 changelog for a full list of changes.
Ensure you are using the correct library for your needs. If you only need to work with Data Packages, `datapackage-py` is sufficient. If you need advanced data processing, validation beyond simple Data Package schemas, or integration with diverse data sources, consider `frictionless` (install with `pip install frictionless`). Note that `frictionless` has its own `Package` and `Resource` objects with different APIs.
Ensure your system's certificate authorities are up-to-date. For temporary workarounds, you might set `verify_ssl=False` (not recommended for production) or configure `REQUESTS_CA_BUNDLE` environment variable if using a custom CA.
Ensure your `datapackage.json` adheres to the Data Package specification, including a valid 'resources' array. Check for typos or structural errors in the JSON.
Verify that the path provided to `Package()` is correct and that the `datapackage.json` file exists in that location. For relative paths, ensure your script's current working directory is as expected.
Specify the correct encoding in the resource descriptor in `datapackage.json` (e.g., `'encoding': 'ISO-8859-1'`) or explicitly when loading data if available for the particular data source.