Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pyyaml_env_tag for
openSUSE:Factory checked in at 2025-10-01 18:57:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pyyaml_env_tag (Old)
and /work/SRC/openSUSE:Factory/.python-pyyaml_env_tag.new.11973 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pyyaml_env_tag"
Wed Oct 1 18:57:15 2025 rev:4 rq:1308343 version:1.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pyyaml_env_tag/python-pyyaml_env_tag.changes
2023-07-10 16:40:56.042912385 +0200
+++
/work/SRC/openSUSE:Factory/.python-pyyaml_env_tag.new.11973/python-pyyaml_env_tag.changes
2025-10-01 18:58:59.215505300 +0200
@@ -1,0 +2,12 @@
+Wed Oct 1 00:53:05 UTC 2025 - Richard Rahl <[email protected]>
+
+- Update to version 1.1:
+ * Move tests to tests/ dir
+- Update to version 1.0:
+ * Update pyproject.toml to use setuptools build
+ * Cleanup readme
+ * Get version dymanically from source
+- make use of autosetup
+- remove pycache from files
+
+-------------------------------------------------------------------
Old:
----
pyyaml_env_tag-0.1.tar.gz
New:
----
pyyaml_env_tag-1.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pyyaml_env_tag.spec ++++++
--- /var/tmp/diff_new_pack.46pmw5/_old 2025-10-01 18:58:59.947535955 +0200
+++ /var/tmp/diff_new_pack.46pmw5/_new 2025-10-01 18:58:59.947535955 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-pyyaml_env_tag
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%{?sle15_python_module_pythons}
Name: python-pyyaml_env_tag
-Version: 0.1
+Version: 1.1
Release: 0
Summary: A custom YAML tag for referencing environment variables in
YAML files
License: MIT
@@ -27,6 +27,8 @@
BuildRequires: %{python_module PyYAML}
BuildRequires: %{python_module flit-core}
BuildRequires: %{python_module pip}
+BuildRequires: %{python_module pytest}
+BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-PyYAML
@@ -37,7 +39,7 @@
A custom YAML tag for referencing environment variables in YAML files.
%prep
-%setup -q -n pyyaml_env_tag-%{version}
+%autosetup -n pyyaml_env_tag-%{version}
%build
%pyproject_wheel
@@ -45,14 +47,14 @@
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%python_expand rm -rf %{buildroot}%{$python_sitelib}/__pycache__
%check
-%pyunittest -v
+%pytest
%files %{python_files}
%doc README.md
%license LICENSE
%{python_sitelib}/pyyaml_env_tag*
%{python_sitelib}/yaml_env_tag*
-%{python_sitelib}/__pycache__/yaml_env_tag*
++++++ pyyaml_env_tag-0.1.tar.gz -> pyyaml_env_tag-1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/.gitignore
new/pyyaml_env_tag-1.1/.gitignore
--- old/pyyaml_env_tag-0.1/.gitignore 2020-11-11 17:33:16.000000000 +0100
+++ new/pyyaml_env_tag-1.1/.gitignore 1970-01-01 01:00:00.000000000 +0100
@@ -1,138 +0,0 @@
-# Byte-compiled / optimized / DLL files
-__pycache__/
-*.py[cod]
-*$py.class
-
-# C extensions
-*.so
-
-# Distribution / packaging
-.Python
-build/
-develop-eggs/
-dist/
-downloads/
-eggs/
-.eggs/
-lib/
-lib64/
-parts/
-sdist/
-var/
-wheels/
-share/python-wheels/
-*.egg-info/
-.installed.cfg
-*.egg
-MANIFEST
-
-# PyInstaller
-# Usually these files are written by a python script from a template
-# before PyInstaller builds the exe, so as to inject date/other infos into it.
-*.manifest
-*.spec
-
-# Installer logs
-pip-log.txt
-pip-delete-this-directory.txt
-
-# Unit test / coverage reports
-htmlcov/
-.tox/
-.nox/
-.coverage
-.coverage.*
-.cache
-nosetests.xml
-coverage.xml
-*.cover
-*.py,cover
-.hypothesis/
-.pytest_cache/
-cover/
-
-# Translations
-*.mo
-*.pot
-
-# Django stuff:
-*.log
-local_settings.py
-db.sqlite3
-db.sqlite3-journal
-
-# Flask stuff:
-instance/
-.webassets-cache
-
-# Scrapy stuff:
-.scrapy
-
-# Sphinx documentation
-docs/_build/
-
-# PyBuilder
-.pybuilder/
-target/
-
-# Jupyter Notebook
-.ipynb_checkpoints
-
-# IPython
-profile_default/
-ipython_config.py
-
-# pyenv
-# For a library or package, you might want to ignore these files since the
code is
-# intended to run in multiple environments; otherwise, check them in:
-# .python-version
-
-# pipenv
-# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in
version control.
-# However, in case of collaboration, if having platform-specific
dependencies or dependencies
-# having no cross-platform support, pipenv may install dependencies that
don't work, or not
-# install all needed dependencies.
-#Pipfile.lock
-
-# PEP 582; used by e.g. github.com/David-OConnor/pyflow
-__pypackages__/
-
-# Celery stuff
-celerybeat-schedule
-celerybeat.pid
-
-# SageMath parsed files
-*.sage.py
-
-# Environments
-.env
-.venv
-env/
-venv/
-ENV/
-env.bak/
-venv.bak/
-
-# Spyder project settings
-.spyderproject
-.spyproject
-
-# Rope project settings
-.ropeproject
-
-# mkdocs documentation
-/site
-
-# mypy
-.mypy_cache/
-.dmypy.json
-dmypy.json
-
-# Pyre type checker
-.pyre/
-
-# pytype static type analyzer
-.pytype/
-
-# Cython debug symbols
-cython_debug/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/PKG-INFO
new/pyyaml_env_tag-1.1/PKG-INFO
--- old/pyyaml_env_tag-0.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
+++ new/pyyaml_env_tag-1.1/PKG-INFO 2025-05-13 17:23:21.664883100 +0200
@@ -1,7 +1,172 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.4
Name: pyyaml_env_tag
-Version: 0.1
-Summary: A custom YAML tag for referencing environment variables in YAML
files.
-Home-page: https://github.com/waylan/pyyaml-env-tag
-Author: Waylan Limberg
-Author-email: [email protected]
+Version: 1.1
+Summary: A custom YAML tag for referencing environment variables in YAML files.
+Author-email: Waylan Limberg <[email protected]>
+License-Expression: MIT
+Project-URL: Homepage, https://github.com/waylan/pyyaml-env-tag
+Project-URL: Repository, https://github.com/waylan/pyyaml-env-tag
+Project-URL: Bug Tracker, https://github.com/waylan/pyyaml-env-tag/issues
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: 3.13
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Text Processing :: Markup
+Requires-Python: >=3.9
+Description-Content-Type: text/markdown
+License-File: LICENSE
+Requires-Dist: pyyaml
+Dynamic: license-file
+
+# pyyaml_env_tag
+
+A custom YAML tag for referencing environment variables in YAML files.
+
+[![PyPI Version][pypi-image]][pypi-link]
+[![Build Status][GHAction-image]][GHAction-link]
+[![Coverage Status][codecov-image]][codecov-link]
+
+[pypi-image]: https://img.shields.io/pypi/v/pyyaml-env-tag.svg
+[pypi-link]: https://pypi.org/project/pyyaml-env-tag/
+[GHAction-image]:
https://github.com/waylan/pyyaml-env-tag/workflows/CI/badge.svg?branch=master&event=push
+[GHAction-link]:
https://github.com/waylan/pyyaml-env-tag/actions?query=event%3Apush+branch%3Amaster
+[codecov-image]:
https://codecov.io/github/waylan/pyyaml-env-tag/coverage.svg?branch=master
+[codecov-link]: https://codecov.io/github/waylan/pyyaml-env-tag?branch=master
+
+## Installation
+
+Install the `pyyaml_env_tag` package with pip:
+
+```bash
+pip install pyyaml_env_tag
+```
+
+### Enabling the tag
+
+To enable the tag, pass your loader of choice into the `add_env_tag` function,
which will
+return the loader with the construstor added to it.
+
+```python
+import yaml
+from yaml_env_tag import add_env_tag
+
+myLoader = add_env_tag(yaml.Loader)
+```
+
+Then you may use the loader as per usual. For example:
+
+```python
+yaml.load(data, Loader=myLoader)
+```
+
+The `add_env_tag` is a high level helper function. If you need lower level
access, you may
+add the constructor (`yaml_env_tag.construct_env_tag`) to the loader directly
using the
+`add_constructor` method of the loader. Note that this requires that the tag
(`!ENV`) be
+defined as well.
+
+```python
+from yaml_env_tag import construct_env_tag
+
+Loader.add_constructor('!ENV', construct_env_tag)
+```
+
+## Using the tag
+
+Include the tag `!ENV` followed by the name of an environment variable in a
YAML
+file and the value of the environment variable will be used in its place.
+
+```yaml
+key: !ENV SOME_VARIABLE
+```
+
+If `SOME_VARIABLE` is set to `A string!`, then the above YAML would result in
the
+following Python object:
+
+```python
+{'key': 'A string!'}
+```
+
+The content of the variable is parsed using YAML's implicit scalar types, such
as
+string, bool, integer, float, datestamp and null. More complex types are not
+recognized and simply passed through as a string. For example, if
`SOME_VARIABLE`
+was set to the string `true`, then the above YAML would result in the
following:
+
+```python
+{'key': True}
+```
+
+If the variable specified is not set, then a `null` value is assigned as a
default.
+You may define your own default as the last item in a sequence.
+
+```yaml
+key: !ENV [SOME_VARIABLE, default]
+```
+
+In the above example, if `SOME_VARIABLE` is not defined, the string `default`
would
+be used instead, as follows:
+
+```python
+{'key': 'default'}
+```
+
+You may list multiple variables as fallbacks. The first variable which is set
is
+used. In any sequance with more than one item, the last item must always be a
+default value and will not be resolved as an environment variable.
+
+```yaml
+key: !ENV [SOME_VARIABLE, FALLBACK, default]
+```
+
+As with variable contents, the default is resolved to a Python object of the
+implied type (string, bool, integer, float, datestamp and null).
+
+When `SOME_VARIABLE` is not set, all four of the following items will resolve
to
+the same value (`None`):
+
+```yaml
+- !ENV SOME_VARIABLE
+- !ENV [SOME_VARIABLE]
+- !ENV [SOME_VARIABLE, ~]
+- !ENV [SOME_VARIABLE, null]
+```
+
+## Related
+
+pyyaml_env_tag was inspired by the Ruby package [yaml-env-tag].
+
+An alternate method of referencing environment variables in YAML files is
+implemented by [pyyaml-tags] and [python_yaml_environment_variables].
+Each of those libraries use a template string and replace the template tag with
+the content of the variable. While this allows a single value to reference
+multiple variables and to contain additional content, it restricts all values
+to strings only and does not provide a way to define defaults.
+
+[yaml-env-tag]: https://github.com/jirutka/yaml-env-tag
+[pyyaml-tags]: https://github.com/meiblorn/pyyaml-tags
+[python_yaml_environment_variables]:
https://gist.github.com/mkaranasou/ba83e25c835a8f7629e34dd7ede01931
+
+## License
+
+pyyaml_env_tag is licensed under the [MIT License] as defined in `LICENSE`.
+
+[MIT License]: https://opensource.org/licenses/MIT
+
+## Changelog
+
+### [1.1] - 2025-05-13
+
+- Ensure tests get included with distribution (#9).
+
+### [1.0] - 2025-05-09
+
+- Add the `add_env_tag` helper function as a higher level way of modifying the
loader.
+
+### [0.1] - 2020-11-11
+
+The initial release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/README.md
new/pyyaml_env_tag-1.1/README.md
--- old/pyyaml_env_tag-0.1/README.md 2020-11-12 03:00:50.000000000 +0100
+++ new/pyyaml_env_tag-1.1/README.md 2025-05-13 17:23:16.000000000 +0200
@@ -2,30 +2,52 @@
A custom YAML tag for referencing environment variables in YAML files.
+[![PyPI Version][pypi-image]][pypi-link]
+[![Build Status][GHAction-image]][GHAction-link]
+[![Coverage Status][codecov-image]][codecov-link]
+
+[pypi-image]: https://img.shields.io/pypi/v/pyyaml-env-tag.svg
+[pypi-link]: https://pypi.org/project/pyyaml-env-tag/
+[GHAction-image]:
https://github.com/waylan/pyyaml-env-tag/workflows/CI/badge.svg?branch=master&event=push
+[GHAction-link]:
https://github.com/waylan/pyyaml-env-tag/actions?query=event%3Apush+branch%3Amaster
+[codecov-image]:
https://codecov.io/github/waylan/pyyaml-env-tag/coverage.svg?branch=master
+[codecov-link]: https://codecov.io/github/waylan/pyyaml-env-tag?branch=master
+
## Installation
-Install `PyYAML` and the `pyyaml_env_tag` package with pip:
+Install the `pyyaml_env_tag` package with pip:
```bash
-pip install pyyaml pyyaml_env_tag
+pip install pyyaml_env_tag
```
### Enabling the tag
-To enable the tag, import and add the `construct_env_tag` constructor to your
YAML
-loader of choice.
+To enable the tag, pass your loader of choice into the `add_env_tag` function,
which will
+return the loader with the construstor added to it.
```python
import yaml
-from yaml_env_tag import construct_env_tag
+from yaml_env_tag import add_env_tag
-yaml.Loader.add_constructor('!ENV', construct_env_tag)
+myLoader = add_env_tag(yaml.Loader)
```
Then you may use the loader as per usual. For example:
```python
-yaml.load(data, Loader=yaml.Loader)
+yaml.load(data, Loader=myLoader)
+```
+
+The `add_env_tag` is a high level helper function. If you need lower level
access, you may
+add the constructor (`yaml_env_tag.construct_env_tag`) to the loader directly
using the
+`add_constructor` method of the loader. Note that this requires that the tag
(`!ENV`) be
+defined as well.
+
+```python
+from yaml_env_tag import construct_env_tag
+
+Loader.add_constructor('!ENV', construct_env_tag)
```
## Using the tag
@@ -111,6 +133,14 @@
## Changelog
-### Version 0.1 (released 2020-11-11)
+### [1.1] - 2025-05-13
+
+- Ensure tests get included with distribution (#9).
+
+### [1.0] - 2025-05-09
+
+- Add the `add_env_tag` helper function as a higher level way of modifying the
loader.
+
+### [0.1] - 2020-11-11
The initial release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/pyproject.toml
new/pyyaml_env_tag-1.1/pyproject.toml
--- old/pyyaml_env_tag-0.1/pyproject.toml 2020-11-12 03:17:40.000000000
+0100
+++ new/pyyaml_env_tag-1.1/pyproject.toml 2025-05-13 17:23:16.000000000
+0200
@@ -1,26 +1,38 @@
[build-system]
-requires = ["flit_core >=2,<4"]
-build-backend = "flit_core.buildapi"
+requires = ['setuptools>=77.0']
+build-backend = 'setuptools.build_meta'
-[tool.flit.metadata]
-dist-name = "pyyaml_env_tag"
-module = "yaml_env_tag"
-author = "Waylan Limberg"
-author-email = "[email protected]"
-home-page = "https://github.com/waylan/pyyaml-env-tag"
-description-file = "README.md"
-requires-python = ">=3.6"
-requires = ["pyyaml"]
+[project]
+name = 'pyyaml_env_tag'
+dynamic = ['version']
+description = 'A custom YAML tag for referencing environment variables in YAML
files.'
+readme = {file = 'README.md', content-type='text/markdown'}
+authors = [{name = 'Waylan Limberg', email = '[email protected]'}]
+requires-python = '>=3.9'
+dependencies = ['pyyaml']
+license = 'MIT'
+license-files = ['LICENSE']
classifiers = [
- 'License :: OSI Approved :: MIT License',
- 'Development Status :: 4 - Beta',
+ 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.6',
- 'Programming Language :: Python :: 3.7',
- 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
+ 'Programming Language :: Python :: 3.11',
+ 'Programming Language :: Python :: 3.12',
+ 'Programming Language :: Python :: 3.13',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Processing :: Markup',
]
+
+[project.urls]
+Homepage = 'https://github.com/waylan/pyyaml-env-tag'
+Repository = 'https://github.com/waylan/pyyaml-env-tag'
+'Bug Tracker' = 'https://github.com/waylan/pyyaml-env-tag/issues'
+
+[tool.setuptools]
+py-modules = ['yaml_env_tag']
+
+[tool.setuptools.dynamic]
+version = {attr = 'yaml_env_tag.__version__'}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/PKG-INFO
new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/PKG-INFO
--- old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/PKG-INFO 1970-01-01
01:00:00.000000000 +0100
+++ new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/PKG-INFO 2025-05-13
17:23:21.000000000 +0200
@@ -0,0 +1,172 @@
+Metadata-Version: 2.4
+Name: pyyaml_env_tag
+Version: 1.1
+Summary: A custom YAML tag for referencing environment variables in YAML files.
+Author-email: Waylan Limberg <[email protected]>
+License-Expression: MIT
+Project-URL: Homepage, https://github.com/waylan/pyyaml-env-tag
+Project-URL: Repository, https://github.com/waylan/pyyaml-env-tag
+Project-URL: Bug Tracker, https://github.com/waylan/pyyaml-env-tag/issues
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: 3.13
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Text Processing :: Markup
+Requires-Python: >=3.9
+Description-Content-Type: text/markdown
+License-File: LICENSE
+Requires-Dist: pyyaml
+Dynamic: license-file
+
+# pyyaml_env_tag
+
+A custom YAML tag for referencing environment variables in YAML files.
+
+[![PyPI Version][pypi-image]][pypi-link]
+[![Build Status][GHAction-image]][GHAction-link]
+[![Coverage Status][codecov-image]][codecov-link]
+
+[pypi-image]: https://img.shields.io/pypi/v/pyyaml-env-tag.svg
+[pypi-link]: https://pypi.org/project/pyyaml-env-tag/
+[GHAction-image]:
https://github.com/waylan/pyyaml-env-tag/workflows/CI/badge.svg?branch=master&event=push
+[GHAction-link]:
https://github.com/waylan/pyyaml-env-tag/actions?query=event%3Apush+branch%3Amaster
+[codecov-image]:
https://codecov.io/github/waylan/pyyaml-env-tag/coverage.svg?branch=master
+[codecov-link]: https://codecov.io/github/waylan/pyyaml-env-tag?branch=master
+
+## Installation
+
+Install the `pyyaml_env_tag` package with pip:
+
+```bash
+pip install pyyaml_env_tag
+```
+
+### Enabling the tag
+
+To enable the tag, pass your loader of choice into the `add_env_tag` function,
which will
+return the loader with the construstor added to it.
+
+```python
+import yaml
+from yaml_env_tag import add_env_tag
+
+myLoader = add_env_tag(yaml.Loader)
+```
+
+Then you may use the loader as per usual. For example:
+
+```python
+yaml.load(data, Loader=myLoader)
+```
+
+The `add_env_tag` is a high level helper function. If you need lower level
access, you may
+add the constructor (`yaml_env_tag.construct_env_tag`) to the loader directly
using the
+`add_constructor` method of the loader. Note that this requires that the tag
(`!ENV`) be
+defined as well.
+
+```python
+from yaml_env_tag import construct_env_tag
+
+Loader.add_constructor('!ENV', construct_env_tag)
+```
+
+## Using the tag
+
+Include the tag `!ENV` followed by the name of an environment variable in a
YAML
+file and the value of the environment variable will be used in its place.
+
+```yaml
+key: !ENV SOME_VARIABLE
+```
+
+If `SOME_VARIABLE` is set to `A string!`, then the above YAML would result in
the
+following Python object:
+
+```python
+{'key': 'A string!'}
+```
+
+The content of the variable is parsed using YAML's implicit scalar types, such
as
+string, bool, integer, float, datestamp and null. More complex types are not
+recognized and simply passed through as a string. For example, if
`SOME_VARIABLE`
+was set to the string `true`, then the above YAML would result in the
following:
+
+```python
+{'key': True}
+```
+
+If the variable specified is not set, then a `null` value is assigned as a
default.
+You may define your own default as the last item in a sequence.
+
+```yaml
+key: !ENV [SOME_VARIABLE, default]
+```
+
+In the above example, if `SOME_VARIABLE` is not defined, the string `default`
would
+be used instead, as follows:
+
+```python
+{'key': 'default'}
+```
+
+You may list multiple variables as fallbacks. The first variable which is set
is
+used. In any sequance with more than one item, the last item must always be a
+default value and will not be resolved as an environment variable.
+
+```yaml
+key: !ENV [SOME_VARIABLE, FALLBACK, default]
+```
+
+As with variable contents, the default is resolved to a Python object of the
+implied type (string, bool, integer, float, datestamp and null).
+
+When `SOME_VARIABLE` is not set, all four of the following items will resolve
to
+the same value (`None`):
+
+```yaml
+- !ENV SOME_VARIABLE
+- !ENV [SOME_VARIABLE]
+- !ENV [SOME_VARIABLE, ~]
+- !ENV [SOME_VARIABLE, null]
+```
+
+## Related
+
+pyyaml_env_tag was inspired by the Ruby package [yaml-env-tag].
+
+An alternate method of referencing environment variables in YAML files is
+implemented by [pyyaml-tags] and [python_yaml_environment_variables].
+Each of those libraries use a template string and replace the template tag with
+the content of the variable. While this allows a single value to reference
+multiple variables and to contain additional content, it restricts all values
+to strings only and does not provide a way to define defaults.
+
+[yaml-env-tag]: https://github.com/jirutka/yaml-env-tag
+[pyyaml-tags]: https://github.com/meiblorn/pyyaml-tags
+[python_yaml_environment_variables]:
https://gist.github.com/mkaranasou/ba83e25c835a8f7629e34dd7ede01931
+
+## License
+
+pyyaml_env_tag is licensed under the [MIT License] as defined in `LICENSE`.
+
+[MIT License]: https://opensource.org/licenses/MIT
+
+## Changelog
+
+### [1.1] - 2025-05-13
+
+- Ensure tests get included with distribution (#9).
+
+### [1.0] - 2025-05-09
+
+- Add the `add_env_tag` helper function as a higher level way of modifying the
loader.
+
+### [0.1] - 2020-11-11
+
+The initial release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/SOURCES.txt
new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/SOURCES.txt
--- old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/SOURCES.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/SOURCES.txt 2025-05-13
17:23:21.000000000 +0200
@@ -0,0 +1,10 @@
+LICENSE
+README.md
+pyproject.toml
+yaml_env_tag.py
+pyyaml_env_tag.egg-info/PKG-INFO
+pyyaml_env_tag.egg-info/SOURCES.txt
+pyyaml_env_tag.egg-info/dependency_links.txt
+pyyaml_env_tag.egg-info/requires.txt
+pyyaml_env_tag.egg-info/top_level.txt
+tests/test_yaml_env_tag.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/dependency_links.txt
new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/dependency_links.txt
--- old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/dependency_links.txt
1970-01-01 01:00:00.000000000 +0100
+++ new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/dependency_links.txt
2025-05-13 17:23:21.000000000 +0200
@@ -0,0 +1 @@
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/requires.txt
new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/requires.txt
--- old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/requires.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/requires.txt 2025-05-13
17:23:21.000000000 +0200
@@ -0,0 +1 @@
+pyyaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/top_level.txt
new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/top_level.txt
--- old/pyyaml_env_tag-0.1/pyyaml_env_tag.egg-info/top_level.txt
1970-01-01 01:00:00.000000000 +0100
+++ new/pyyaml_env_tag-1.1/pyyaml_env_tag.egg-info/top_level.txt
2025-05-13 17:23:21.000000000 +0200
@@ -0,0 +1 @@
+yaml_env_tag
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/setup.cfg
new/pyyaml_env_tag-1.1/setup.cfg
--- old/pyyaml_env_tag-0.1/setup.cfg 1970-01-01 01:00:00.000000000 +0100
+++ new/pyyaml_env_tag-1.1/setup.cfg 2025-05-13 17:23:21.665883300 +0200
@@ -0,0 +1,4 @@
+[egg_info]
+tag_build =
+tag_date = 0
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/setup.py
new/pyyaml_env_tag-1.1/setup.py
--- old/pyyaml_env_tag-0.1/setup.py 1970-01-01 01:00:00.000000000 +0100
+++ new/pyyaml_env_tag-1.1/setup.py 1970-01-01 01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-#!/usr/bin/env python
-# setup.py generated by flit for tools that don't yet use PEP 517
-
-from distutils.core import setup
-
-install_requires = \
-['pyyaml']
-
-setup(name='pyyaml_env_tag',
- version='0.1',
- description='A custom YAML tag for referencing environment variables in
YAML files. ',
- author='Waylan Limberg',
- author_email='[email protected]',
- url='https://github.com/waylan/pyyaml-env-tag',
- py_modules=['yaml_env_tag'],
- install_requires=install_requires,
- python_requires='>=3.6',
- )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/test_yaml_env_tag.py
new/pyyaml_env_tag-1.1/test_yaml_env_tag.py
--- old/pyyaml_env_tag-0.1/test_yaml_env_tag.py 2020-11-12 03:31:00.000000000
+0100
+++ new/pyyaml_env_tag-1.1/test_yaml_env_tag.py 1970-01-01 01:00:00.000000000
+0100
@@ -1,331 +0,0 @@
-import os
-import yaml
-import datetime
-import unittest
-from unittest import mock
-from yaml_env_tag import construct_env_tag
-
-def mockenv(**kwargs):
- ''' Decorator to mock os.environ with provided variables. '''
- return mock.patch.dict(os.environ, kwargs)
-
-
-class TestYamlEnvTag(unittest.TestCase):
-
- def assertYamlLoad(self, data, expected, loader=yaml.Loader):
- loader.add_constructor('!ENV', construct_env_tag)
- self.assertEqual(expected, yaml.load(data, Loader=loader))
-
- @mockenv(VAR='foo')
- def test_scalar(self):
- self.assertYamlLoad(
- '!ENV VAR',
- 'foo'
- )
-
- def test_scalar_undefined(self):
- self.assertYamlLoad(
- '!ENV VAR',
- None
- )
-
- @mockenv(VAR='foo')
- def test_safe_loader(self):
- self.assertYamlLoad(
- '!ENV VAR',
- 'foo',
- yaml.SafeLoader
- )
-
- @mockenv(VAR='foo')
- def test_scalar_in_squence(self):
- self.assertYamlLoad(
- '- !ENV VAR',
- ['foo']
- )
-
- @mockenv(VAR='foo')
- def test_scalar_in_mapping(self):
- self.assertYamlLoad(
- 'key: !ENV VAR',
- {'key': 'foo'}
- )
-
- @mockenv(VAR='foo')
- def test_sequence_1(self):
- self.assertYamlLoad(
- '!ENV [VAR]',
- 'foo'
- )
-
- def test_sequence_1_undefined(self):
- self.assertYamlLoad(
- '!ENV [VAR]',
- None
- )
-
- @mockenv(VAR='foo')
- def test_sequence_2(self):
- self.assertYamlLoad(
- '!ENV [VAR, default]',
- 'foo'
- )
-
- def test_sequence_2_undefined(self):
- self.assertYamlLoad(
- '!ENV [VAR, default]',
- 'default'
- )
-
- @mockenv(VAR1='foo', VAR2='bar')
- def test_sequence_3(self):
- self.assertYamlLoad(
- '!ENV [VAR1, VAR2, default]',
- 'foo'
- )
-
- @mockenv(VAR2='bar')
- def test_sequence_3_1_undefined(self):
- self.assertYamlLoad(
- '!ENV [VAR1, VAR2, default]',
- 'bar'
- )
-
- def test_sequence_3_undefined(self):
- self.assertYamlLoad(
- '!ENV [VAR1, VAR2, default]',
- 'default'
- )
-
- def test_default_type_null(self):
- self.assertYamlLoad(
- '!ENV [VAR, null]',
- None
- )
-
- def test_default_type_tilde(self):
- self.assertYamlLoad(
- '!ENV [VAR, ~]',
- None
- )
-
- def test_default_type_bool_false(self):
- self.assertYamlLoad(
- '!ENV [VAR, false]',
- False
- )
-
- def test_default_type_bool_true(self):
- self.assertYamlLoad(
- '!ENV [VAR, true]',
- True
- )
-
- def test_default_type_str(self):
- self.assertYamlLoad(
- '!ENV [VAR, "a string"]',
- 'a string'
- )
-
- def test_default_type_int(self):
- self.assertYamlLoad(
- '!ENV [VAR, 42]',
- 42
- )
-
- def test_default_type_float(self):
- self.assertYamlLoad(
- '!ENV [VAR, 3.14]',
- 3.14
- )
-
- def test_default_type_date(self):
- self.assertYamlLoad(
- '!ENV [VAR, 2020-11-11]',
- datetime.date(2020, 11, 11)
- )
-
- def test_default_type_sequence(self):
- self.assertYamlLoad(
- '!ENV [VAR, [foo, bar]]',
- ['foo', 'bar']
- )
-
- def test_default_type_mapping(self):
- self.assertYamlLoad(
- '!ENV [VAR, foo: bar]',
- {'foo': 'bar'}
- )
-
- @mockenv(VAR='null')
- def test_env_value_type_null(self):
- self.assertYamlLoad(
- '!ENV [VAR, default]',
- None
- )
-
- @mockenv(VAR='~')
- def test_env_value_type_tilde(self):
- self.assertYamlLoad(
- '!ENV [VAR, default]',
- None
- )
-
- @mockenv(VAR='false')
- def test_env_value_type_bool_false(self):
- self.assertYamlLoad(
- '!ENV VAR',
- False
- )
-
- @mockenv(VAR='true')
- def test_env_value_type_bool_true(self):
- self.assertYamlLoad(
- '!ENV VAR',
- True
- )
-
- @mockenv(VAR='a string')
- def test_env_value_type_str(self):
- self.assertYamlLoad(
- '!ENV VAR',
- 'a string'
- )
-
- @mockenv(VAR='42')
- def test_env_value_type_int(self):
- self.assertYamlLoad(
- '!ENV VAR',
- 42
- )
-
- @mockenv(VAR='3.14')
- def test_env_value_type_float(self):
- self.assertYamlLoad(
- '!ENV VAR',
- 3.14
- )
-
- @mockenv(VAR='2020-11-11')
- def test_env_value_type_date(self):
- self.assertYamlLoad(
- '!ENV VAR',
- datetime.date(2020, 11, 11)
- )
-
- @mockenv(VAR='[foo, bar]')
- def test_env_value_type_sequence(self):
- self.assertYamlLoad(
- '!ENV VAR',
- '[foo, bar]'
- )
-
- @mockenv(VAR='foo: bar')
- def test_env_value_type_mapping(self):
- self.assertYamlLoad(
- '!ENV VAR',
- 'foo: bar'
- )
-
- @mockenv(UPPERCASE='foo')
- def test_env_name_uppercase(self):
- self.assertYamlLoad(
- '!ENV UPPERCASE',
- 'foo'
- )
-
- @mockenv(lowercase='foo')
- def test_env_name_lowercase(self):
- self.assertYamlLoad(
- '!ENV lowercase',
- 'foo'
- )
-
- @mockenv(CamelCase='foo')
- def test_env_name_CamelCase(self):
- self.assertYamlLoad(
- '!ENV CamelCase',
- 'foo'
- )
-
- @mockenv(snake_case='foo')
- def test_env_name_snake_case(self):
- self.assertYamlLoad(
- '!ENV snake_case',
- 'foo'
- )
-
- # WARNING! The Environment Variable names in the following tests are
- # probably a bad idea in use. In fact, it may not even be possable to
- # set them in most OSs. We are testing that they don't get converted
- # to native Python types, ensuring expected results in edge cases.
-
- @mockenv(null='foo')
- def test_env_name_null(self):
- self.assertYamlLoad(
- '!ENV null',
- 'foo'
- )
-
- @mockenv(**{'~': 'foo'})
- def test_env_name_tilde(self):
- self.assertYamlLoad(
- '!ENV ~',
- 'foo'
- )
-
- @mockenv(**{'true': 'foo'})
- def test_env_name_true(self):
- self.assertYamlLoad(
- '!ENV true',
- 'foo'
- )
-
- @mockenv(**{'false': 'foo'})
- def test_env_name_false(self):
- self.assertYamlLoad(
- '!ENV false',
- 'foo'
- )
-
- @mockenv(**{'42': 'foo'})
- def test_env_name_int(self):
- self.assertYamlLoad(
- '!ENV 42',
- 'foo'
- )
-
- @mockenv(**{'3.14': 'foo'})
- def test_env_name_float(self):
- self.assertYamlLoad(
- '!ENV 3.14',
- 'foo'
- )
-
- @mockenv(**{'2020-11-11': 'foo'})
- def test_env_name_date(self):
- self.assertYamlLoad(
- '!ENV 2020-11-11',
- 'foo'
- )
-
- def test_env_name_sequance(self):
- yaml.Loader.add_constructor('!ENV', construct_env_tag)
- self.assertRaises(
- yaml.constructor.ConstructorError,
- yaml.load,
- '!ENV [[foo]]',
- Loader=yaml.Loader
- )
-
- def test_env_name_mapping(self):
- yaml.Loader.add_constructor('!ENV', construct_env_tag)
- self.assertRaises(
- yaml.constructor.ConstructorError,
- yaml.load,
- '!ENV {key: value}',
- Loader=yaml.Loader
- )
-
-if __name__ == '__main__':
- unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/tests/test_yaml_env_tag.py
new/pyyaml_env_tag-1.1/tests/test_yaml_env_tag.py
--- old/pyyaml_env_tag-0.1/tests/test_yaml_env_tag.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pyyaml_env_tag-1.1/tests/test_yaml_env_tag.py 2025-05-13
17:23:16.000000000 +0200
@@ -0,0 +1,330 @@
+import os
+import yaml
+import datetime
+import unittest
+from unittest import mock
+from yaml_env_tag import add_env_tag
+
+
+def mockenv(**kwargs):
+ ''' Decorator to mock os.environ with provided variables. '''
+ return mock.patch.dict(os.environ, kwargs)
+
+
+class TestYamlEnvTag(unittest.TestCase):
+
+ def assertYamlLoad(self, data, expected, loader=yaml.Loader):
+ self.assertEqual(expected, yaml.load(data, Loader=add_env_tag(loader)))
+
+ @mockenv(VAR='foo')
+ def test_scalar(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ 'foo'
+ )
+
+ def test_scalar_undefined(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ None
+ )
+
+ @mockenv(VAR='foo')
+ def test_safe_loader(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ 'foo',
+ yaml.SafeLoader
+ )
+
+ @mockenv(VAR='foo')
+ def test_scalar_in_squence(self):
+ self.assertYamlLoad(
+ '- !ENV VAR',
+ ['foo']
+ )
+
+ @mockenv(VAR='foo')
+ def test_scalar_in_mapping(self):
+ self.assertYamlLoad(
+ 'key: !ENV VAR',
+ {'key': 'foo'}
+ )
+
+ @mockenv(VAR='foo')
+ def test_sequence_1(self):
+ self.assertYamlLoad(
+ '!ENV [VAR]',
+ 'foo'
+ )
+
+ def test_sequence_1_undefined(self):
+ self.assertYamlLoad(
+ '!ENV [VAR]',
+ None
+ )
+
+ @mockenv(VAR='foo')
+ def test_sequence_2(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, default]',
+ 'foo'
+ )
+
+ def test_sequence_2_undefined(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, default]',
+ 'default'
+ )
+
+ @mockenv(VAR1='foo', VAR2='bar')
+ def test_sequence_3(self):
+ self.assertYamlLoad(
+ '!ENV [VAR1, VAR2, default]',
+ 'foo'
+ )
+
+ @mockenv(VAR2='bar')
+ def test_sequence_3_1_undefined(self):
+ self.assertYamlLoad(
+ '!ENV [VAR1, VAR2, default]',
+ 'bar'
+ )
+
+ def test_sequence_3_undefined(self):
+ self.assertYamlLoad(
+ '!ENV [VAR1, VAR2, default]',
+ 'default'
+ )
+
+ def test_default_type_null(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, null]',
+ None
+ )
+
+ def test_default_type_tilde(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, ~]',
+ None
+ )
+
+ def test_default_type_bool_false(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, false]',
+ False
+ )
+
+ def test_default_type_bool_true(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, true]',
+ True
+ )
+
+ def test_default_type_str(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, "a string"]',
+ 'a string'
+ )
+
+ def test_default_type_int(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, 42]',
+ 42
+ )
+
+ def test_default_type_float(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, 3.14]',
+ 3.14
+ )
+
+ def test_default_type_date(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, 2020-11-11]',
+ datetime.date(2020, 11, 11)
+ )
+
+ def test_default_type_sequence(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, [foo, bar]]',
+ ['foo', 'bar']
+ )
+
+ def test_default_type_mapping(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, foo: bar]',
+ {'foo': 'bar'}
+ )
+
+ @mockenv(VAR='null')
+ def test_env_value_type_null(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, default]',
+ None
+ )
+
+ @mockenv(VAR='~')
+ def test_env_value_type_tilde(self):
+ self.assertYamlLoad(
+ '!ENV [VAR, default]',
+ None
+ )
+
+ @mockenv(VAR='false')
+ def test_env_value_type_bool_false(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ False
+ )
+
+ @mockenv(VAR='true')
+ def test_env_value_type_bool_true(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ True
+ )
+
+ @mockenv(VAR='a string')
+ def test_env_value_type_str(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ 'a string'
+ )
+
+ @mockenv(VAR='42')
+ def test_env_value_type_int(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ 42
+ )
+
+ @mockenv(VAR='3.14')
+ def test_env_value_type_float(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ 3.14
+ )
+
+ @mockenv(VAR='2020-11-11')
+ def test_env_value_type_date(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ datetime.date(2020, 11, 11)
+ )
+
+ @mockenv(VAR='[foo, bar]')
+ def test_env_value_type_sequence(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ '[foo, bar]'
+ )
+
+ @mockenv(VAR='foo: bar')
+ def test_env_value_type_mapping(self):
+ self.assertYamlLoad(
+ '!ENV VAR',
+ 'foo: bar'
+ )
+
+ @mockenv(UPPERCASE='foo')
+ def test_env_name_uppercase(self):
+ self.assertYamlLoad(
+ '!ENV UPPERCASE',
+ 'foo'
+ )
+
+ @mockenv(lowercase='foo')
+ def test_env_name_lowercase(self):
+ self.assertYamlLoad(
+ '!ENV lowercase',
+ 'foo'
+ )
+
+ @mockenv(CamelCase='foo')
+ def test_env_name_CamelCase(self):
+ self.assertYamlLoad(
+ '!ENV CamelCase',
+ 'foo'
+ )
+
+ @mockenv(snake_case='foo')
+ def test_env_name_snake_case(self):
+ self.assertYamlLoad(
+ '!ENV snake_case',
+ 'foo'
+ )
+
+ # WARNING! The Environment Variable names in the following tests are
+ # probably a bad idea in use. In fact, it may not even be possable to
+ # set them in most OSs. We are testing that they don't get converted
+ # to native Python types, ensuring expected results in edge cases.
+
+ @mockenv(null='foo')
+ def test_env_name_null(self):
+ self.assertYamlLoad(
+ '!ENV null',
+ 'foo'
+ )
+
+ @mockenv(**{'~': 'foo'})
+ def test_env_name_tilde(self):
+ self.assertYamlLoad(
+ '!ENV ~',
+ 'foo'
+ )
+
+ @mockenv(**{'true': 'foo'})
+ def test_env_name_true(self):
+ self.assertYamlLoad(
+ '!ENV true',
+ 'foo'
+ )
+
+ @mockenv(**{'false': 'foo'})
+ def test_env_name_false(self):
+ self.assertYamlLoad(
+ '!ENV false',
+ 'foo'
+ )
+
+ @mockenv(**{'42': 'foo'})
+ def test_env_name_int(self):
+ self.assertYamlLoad(
+ '!ENV 42',
+ 'foo'
+ )
+
+ @mockenv(**{'3.14': 'foo'})
+ def test_env_name_float(self):
+ self.assertYamlLoad(
+ '!ENV 3.14',
+ 'foo'
+ )
+
+ @mockenv(**{'2020-11-11': 'foo'})
+ def test_env_name_date(self):
+ self.assertYamlLoad(
+ '!ENV 2020-11-11',
+ 'foo'
+ )
+
+ def test_env_name_sequance(self):
+ self.assertRaises(
+ yaml.constructor.ConstructorError,
+ yaml.load,
+ '!ENV [[foo]]',
+ Loader=add_env_tag(yaml.Loader)
+ )
+
+ def test_env_name_mapping(self):
+ self.assertRaises(
+ yaml.constructor.ConstructorError,
+ yaml.load,
+ '!ENV {key: value}',
+ Loader=add_env_tag(yaml.Loader)
+ )
+
+
+if __name__ == '__main__':
+ unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyyaml_env_tag-0.1/yaml_env_tag.py
new/pyyaml_env_tag-1.1/yaml_env_tag.py
--- old/pyyaml_env_tag-0.1/yaml_env_tag.py 2020-11-12 02:03:56.000000000
+0100
+++ new/pyyaml_env_tag-1.1/yaml_env_tag.py 2025-05-13 17:23:16.000000000
+0200
@@ -1,5 +1,5 @@
""" A custom YAML tag for referencing environment variables in YAML files. """
-__version__ = '0.1'
+__version__ = '1.1'
import os
import yaml
@@ -20,9 +20,11 @@
# Env Vars are resolved as string values, ignoring (implicit) types.
vars = [loader.construct_scalar(child) for child in child_nodes]
else:
- raise yaml.constructor.ConstructorError(None, None,
+ raise yaml.constructor.ConstructorError(
+ None, None,
f'expected a scalar or sequence node, but found {node.id}',
- node.start_mark)
+ node.start_mark
+ )
for var in vars:
if var in os.environ:
@@ -32,3 +34,9 @@
return loader.construct_object(yaml.nodes.ScalarNode(tag, value))
return default
+
+
+def add_env_tag(loader: yaml.Loader) -> yaml.Loader:
+ """ Modify and return Loader with env tag support. """
+ loader.add_constructor('!ENV', construct_env_tag)
+ return loader