Ravenports generated: 27 May 2023 12:37
[ravenports.git] / bucket_6C / python-pyyaml-env-tag
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               python-pyyaml-env-tag
4 VERSION=                0.1
5 KEYWORDS=               python
6 VARIANTS=               py310 v11
7 SDESC[py310]=           YAML tag for environment variables (3.10)
8 SDESC[v11]=             YAML tag for environment variables (3.11)
9 HOMEPAGE=               https://github.com/waylan/pyyaml-env-tag
10 CONTACT=                Python_Automaton[python@ironwolf.systems]
11
12 DOWNLOAD_GROUPS=        main
13 SITES[main]=            PYPIWHL/5a/66/bbb1dd374f5c870f59c5bb1db0e18cbe7fa739415a24cbd95b2d1f5ae0c4
14 DISTFILE[1]=            pyyaml_env_tag-0.1-py3-none-any.whl:main
15 DF_INDEX=               1
16 SPKGS[py310]=           single
17 SPKGS[v11]=             single
18
19 OPTIONS_AVAILABLE=      PY310 PY311
20 OPTIONS_STANDARD=       none
21 VOPTS[py310]=           PY310=ON PY311=OFF
22 VOPTS[v11]=             PY310=OFF PY311=ON
23
24 DISTNAME=               pyyaml_env_tag-0.1.dist-info
25
26 GENERATED=              yes
27
28 [PY310].RUN_DEPENDS_ON=                 python-PyYAML:single:py310
29 [PY310].USES_ON=                        python:py310,wheel
30
31 [PY311].RUN_DEPENDS_ON=                 python-PyYAML:single:v11
32 [PY311].USES_ON=                        python:v11,wheel
33
34 [FILE:2233:descriptions/desc.single]
35 # pyyaml_env_tag
36
37 A custom YAML tag for referencing environment variables in YAML files.
38
39 ## Installation
40
41 Install `PyYAML` and the `pyyaml_env_tag` package with pip:
42
43 `bash
44 pip install pyyaml pyyaml_env_tag
45 `
46
47 ### Enabling the tag
48
49 To enable the tag, import and add the `construct_env_tag` constructor to
50 your YAML
51 loader of choice.
52
53 ```python
54 import yaml
55 from yaml_env_tag import construct_env_tag
56
57 yaml.Loader.add_constructor('!ENV', construct_env_tag)
58 ```
59
60 Then you may use the loader as per usual. For example:
61
62 ```python
63 yaml.load(data, Loader=yaml.Loader)
64 ```
65
66 ## Using the tag
67
68 Include the tag `!ENV` followed by the name of an environment variable in a
69 YAML
70 file and the value of the environment variable will be used in its place.
71
72 ```yaml
73 key: !ENV SOME_VARIABLE
74 ```
75
76 If `SOME_VARIABLE` is set to `A string!`, then the above YAML would result
77 in the
78 following Python object:
79
80 ```python
81 {'key': 'A string!'}
82 ```
83
84 The content of the variable is parsed using YAML's implicit scalar types,
85 such as
86 string, bool, integer, float, datestamp and null. More complex types are
87 not
88 recognized and simply passed through as a string. For example, if
89 `SOME_VARIABLE`
90 was set to the string `true`, then the above YAML would result in the
91 following:
92
93 ```python
94 {'key': True}
95 ```
96
97 If the variable specified is not set, then a `null` value is assigned as a
98 default.
99 You may define your own default as the last item in a sequence.
100
101 ```yaml
102 key: !ENV [SOME_VARIABLE, default]
103 ```
104
105 In the above example, if `SOME_VARIABLE` is not defined, the string
106 `default` would
107 be used instead, as follows:
108
109 ```python
110 {'key': 'default'}
111 ```
112
113 You may list multiple variables as fallbacks. The first variable which is
114 set is
115 used. In any sequance with more than one item, the last item must always be
116 a
117 default value and will not be resolved as an environment variable.
118
119 ```yaml
120 key: !ENV [SOME_VARIABLE, FALLBACK, default]
121 ```
122
123 As with variable contents, the default is resolved to a Python object of
124 the
125 implied type (string, bool, integer, float, datestamp and null).
126
127 When `SOME_VARIABLE` is not set, all four of the following items will
128 resolve to
129 the same value (`None`):
130
131 ```yaml
132 - !ENV SOME_VARIABLE
133 - !ENV [SOME_VARIABLE]
134 - !ENV [SOME_VARIABLE, ~]
135
136
137 [FILE:114:distinfo]
138 af31106dec8a4d68c60207c1886031cbf839b68aa7abccdb19868200532c2069         3911 pyyaml_env_tag-0.1-py3-none-any.whl
139