3.6. Inheritance#

While templating greatly reduces data redundancy, facilitates maintenance, and ensures consistency within a project, inheritance does the same across multiple projects, allowing you to easily share and reuse configurations and metadata between projects and manage them from a single source. For example, if you have a GitHub organization with multiple repositories, you can create a repository containing all the shared configurations and metadata, and have all other repositories inherit them dynamically. During synchronization events, PyPackIT automatically downloads the data from the specified URLs and merges them with your control center configurations.

Caching

To speed up the processing of your repository’s control center, the retrieved data can be cached on both local devices and on GitHub servers, so that they don’t need to be fetched every time. See Caching for more information.

3.6.1. Syntax#

Inheritance works similarly to templating, but instead of referencing a path within your project’s control center configurations, you can reference a URL to any JSON, YAML, or TOML data file, along with an optional template to extract specific data from it. Inherited values are defined using a custom YAML tag named ext, with the syntax !ext <URL> [<TEMPLATE>], where:

  • !ext defines the tag.

  • <URL> is the URL to the data file. It must end with .json, .yaml, .yml, or .toml (case-insensitive).

  • [<TEMPLATE>] is an optional template to generate or extract data from the data file. If omitted, the top-level data structure (i.e., the entire file) is used.