Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
3 of 58 committers (5.2%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Python lib for TOML
Basic Info
Statistics
- Stars: 1,133
- Watchers: 19
- Forks: 192
- Open Issues: 134
- Releases: 0
Topics
Metadata Files
README.rst
****
TOML
****
.. image:: https://img.shields.io/pypi/v/toml
:target: https://pypi.org/project/toml/
.. image:: https://travis-ci.org/uiri/toml.svg?branch=master
:target: https://travis-ci.org/uiri/toml
.. image:: https://img.shields.io/pypi/pyversions/toml.svg
:target: https://pypi.org/project/toml/
A Python library for parsing and creating `TOML `_.
The module passes `the TOML test suite `_.
See also:
* `The TOML Standard `_
* `The currently supported TOML specification `_
Installation
============
To install the latest release on `PyPI `_,
simply run:
::
pip install toml
Or to install the latest development version, run:
::
git clone https://github.com/uiri/toml.git
cd toml
python setup.py install
Quick Tutorial
==============
*toml.loads* takes in a string containing standard TOML-formatted data and
returns a dictionary containing the parsed data.
.. code:: pycon
>>> import toml
>>> toml_string = """
... # This is a TOML document.
...
... title = "TOML Example"
...
... [owner]
... name = "Tom Preston-Werner"
... dob = 1979-05-27T07:32:00-08:00 # First class dates
...
... [database]
... server = "192.168.1.1"
... ports = [ 8001, 8001, 8002 ]
... connection_max = 5000
... enabled = true
...
... [servers]
...
... # Indentation (tabs and/or spaces) is allowed but not required
... [servers.alpha]
... ip = "10.0.0.1"
... dc = "eqdc10"
...
... [servers.beta]
... ip = "10.0.0.2"
... dc = "eqdc10"
...
... [clients]
... data = [ ["gamma", "delta"], [1, 2] ]
...
... # Line breaks are OK when inside arrays
... hosts = [
... "alpha",
... "omega"
... ]
... """
>>> parsed_toml = toml.loads(toml_string)
*toml.dumps* takes a dictionary and returns a string containing the
corresponding TOML-formatted data.
.. code:: pycon
>>> new_toml_string = toml.dumps(parsed_toml)
>>> print(new_toml_string)
title = "TOML Example"
[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00Z
[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002,]
connection_max = 5000
enabled = true
[clients]
data = [ [ "gamma", "delta",], [ 1, 2,],]
hosts = [ "alpha", "omega",]
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"
[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"
*toml.dump* takes a dictionary and a file descriptor and returns a string containing the
corresponding TOML-formatted data.
.. code:: pycon
>>> with open('new_toml_file.toml', 'w') as f:
... new_toml_string = toml.dump(parsed_toml, f)
>>> print(new_toml_string)
title = "TOML Example"
[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00Z
[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002,]
connection_max = 5000
enabled = true
[clients]
data = [ [ "gamma", "delta",], [ 1, 2,],]
hosts = [ "alpha", "omega",]
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"
[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"
For more functions, view the API Reference below.
Note
----
For Numpy users, by default the data types ``np.floatX`` will not be translated to floats by toml, but will instead be encoded as strings. To get around this, specify the ``TomlNumpyEncoder`` when saving your data.
.. code:: pycon
>>> import toml
>>> import numpy as np
>>> a = np.arange(0, 10, dtype=np.double)
>>> output = {'a': a}
>>> toml.dumps(output)
'a = [ "0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0",]\n'
>>> toml.dumps(output, encoder=toml.TomlNumpyEncoder())
'a = [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0,]\n'
API Reference
=============
``toml.load(f, _dict=dict)``
Parse a file or a list of files as TOML and return a dictionary.
:Args:
* ``f``: A path to a file, list of filepaths (to be read into single
object) or a file descriptor
* ``_dict``: The class of the dictionary object to be returned
:Returns:
A dictionary (or object ``_dict``) containing parsed TOML data
:Raises:
* ``TypeError``: When ``f`` is an invalid type or is a list containing
invalid types
* ``TomlDecodeError``: When an error occurs while decoding the file(s)
``toml.loads(s, _dict=dict)``
Parse a TOML-formatted string to a dictionary.
:Args:
* ``s``: The TOML-formatted string to be parsed
* ``_dict``: Specifies the class of the returned toml dictionary
:Returns:
A dictionary (or object ``_dict``) containing parsed TOML data
:Raises:
* ``TypeError``: When a non-string object is passed
* ``TomlDecodeError``: When an error occurs while decoding the
TOML-formatted string
``toml.dump(o, f, encoder=None)``
Write a dictionary to a file containing TOML-formatted data
:Args:
* ``o``: An object to be converted into TOML
* ``f``: A File descriptor where the TOML-formatted output should be stored
* ``encoder``: An instance of ``TomlEncoder`` (or subclass) for encoding the object. If ``None``, will default to ``TomlEncoder``
:Returns:
A string containing the TOML-formatted data corresponding to object ``o``
:Raises:
* ``TypeError``: When anything other than file descriptor is passed
``toml.dumps(o, encoder=None)``
Create a TOML-formatted string from an input object
:Args:
* ``o``: An object to be converted into TOML
* ``encoder``: An instance of ``TomlEncoder`` (or subclass) for encoding the object. If ``None``, will default to ``TomlEncoder``
:Returns:
A string containing the TOML-formatted data corresponding to object ``o``
Licensing
=========
This project is released under the terms of the MIT Open Source License. View
*LICENSE.txt* for more information.
Owner
- Name: Will Pearson
- Login: uiri
- Kind: user
- Location: Seattle, WA
- Website: https://xqz.ca/
- Repositories: 64
- Profile: https://github.com/uiri
GitHub Events
Total
- Issues event: 7
- Watch event: 46
- Issue comment event: 6
- Pull request event: 2
- Fork event: 3
Last Year
- Issues event: 7
- Watch event: 46
- Issue comment event: 6
- Pull request event: 2
- Fork event: 3
Committers
Last synced: 10 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Uiri | u****0@g****m | 200 |
| Samuel Vasko | s****o@g****m | 14 |
| Jon Dufresne | j****e@g****m | 11 |
| Valentin Lorentz | p****t@p****t | 9 |
| Julien Enselme | j****e@c****r | 8 |
| Tsuyoshi Hombashi | t****i@g****m | 5 |
| x10an14 | x****4@h****m | 4 |
| Matthew Raspberry | 3****y | 4 |
| tharvik | t****k | 4 |
| Nate Prewitt | N****t@g****m | 3 |
| Martin Tournoij | m****n@a****t | 3 |
| César Rojas | f****r@1****0 | 3 |
| Jack Evans | j****k@e****e | 2 |
| Bohdan | w****a@g****m | 2 |
| Nicolas Evrard | n****e@o****g | 2 |
| Nik Nyby | n****y@c****u | 2 |
| PrajwalM2212 | p****h@g****m | 2 |
| Ryan Hiebert | r****n@r****m | 2 |
| pdedmon | p****n@j****m | 2 |
| zed | i****r@g****m | 2 |
| Chris Kuehl | c****l@c****e | 1 |
| Benjamin Peterson | b****n@p****g | 1 |
| Andrew Plotkin | z****b@e****m | 1 |
| Andrew Gallant | j****m@g****m | 1 |
| Amjith Ramanujam | a****r@g****m | 1 |
| Abraham Murciano | a****o@g****m | 1 |
| Matthew Thomas | m****2@a****u | 1 |
| Miles Lucas | m****s@i****u | 1 |
| Dave Poulter | h****o@d****t | 1 |
| nabbisen | n@b****m | 1 |
| and 28 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 107
- Total pull requests: 26
- Average time to close issues: 8 months
- Average time to close pull requests: 10 months
- Total issue authors: 102
- Total pull request authors: 20
- Average comments per issue: 1.95
- Average comments per pull request: 1.46
- Merged pull requests: 9
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 4
- Pull requests: 2
- Average time to close issues: 7 days
- Average time to close pull requests: about 21 hours
- Issue authors: 4
- Pull request authors: 1
- Average comments per issue: 1.0
- Average comments per pull request: 1.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- programmerjake (2)
- goodboy (2)
- seperman (2)
- simplesteph (2)
- yihengli (2)
- altendky (1)
- ltxlouis (1)
- bj0 (1)
- xfrost11 (1)
- dwt (1)
- vors (1)
- guyskk (1)
- vlandeiro (1)
- pwwang (1)
- hroncok (1)
Pull Request Authors
- arp242 (3)
- AwaitFuture (2)
- leoluecken (2)
- KosukeMizuno (2)
- rgacote (1)
- x10an14 (1)
- huangsam (1)
- JamesParrott (1)
- comodoro (1)
- sethcall (1)
- AlexanderFromEarth (1)
- behnammodi (1)
- jeremysanders (1)
- icemac (1)
- abrahammurciano (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 27
-
Total downloads:
- homebrew 465 last-month
- pypi 74,219,327 last-month
- Total docker downloads: 698,849,334
-
Total dependent packages: 3,090
(may contain duplicates) -
Total dependent repositories: 128,955
(may contain duplicates) - Total versions: 53
- Total maintainers: 2
pypi.org: toml
Python Library for Tom's Obvious, Minimal Language
- Homepage: https://github.com/uiri/toml
- Documentation: https://toml.readthedocs.io/
- License: MIT
-
Latest release: 0.10.2
published over 5 years ago
Rankings
Maintainers (1)
alpine-v3.13: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r0
published over 5 years ago
Rankings
Maintainers (1)
alpine-v3.15: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r2
published about 5 years ago
Rankings
Maintainers (1)
alpine-v3.16: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r3
published over 4 years ago
Rankings
Maintainers (1)
alpine-v3.18: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r6
published about 3 years ago
Rankings
Maintainers (1)
alpine-v3.18: py3-toml-pyc
Precompiled Python bytecode for py3-toml
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r6
published about 3 years ago
Rankings
Maintainers (1)
alpine-v3.14: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r2
published about 5 years ago
Rankings
Maintainers (1)
alpine-v3.11: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.0-r3
published over 6 years ago
Rankings
Maintainers (1)
alpine-v3.17: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r4
published almost 4 years ago
Rankings
Maintainers (1)
alpine-edge: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r7
published about 2 years ago
Rankings
Maintainers (1)
alpine-v3.12: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.1-r0
published about 6 years ago
Rankings
Maintainers (1)
alpine-v3.10: py3-toml
Python library for TOML (for python3)
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.0-r1
published about 7 years ago
Rankings
Maintainers (1)
conda-forge.org: toml
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2
published over 5 years ago
Rankings
alpine-v3.10: py2-toml
Python library for TOML (for python2)
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.0-r1
published about 7 years ago
Rankings
Maintainers (1)
alpine-edge: py3-toml-pyc
Precompiled Python bytecode for py3-toml
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r7
published about 2 years ago
Rankings
Maintainers (1)
proxy.golang.org: github.com/uiri/toml
- Documentation: https://pkg.go.dev/github.com/uiri/toml#section-documentation
- License: mit
-
Latest release: v0.6.5
published over 13 years ago
Rankings
alpine-v3.10: py-toml
Python library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.0-r1
published about 7 years ago
Rankings
Maintainers (1)
anaconda.org: toml
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2
published about 5 years ago
Rankings
formulae.brew.sh: python-toml
Python Library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
- Status: removed
-
Latest release: 0.10.2
published almost 3 years ago
Rankings
alpine-v3.19: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r6
published about 3 years ago
Rankings
alpine-v3.21: py3-toml-pyc
Precompiled Python bytecode for py3-toml
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r7
published about 2 years ago
Rankings
Maintainers (1)
alpine-v3.22: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r7
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.20: py3-toml-pyc
Precompiled Python bytecode for py3-toml
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r7
published about 2 years ago
Rankings
Maintainers (1)
alpine-v3.22: py3-toml-pyc
Precompiled Python bytecode for py3-toml
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r7
published over 1 year ago
Rankings
Maintainers (1)
alpine-v3.20: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r7
published about 2 years ago
Rankings
Maintainers (1)
alpine-v3.21: py3-toml
Python3 library for TOML
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r7
published about 2 years ago
Rankings
Maintainers (1)
alpine-v3.19: py3-toml-pyc
Precompiled Python bytecode for py3-toml
- Homepage: https://github.com/uiri/toml
- License: MIT
-
Latest release: 0.10.2-r6
published about 3 years ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v4 composite
- actions/setup-go v4 composite