Use python in yaml
## 基本使用
在python中使用:
```python
from pyyml import load
with open('conf.yml') as f:
raw_conf = f.read()
config = load(raw_conf)
print(config)
```
在yaml中 `${...}` 中的内容将会被python执行:
yaml内容
```yaml
sum: ${1 + 1}
```
实际解析内容
```python
{'sum': 2}
```
通过在文件开头第一行注释来导入所需的包:
```yaml
# libs:['os', 'os.path:path', 'this']
```
通过 [包名]:[别名] 取别名导入包
`'os.path:path' 等同于 python 中的 from os import path`
例如yaml文件内容
```yaml
# libs:['os', 'os.path:path', 'this']
os_name: ${os.name}
base_dir: ${path.abspath(path.dirname(__file__))}
```
Metadata
Release files for pyyml 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyyml-0.0.2.tar.gz | 1.4 kB | Without provenance | Details for pyyml-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyyml-0.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pyyml-0.0.2-py2.py3-none-any.whl |
Total release size: 2.9 kB
Release files / pyyml-0.0.2.tar.gz
| Download URL | pyyml-0.0.2.tar.gz |
|---|---|
| Size | 1.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f005c753eb36a405321eb653d803861c8570c347f89b35a7c9c21edef5248f5f
|
|
BLAKE2b-256 checksum How to use checksums |
370306f9809cf57ef6fdffe11a4bf7c0c092835913da05bfce9d618ac6f714af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
|
Release files / pyyml-0.0.2-py2.py3-none-any.whl
| Download URL | pyyml-0.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 1.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
17acc886bb8d58197a745003eae477b18b343ebaa0a304527c5a5dc5770a2b74
|
|
BLAKE2b-256 checksum How to use checksums |
20c43996ead5533b19da63409c0e5e56827f0e5ed8228c771d587ac98c63c157
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
|
Security for pyyml 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.