toml

Python lib for TOML

https://github.com/uiri/toml

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

hacktoberfest hacktoberfest2020

Keywords from Contributors

forhumans python-requests humans requests templates cookies views apps closember pallets
Last synced: 9 months ago · JSON representation

Repository

Python lib for TOML

Basic Info
  • Host: GitHub
  • Owner: uiri
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 348 KB
Statistics
  • Stars: 1,133
  • Watchers: 19
  • Forks: 192
  • Open Issues: 134
  • Releases: 0
Topics
hacktoberfest hacktoberfest2020
Created over 13 years ago · Last pushed almost 2 years ago
Metadata Files
Readme Contributing License

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 ‮

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

All Time
  • Total Commits: 322
  • Total Committers: 58
  • Avg Commits per committer: 5.552
  • Development Distribution Score (DDS): 0.379
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email 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...

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
type: bug (52) component: decoder (41) syntax: strings (34) component: encoder (17) type: feature (12) syntax: arrays (10) type: task (8) syntax: inline table (5) needs triage (4) syntax: comments (4) resolution: noaction (2) syntax: key-value pairs (2) syntax: date/time (1) syntax: tables (1) user-customization (1)
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

  • Versions: 16
  • Dependent Packages: 2,821
  • Dependent Repositories: 127,705
  • Downloads: 74,219,327 Last month
  • Docker Downloads: 698,849,334
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Downloads: 0.0%
Docker downloads count: 0.0%
Average: 1.2%
Stargazers count: 2.7%
Forks count: 4.6%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.13: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 12
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 1.5%
Average: 3.0%
Stargazers count: 5.2%
Forks count: 5.3%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.15: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 8
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 3.6%
Average: 3.7%
Forks count: 5.5%
Stargazers count: 5.6%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.16: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 16
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 3.4%
Average: 3.8%
Forks count: 5.7%
Stargazers count: 6.1%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.18: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 3.8%
Forks count: 7.4%
Stargazers count: 8.0%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.18: py3-toml-pyc

Precompiled Python bytecode for py3-toml

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 3.8%
Forks count: 7.4%
Stargazers count: 8.0%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.14: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 3
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 4.0%
Stargazers count: 5.3%
Forks count: 5.3%
Dependent packages count: 5.5%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.11: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 2
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 4.4%
Stargazers count: 4.6%
Forks count: 4.8%
Dependent packages count: 8.1%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.17: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 14
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 2.9%
Average: 4.4%
Forks count: 7.2%
Stargazers count: 7.6%
Maintainers (1)
Last synced: 9 months ago
alpine-edge: py3-toml

Python3 library for TOML

  • Versions: 3
  • Dependent Packages: 5
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 1.4%
Average: 4.8%
Forks count: 8.5%
Stargazers count: 9.2%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.12: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 4.6%
Forks count: 4.8%
Average: 4.8%
Dependent packages count: 10.0%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.10: py3-toml

Python library for TOML (for python3)

  • Versions: 1
  • Dependent Packages: 8
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 4.1%
Forks count: 4.3%
Average: 5.1%
Dependent packages count: 11.8%
Maintainers (1)
Last synced: 9 months ago
conda-forge.org: toml
  • Versions: 6
  • Dependent Packages: 169
  • Dependent Repositories: 625
Rankings
Dependent packages count: 0.4%
Dependent repos count: 1.1%
Average: 6.8%
Stargazers count: 12.7%
Forks count: 13.2%
Last synced: 9 months ago
alpine-v3.10: py2-toml

Python library for TOML (for python2)

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 4.1%
Forks count: 4.3%
Average: 7.5%
Dependent packages count: 21.5%
Maintainers (1)
Last synced: 9 months ago
alpine-edge: py3-toml-pyc

Precompiled Python bytecode for py3-toml

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 8.1%
Forks count: 8.8%
Stargazers count: 9.6%
Dependent packages count: 14.1%
Maintainers (1)
Last synced: 9 months ago
proxy.golang.org: github.com/uiri/toml
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 9 months ago
alpine-v3.10: py-toml

Python library for TOML

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 4.1%
Forks count: 4.3%
Average: 9.5%
Dependent packages count: 29.6%
Maintainers (1)
Last synced: 9 months ago
anaconda.org: toml
  • Versions: 4
  • Dependent Packages: 22
  • Dependent Repositories: 625
Rankings
Dependent packages count: 1.5%
Dependent repos count: 6.4%
Average: 13.9%
Stargazers count: 23.7%
Forks count: 23.9%
Last synced: 9 months ago
formulae.brew.sh: python-toml

Python Library for TOML

  • Versions: 1
  • Dependent Packages: 8
  • Dependent Repositories: 0
  • Downloads: 465 Last month
Rankings
Forks count: 12.5%
Stargazers count: 16.7%
Dependent packages count: 19.0%
Average: 30.3%
Downloads: 50.8%
Dependent repos count: 52.3%
Last synced: 9 months ago
alpine-v3.19: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Last synced: 9 months ago
alpine-v3.21: py3-toml-pyc

Precompiled Python bytecode for py3-toml

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.22: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.20: py3-toml-pyc

Precompiled Python bytecode for py3-toml

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.22: py3-toml-pyc

Precompiled Python bytecode for py3-toml

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.20: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.21: py3-toml

Python3 library for TOML

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 9 months ago
alpine-v3.19: py3-toml-pyc

Precompiled Python bytecode for py3-toml

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 9 months ago

Dependencies

.github/workflows/ci.yaml actions
  • actions/checkout v4 composite
  • actions/setup-go v4 composite
setup.py pypi