Easily pack and unpack metadata in a filename.
Project description
=======
keyname
=======
.. image:: https://img.shields.io/pypi/v/keyname.svg
:target: https://pypi.python.org/pypi/keyname
.. image:: https://img.shields.io/travis/mmore500/keyname.svg
:target: https://travis-ci.org/mmore500/keyname
.. image:: https://readthedocs.org/projects/keyname/badge/?version=latest
:target: https://keyname.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Easily pack and unpack metadata in a filename.
* Free software: MIT license
* Documentation: https://keyname.readthedocs.io.
Usage
--------
Keyname is built around the following file name convention:
* key/value pairs are constructed with :code:`=` between the key and value
* key/value pairs are joined by :code:`+`
* key/value pairs are listed by alphanumerical ordering of the key
* keys beginning with :code:`_` are ordered after keys not beginning with :code:`_`
* the :code:`ext` (extension) key is always placed last
For example, :code:`key1=val1+key2=val2+_key3=val3+ext=.txt`.
.. code-block:: python3
from keyname import keyname as kn
# returns 'key1=val1+key2=val2+_key3=val3+ext=.txt'
kn.pack({
'key2' : 'val2',
'ext' : '.txt',
'key1' : 'val1',
'_key3' : 'val3',
})
# returns {'key' : 'val', 'ext' : '.txt'}
kf.unpack('path/to/key=val+ext=.txt')
Credits
-------
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
=======
History
=======
0.0.0 (2019-03-16)
------------------
* First release on PyPI.
keyname
=======
.. image:: https://img.shields.io/pypi/v/keyname.svg
:target: https://pypi.python.org/pypi/keyname
.. image:: https://img.shields.io/travis/mmore500/keyname.svg
:target: https://travis-ci.org/mmore500/keyname
.. image:: https://readthedocs.org/projects/keyname/badge/?version=latest
:target: https://keyname.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
Easily pack and unpack metadata in a filename.
* Free software: MIT license
* Documentation: https://keyname.readthedocs.io.
Usage
--------
Keyname is built around the following file name convention:
* key/value pairs are constructed with :code:`=` between the key and value
* key/value pairs are joined by :code:`+`
* key/value pairs are listed by alphanumerical ordering of the key
* keys beginning with :code:`_` are ordered after keys not beginning with :code:`_`
* the :code:`ext` (extension) key is always placed last
For example, :code:`key1=val1+key2=val2+_key3=val3+ext=.txt`.
.. code-block:: python3
from keyname import keyname as kn
# returns 'key1=val1+key2=val2+_key3=val3+ext=.txt'
kn.pack({
'key2' : 'val2',
'ext' : '.txt',
'key1' : 'val1',
'_key3' : 'val3',
})
# returns {'key' : 'val', 'ext' : '.txt'}
kf.unpack('path/to/key=val+ext=.txt')
Credits
-------
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
=======
History
=======
0.0.0 (2019-03-16)
------------------
* First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
keyname-0.0.2.tar.gz
(9.4 kB
view hashes)
Built Distribution
Close
Hashes for keyname-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b201cfb7aa885d5e6405d95d2b9dbc9528bfd99847f3c4c8c6cd0652999a2fb |
|
MD5 | e9dfe1e6c09f459600d52d71364fbe85 |
|
BLAKE2b-256 | 589c855e825ad6f04799130f3769e9ef4378439ae593e43a3c6958d0e5092fbb |