# glom
*Restructuring data, the Python way*
<a href="https://pypi.org/project/glom/"><img src="https://img.shields.io/pypi/v/glom.svg"></a>
<a href="https://calver.org/"><img src="https://img.shields.io/badge/calver-YY.MM.MICRO-22bfda.svg"></a>
<img width="30%" align="right" src="https://raw.githubusercontent.com/mahmoud/glom/master/docs/_static/comet.png">
Real applications have real data, and real data nests. Objects inside
of objects inside of lists of objects.
glom is a new and powerful way to handle real-world data, featuring:
* Path-based access for nested data structures
* Readable, meaningful error messages
* Declarative data transformation, using lightweight, Pythonic specifications
* Built-in data exploration and debugging features
All of that and more, available as a [fully-documented][rtd],
pure-Python package, tested on Python 3.7+, as well as
PyPy3. Installation is as easy as:
```
pip install glom
```
And when you install glom, you also get [the `glom` command-line
interface][cli_rtd], letting you experiment at the console, but never limiting
you to shell scripts:
```
Usage: glom [FLAGS] [spec [target]]
Command-line interface to the glom library, providing nested data access and data
restructuring with the power of Python.
Flags:
--help / -h show this help message and exit
--target-file TARGET_FILE path to target data source (optional)
--target-format TARGET_FORMAT
format of the source data (json, python, toml,
or yaml) (defaults to 'json')
--spec-file SPEC_FILE path to glom spec definition (optional)
--spec-format SPEC_FORMAT format of the glom spec definition (json, python,
python-full) (defaults to 'python')
--indent INDENT number of spaces to indent the result, 0 to disable
pretty-printing (defaults to 2)
--debug interactively debug any errors that come up
--inspect interactively explore the data
```
Anything you can do at the command line readily translates to Python
code, so you've always got a path forward when complexity starts to
ramp up.
## Examples
#### Without glom
```python
>>> data = {'a': {'b': {'c': 'd'}}}
>>> data['a']['b']['c']
'd'
>>> data2 = {'a': {'b': None}}
>>> data2['a']['b']['c']
Traceback (most recent call last):
...
TypeError: 'NoneType' object is not subscriptable
```
#### With glom
```python
>>> glom(data, 'a.b.c')
'd'
>>> glom(data2, 'a.b.c')
Traceback (most recent call last):
...
PathAccessError: could not access 'c', index 2 in path Path('a', 'b', 'c'), got error: ...
```
## Learn more
<img width="30%" align="right" src="https://raw.githubusercontent.com/mahmoud/glom/master/docs/_static/comet_multi.png">
If all this seems interesting, continue exploring glom below:
* [glom Tutorial][tutorial]
* [Full API documentation at Read the Docs][rtd]
* [Original announcement blog post (2018-05-09)][glom_announce]
* [Frequently Asked Questions][faq]
* [PyCon 2018 Lightning Talk (2018-05-11)][pycon_talk]
All of the links above are overflowing with examples, but should you
find anything about the docs, or glom itself, lacking, [please submit
an issue][gh_issues]!
[rtd]: https://glom.readthedocs.io
[cli_rtd]: http://glom.readthedocs.io/en/latest/cli.html
[tutorial]: https://glom.readthedocs.io/en/latest/tutorial.html
[faq]: https://glom.readthedocs.io/en/latest/faq.html
[glom_announce]: https://sedimental.org/glom_restructured_data.html
[gh_issues]: https://github.com/mahmoud/glom/issues/
[pycon_talk]: https://www.youtube.com/watch?v=bTAFl8P2DkE&t=18m07s
In the meantime, just remember: When you've got nested data, glom it! ☄️
Raw data
{
"_id": null,
"home_page": "https://github.com/mahmoud/glom",
"name": "glom",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Mahmoud Hashemi and Kurt Rose",
"author_email": "mahmoud@hatnote.com",
"download_url": "https://files.pythonhosted.org/packages/ab/f8/9caa4312149741e7870cdce88c7d6388b0b0d076e4107303ed1417877abf/glom-23.5.0.tar.gz",
"platform": "any",
"description": "# glom\n\n*Restructuring data, the Python way*\n\n<a href=\"https://pypi.org/project/glom/\"><img src=\"https://img.shields.io/pypi/v/glom.svg\"></a>\n<a href=\"https://calver.org/\"><img src=\"https://img.shields.io/badge/calver-YY.MM.MICRO-22bfda.svg\"></a>\n\n<img width=\"30%\" align=\"right\" src=\"https://raw.githubusercontent.com/mahmoud/glom/master/docs/_static/comet.png\">\n\nReal applications have real data, and real data nests. Objects inside\nof objects inside of lists of objects.\n\nglom is a new and powerful way to handle real-world data, featuring:\n\n* Path-based access for nested data structures\n* Readable, meaningful error messages\n* Declarative data transformation, using lightweight, Pythonic specifications\n* Built-in data exploration and debugging features\n\nAll of that and more, available as a [fully-documented][rtd],\npure-Python package, tested on Python 3.7+, as well as\nPyPy3. Installation is as easy as:\n\n```\n pip install glom\n```\n\nAnd when you install glom, you also get [the `glom` command-line\ninterface][cli_rtd], letting you experiment at the console, but never limiting\nyou to shell scripts:\n\n```\nUsage: glom [FLAGS] [spec [target]]\n\nCommand-line interface to the glom library, providing nested data access and data\nrestructuring with the power of Python.\n\nFlags:\n\n --help / -h show this help message and exit\n --target-file TARGET_FILE path to target data source (optional)\n --target-format TARGET_FORMAT\n format of the source data (json, python, toml,\n or yaml) (defaults to 'json')\n --spec-file SPEC_FILE path to glom spec definition (optional)\n --spec-format SPEC_FORMAT format of the glom spec definition (json, python,\n python-full) (defaults to 'python')\n --indent INDENT number of spaces to indent the result, 0 to disable\n pretty-printing (defaults to 2)\n --debug interactively debug any errors that come up\n --inspect interactively explore the data\n\n```\n\nAnything you can do at the command line readily translates to Python\ncode, so you've always got a path forward when complexity starts to\nramp up.\n\n\n## Examples\n#### Without glom\n```python\n>>> data = {'a': {'b': {'c': 'd'}}}\n>>> data['a']['b']['c']\n'd'\n>>> data2 = {'a': {'b': None}}\n>>> data2['a']['b']['c']\nTraceback (most recent call last):\n...\nTypeError: 'NoneType' object is not subscriptable\n```\n\n#### With glom\n```python\n>>> glom(data, 'a.b.c')\n'd'\n>>> glom(data2, 'a.b.c')\nTraceback (most recent call last):\n...\nPathAccessError: could not access 'c', index 2 in path Path('a', 'b', 'c'), got error: ...\n```\n\n## Learn more\n\n<img width=\"30%\" align=\"right\" src=\"https://raw.githubusercontent.com/mahmoud/glom/master/docs/_static/comet_multi.png\">\n\nIf all this seems interesting, continue exploring glom below:\n\n* [glom Tutorial][tutorial]\n* [Full API documentation at Read the Docs][rtd]\n* [Original announcement blog post (2018-05-09)][glom_announce]\n* [Frequently Asked Questions][faq]\n* [PyCon 2018 Lightning Talk (2018-05-11)][pycon_talk]\n\nAll of the links above are overflowing with examples, but should you\nfind anything about the docs, or glom itself, lacking, [please submit\nan issue][gh_issues]!\n\n[rtd]: https://glom.readthedocs.io\n[cli_rtd]: http://glom.readthedocs.io/en/latest/cli.html\n[tutorial]: https://glom.readthedocs.io/en/latest/tutorial.html\n[faq]: https://glom.readthedocs.io/en/latest/faq.html\n[glom_announce]: https://sedimental.org/glom_restructured_data.html\n[gh_issues]: https://github.com/mahmoud/glom/issues/\n[pycon_talk]: https://www.youtube.com/watch?v=bTAFl8P2DkE&t=18m07s\n\nIn the meantime, just remember: When you've got nested data, glom it! \u2604\ufe0f\n",
"bugtrack_url": null,
"license": "",
"summary": "A declarative object transformer and formatter, for conglomerating nested data.",
"version": "23.5.0",
"project_urls": {
"Documentation": "https://glom.readthedocs.io/en/latest/",
"Homepage": "https://github.com/mahmoud/glom"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "46239ee0ae745acb65d655bb11240722f98495dcecf543e9ff3b1d21cccea252",
"md5": "25bc57d11e50a9507a03b34e43dae061",
"sha256": "fe4e9be4dc93c11a99f8277042e4bee95419c02cda4b969f504508b0a1aa6a66"
},
"downloads": -1,
"filename": "glom-23.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "25bc57d11e50a9507a03b34e43dae061",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 102741,
"upload_time": "2023-11-27T00:23:41",
"upload_time_iso_8601": "2023-11-27T00:23:41.588370Z",
"url": "https://files.pythonhosted.org/packages/46/23/9ee0ae745acb65d655bb11240722f98495dcecf543e9ff3b1d21cccea252/glom-23.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "abf89caa4312149741e7870cdce88c7d6388b0b0d076e4107303ed1417877abf",
"md5": "e6925074e93b573408e3e38b19a58f3c",
"sha256": "06af5e3486aacc59382ba34e53ebeabd7a9345d78f7dbcbee26f03baa4b83bac"
},
"downloads": -1,
"filename": "glom-23.5.0.tar.gz",
"has_sig": false,
"md5_digest": "e6925074e93b573408e3e38b19a58f3c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 196743,
"upload_time": "2023-11-27T00:23:43",
"upload_time_iso_8601": "2023-11-27T00:23:43.679465Z",
"url": "https://files.pythonhosted.org/packages/ab/f8/9caa4312149741e7870cdce88c7d6388b0b0d076e4107303ed1417877abf/glom-23.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-27 00:23:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mahmoud",
"github_project": "glom",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "glom"
}