https://github.com/untzag/tidy_headers
easy headers, inspired by the tidy data specification
https://github.com/untzag/tidy_headers
metadata-management python tidy-data
Last synced: about 1 year ago
JSON representation
easy headers, inspired by the tidy data specification
- Host: GitHub
- URL: https://github.com/untzag/tidy_headers
- Owner: untzag
- License: mit
- Created: 2017-11-10T01:37:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-20T22:52:23.000Z (over 1 year ago)
- Last Synced: 2025-04-22T15:09:59.677Z (about 1 year ago)
- Topics: metadata-management, python, tidy-data
- Language: Python
- Homepage:
- Size: 55.7 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tidy_headers
`tidy_headers` stores metadata in beautifully readable plain text headers.
## example
For some `filepath`,
```python
import collections
import tidy_headers
meta = collections.OrderedDict()
meta['date'] = '2017-11-10'
meta['location'] = 'Madison, Wisconsin, USA'
meta['name'] = ['batch', 'apples', 'pineapple', 'oregano', 'tomatoes']
tidy_headers.write(filepath, meta)
```
To get the dictionary back, simply `read`:
```python
meta = tidy_headers.read(filepath)
```
:tada:
See the examples directory for more:
* [minimal.txt](../master/examples/minimal.txt)
* [named.txt](../master/examples/named.txt)
## installation
### using pip
```
pip install tidy_headers
```
### using conda
```
conda config --add channels conda-forge
conda install tidy_headers
```
## allowed values
`tidy_headers` strives to write plain text headers in an unambiguous way such that an identical metadata dictionary can be generated using `read`. This process is only reliable for the following subset of python types:
- `str`
- `int`
- `float`
- `list` containing any combination of the above
- `numpy.ndarray` (arbitrary size and dimensionality)
Metadata dictionaries containing only these types are guaranteed to `read` and `write` succesfully.