You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,9 @@ pip install pyya
25
25
26
26
## Usage
27
27
28
-
Create YAML configuration files for your project:
28
+
### Example
29
29
30
+
Create YAML configuration files for your project:
30
31
31
32
```yaml
32
33
# default.config.yaml - this file usually goes to version control system
@@ -54,6 +55,7 @@ from pyya import init_config
54
55
config = init_config(
55
56
'config.yaml', 'default.config.yaml',
56
57
convert_keys_to_snake_case = False,
58
+
add_underscore_prefix_to_keywords = False
57
59
raise_error_non_identifiers = False)
58
60
print(json.dumps(config.database))
59
61
@@ -66,9 +68,21 @@ As you can see, `pyya` automatically merges default config file with production
66
68
67
69
Under the hood `pyya` uses [PyYAML](https://pypi.org/project/PyYAML/) to parse YAML files and [munch](https://pypi.org/project/munch/) library to create attribute-stylish dictionaries.
68
70
69
-
`pyya` automatically adds underscore prefix to Python keywords and can be configured to convert `camelCase` or `PascalCase` keys to `snake_case`.
71
+
and can be configured to .
72
+
73
+
### Flags
70
74
71
-
If `raise_error_non_identifiers=True`, `pyya` will raise error if section name is not valid Python identifier.
75
+
```python
76
+
convert_keys_to_snake_case=True# `pyya` converts `camelCase` or `PascalCase` keys to `snake_case`
77
+
```
78
+
79
+
```python
80
+
add_underscore_prefix_to_keywords=True# `pyya` adds underscore prefix to keys that are Python keywords
81
+
```
82
+
83
+
```python
84
+
raise_error_non_identifiers=True# `pyya` raises error if key name is not valid Python identifier
0 commit comments