Comments (3)
see #6
from pyyaml-include.
see #6
Oh... %(
from pyyaml-include.
To include anchors, a literal including and parsing are needed. But the constructor
would parse the including parts first.
For such a thing, a template engine like Jinja2 may be useful.
We shall render all YAML data into a whole one, then parse it.
eg:
-
bar1.yml:
bar1: *boo k1: "1.1" k2: "1.2"
-
bar2.yml
bar2: *boo k1: "2.1" k2: "2.2"
from textwrap import dedent
import jinja2
import yaml
env = jinja2.Environment(loader=jinja2.FileSystemLoader("search path"))
tpl = env.from_string(dedent('''
boo: &boo
k1: "0.1"
k2: "0.2"
bars:
{% include bar1.yml %}
{% include bar2.yml %}
''').strip())
s = tpl.render()
yaml.load(s)
However, above code can NOT work properly, because of indention problem.
from pyyaml-include.
Related Issues (20)
- Multiple YAML documents in a single file HOT 3
- Load multiple documents HOT 2
- Jinja2 support HOT 3
- readers_map not getting picked up: RuntimeError: Un-supported file name HOT 5
- Python 3.6 unsupported after releasing `1.2.post1` HOT 2
- Publish sdist to PyPI HOT 2
- two files in one dict? HOT 8
- include specific components from other yamls? HOT 2
- Does not support top level include with other keys HOT 2
- Relative include: relativeto the current file? HOT 8
- Could you update the PyPI to new version to add PyYAML 6.0 support? HOT 2
- How to concatenate two yaml files? HOT 1
- Ability for default value HOT 1
- Wildcard with Hash/Dict/Map HOT 1
- Idea: include from remote storages (notably git) HOT 3
- Yaml anchor support for include yaml files HOT 1
- Use tag with anchors across a single yaml config file HOT 2
- It seems that I can't rewrite the inherited argments from base `yaml` file. HOT 5
- Recursive includes do not work with nested directories HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyyaml-include.