You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.8 KiB

4 years ago
  1. Metadata-Version: 2.1
  2. Name: pytoml
  3. Version: 0.1.20
  4. Summary: A parser for TOML-0.4.0
  5. Home-page: https://github.com/avakar/pytoml
  6. Author: Martin Vejnár
  7. Author-email: vejnar.martin@gmail.com
  8. License: MIT
  9. Platform: UNKNOWN
  10. Classifier: Programming Language :: Python :: 2
  11. Classifier: Programming Language :: Python :: 2.7
  12. Classifier: Programming Language :: Python :: 3
  13. Classifier: Programming Language :: Python :: 3.5
  14. Classifier: Programming Language :: Python :: 3.6
  15. Classifier: Programming Language :: Python :: 3.7
  16. Classifier: License :: OSI Approved :: MIT License
  17. Classifier: Topic :: Software Development :: Libraries
  18. Description-Content-Type: text/markdown
  19. [![PyPI](https://img.shields.io/pypi/v/pytoml.svg)](https://pypi.python.org/pypi/pytoml)
  20. [![Build Status](https://travis-ci.org/avakar/pytoml.svg?branch=master)](https://travis-ci.org/avakar/pytoml)
  21. # pytoml
  22. This project aims at being a specs-conforming and strict parser and writer for [TOML][1] files.
  23. The library currently supports [version 0.4.0][2] of the specs and runs with Python 2.7+ and 3.5+.
  24. Install:
  25. pip install pytoml
  26. The interface is the same as for the standard `json` package.
  27. >>> import pytoml as toml
  28. >>> toml.loads('a = 1')
  29. {'a': 1}
  30. >>> with open('file.toml', 'rb') as fin:
  31. ... obj = toml.load(fin)
  32. >>> obj
  33. {'a': 1}
  34. The `loads` function accepts either a bytes object
  35. (that gets decoded as UTF-8 with no BOM allowed),
  36. or a unicode object.
  37. Use `dump` or `dumps` to serialize a dict into TOML.
  38. >>> print toml.dumps(obj)
  39. a = 1
  40. ## tests
  41. To run the tests update the `toml-test` submodule:
  42. git submodule update --init --recursive
  43. Then run the tests:
  44. python test/test.py
  45. [1]: https://github.com/toml-lang/toml
  46. [2]: https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md