pyyaml-include
An extending constructor of PyYAML: include other YAML files into current YAML document
What it is and what it does
pyyaml-include is an extension to PyYAML that lets you split YAML configuration across multiple files and include them into a single document at parse time. Instead of managing one monolithic YAML file, you register a custom constructor that tells PyYAML to load and merge external files wherever you place the include tag. It works with local files, shell-style wildcards (*, ?, **), and remote sources like HTTP, S3, and SFTP via fsspec.
The package is useful for large configuration systems where you want to organize settings by component or environment. You can include files in mappings (as key-value pairs) or sequences (as list items), and the included YAML is parsed and merged into the document tree. Version 2.0 introduced fsspec support, making it possible to include files from cloud storage or web servers without manual downloads.
Use it for:
- Organize application configuration across multiple YAML files by feature or environment, then include them all in a main config file.
- Load configuration fragments from a remote HTTP server or S3 bucket at runtime without manual downloads.
- Use wildcards to automatically include all YAML files matching a pattern from a directory.
- Build layered configuration systems where base settings are in one file and environment-specific overrides are included conditionally.
- Modularize Kubernetes manifests or Docker Compose definitions by splitting them into separate files and including them in a root manifest.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Extends PyYAML to include other YAML files into a current YAML document, with support for local files, wildcards, and remote sources via fsspec (HTTP, S3, SFTP, etc.).
Yes, with conditions. Install if you need to split YAML configuration across files and want a lightweight, actively maintained solution. The low install friction and broad Python support make it straightforward to adopt. However, the GPLv3+ copyleft license restricts use in proprietary closed-source projects—verify license compatibility before committing. No known security vulnerabilities.
Install
pyyaml-include on PyPI
pip
pip install pyyaml-includeuv
uv add pyyaml-includepoetry
poetry add pyyaml-includeInstalling pyyaml-include
Before you install
Low friction: pure Python wheel with three straightforward dependencies (PyYAML, fsspec, typing-extensions). Active maintenance with recent commits; repository shows ongoing development. Supports Python 3.8 through 3.13.
License in practice
GPLv3+ copyleft license: you must license any derivative work under GPLv3 or later if you distribute it. Acceptable for internal use and open-source projects compatible with GPL, but restrictive for proprietary software.
Quickstart
pip install pyyaml-include
# In your Python code, register a constructor and load YAML
with open('config.yml') as f:
data = yaml.full_load(f)
Requires PyYAML; for remote file access (HTTP, S3, SFTP), additional fsspec extras must be installed (e.g., fsspec[http], fsspec[s3]).
Verify before relying
- Performance characteristics when including many large files or using wildcards on large directory trees.
- Memory consumption patterns with deeply nested or recursive includes.
- Compatibility with all fsspec backends beyond HTTP, S3, and SFTP.
Package facts
| License | GPLv3+ (copyleft) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — PyYAML, fsspec, typing-extensions |
| Maintenance | actively maintained — 643 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,327,704/month — #2,118 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyyaml_include-2.2-py3-none-any.whl
Keywords: yaml, PyYAML, include, yml
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
aspy.yamlProvides order-preserving YAML loading and…
permissive · top 15,000 on PyPI
HyperPyYAMLExtends YAML syntax with Python-friendly…
permissive · top 5,000 on PyPI
yamlcoreAdds YAML 1.2 Core Schema support to PyYAML,…
permissive · top 15,000 on PyPI
PyYAML-ftPyYAML-ft is a YAML parser and emitter for…
permissive · top 5,000 on PyPI
yamlloaderProvides specialized loaders and dumpers for…
permissive · top 15,000 on PyPI
types-PyYAMLProvides type stubs for PyYAML to enable static…
permissive · top 1,000 on PyPI
pyymlEmbeds Python expressions directly in YAML…
permissive · top 15,000 on PyPI
HiYaPyCoLoads and merges multiple YAML configuration…
copyleft · top 15,000 on PyPI
pyyaml-env-tagAdds a custom YAML tag that lets you reference…
permissive · top 5,000 on PyPI