Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cgarciae/dicto
A dict-like object
https://github.com/cgarciae/dicto
Last synced: 7 days ago
JSON representation
A dict-like object
- Host: GitHub
- URL: https://github.com/cgarciae/dicto
- Owner: cgarciae
- License: mit
- Created: 2017-12-21T00:53:03.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-21T22:35:41.000Z (over 4 years ago)
- Last Synced: 2024-10-04T18:47:41.807Z (about 1 month ago)
- Language: Python
- Homepage: https://cgarciae.github.io/dicto/
- Size: 671 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dicto
A dict-like object that enables access of its elements as regular fields. Dicto's main feature is delivering an elegant experience while using configuration files/objects.### Example
You can create a Dicto from any `dict`:```python
import dictoparams = dicto.Dict({"learning_rate": 0.001, "batch_size": 32 })
optimizer = Adam(params.learning_rate)
```Dicto parses through arbitrary nested structures of `dicts`, `list`, `tuple`, and `set`:
```python
import dictoparams = dicto.Dict({
"points":[
{
"x": 1,
"y": 2
},
{
"x": 3,
"y": 4
}
]
})print(params.points[0].x) # 1
```
`dicto` can load `json`, `yaml`, and `xml` formats directly, for example, given this `YAML` file
```yaml
# params.yml
learning_rate: 0.001
batch_size: 32
```you can load it like this:
```python
import dictoparams = dicto.load("params.yml")
optimizer = Adam(params.learning_rate)
```## Installation
```bash
pip install dicto
```## License
MIT License