CLI tool
mahmoud/glom avatar
mahmoud/glom

glom turns a None halfway down a nested dict into a PathAccessError that names the exact step

☄️ Python's nested data operator (and CLI), for all your declarative restructuring needs. Got data? Glom it! ☄️

2,169 stars100 forksPythonLicense varies

At a glance

What is it?
mahmoud/glom is a pure-Python package and command-line tool for reading and restructuring nested data with path strings and declarative specs. This review covers the error behavior, the CLI, the optional YAML and TOML extras and the dependencies you inherit.
Who is it for?
Use glom when your code reaches into JSON, API responses or object graphs where a missing key halfway down is normal and you want the failure to say where. Skip it for flat data, where plain indexing is shorter.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 79 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • mahmoud/glom2,169 ★ · +0
Star history
Repository2026-10-122026-11-25
mahmoud/glom2.2k2.2k

0 Stars in the last 44 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

A dotted path string replaces the chain of square brackets

Plain Python reaches into nested data by chaining subscripts. With data = {'a': {'b': {'c': 'd'}}}, the expression data['a']['b']['c'] returns 'd'. glom collapses that into one call:

python
>>> glom(data, 'a.b.c')
'd'

The argument after the data is a spec, and the simplest spec is a string of keys joined by dots. The project describes the problem as real applications holding real data that nests: objects inside of objects inside of lists of objects. The path string is the smallest answer to that, and everything else in the package grows out of the same idea of a spec applied to a target.

The first call shows only the easy case. The reason to reach for the library is what happens when the data does not match the path, and that is where the second example in the repository front page earns its place.

PathAccessError reports which step of the path failed and what Python said

Without glom, a None in the middle of the structure produces an error that points at nothing in particular:

python
>>> data2 = {'a': {'b': None}}
>>> data2['a']['b']['c']
Traceback (most recent call last):
...
TypeError: 'NoneType' object is not subscriptable

The traceback says some value was None. It does not say which of the three subscripts hit it, and with a longer chain the line number does not narrow it down either. The same lookup through glom raises a different exception:

python
>>> 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: ...

The message names the key that failed ('c'), its position in the path (index 2), the full Path object and the underlying error. Readable error messages are one of four features the project lists, and this is the concrete case for it. The cost is a new exception type to catch: code that used to handle TypeError or KeyError from a lookup now sees PathAccessError from glom.

Installing the package also installs a glom command with a json default

A single pip command gets the library:

code
pip install glom

That install also registers a console script, glom, which setup.py maps to glom.cli:console_main. The usage line is:

code
glom [FLAGS] [spec [target]]

The flags visible in the project's help output are --help or -h, --target-file TARGET_FILE for the path to the data source, --target-format TARGET_FORMAT, --spec-file SPEC_FILE and --spec-format. The target format accepts json, python, toml or yaml and defaults to json. Because json is the default, a YAML or TOML file needs its format named explicitly.

The help text in the repository front page is cut off after the spec-format flag, so any flags beyond those listed here are documented only in the CLI page on Read the Docs. The command-line tool exists for experimenting at the console, and the project says anything done at the command line translates to Python code, so the console is a way to test a spec before it goes into a script.

YAML and TOML support are extras, and tomli only matters before Python 3.11

The base install does not pull in a YAML or TOML parser. setup.py defines extras_require entries named toml and yaml. The toml extra installs tomli, and only when python_version is below 3.11. The yaml extra installs PyYAML.

This connects directly to the CLI flag above. --target-format accepts toml and yaml, but a fresh pip install glom has no PyYAML on the path, and the yaml parser arrives only with the extra. The project's front page does not show the pip command for the extras, so the extra names in setup.py are the reference.

There is also a test extra: pytest at version 6.2.5 or newer, PyYAML, tomli for older Pythons, and coverage. It is only needed if you want to run the test suite from a checkout. The package list in setup.py includes glom and glom.test, so the tests ship inside the distribution.

Three runtime dependencies come with every install

pure-Python does not mean dependency-free. The install_requires line in setup.py lists three packages: boltons at version 19.3.0 or newer, attrs with no version floor, and face at version 20.1.1 or newer. The pinned requirements file shows boltons arriving both directly and via face.

The pinned file is a different thing from the install requirements. requirements.txt is generated by pip-compile from requirements.in, using Python 3.7, and it fixes versions such as attrs 24.2.0, boltons 24.1.0, face 24.0.0, pytest 7.4.4 and tox 4.8.0. Those pins describe the development and test environment. They do not constrain what pip resolves when you install glom into your own project.

For an application with a tight dependency budget, the practical question is whether attrs, boltons and face are already in the tree. If none of them are, glom adds three packages.

Python 3.7 through 3.14 and PyPy3 are the tested range

The README states that glom is tested on Python 3.7 to 3.14 and on PyPy3. The window runs from 3.7 to 3.14, so a project on an old Python and a project on a new one are both covered.

The tox.ini, pytest.ini and codecov.yml files in the top-level listing show that tests run through tox and that coverage is reported through codecov. The package carries a platforms='any' setting, so no operating system is excluded in the metadata.

The project uses calendar versioning, linked from the front page to calver.org. For what changed between versions, CHANGELOG.md in the repository is the place to look.

No GitHub releases and a NOASSERTION license field leave two things to check yourself

The repository has no GitHub releases. Release history is therefore not visible from the releases page, and the CHANGELOG.md file and the PyPI project page are the sources to check. The last push was on 8 September 2026 and the repository is not archived.

GitHub reports the license as NOASSERTION. The top-level listing does include a LICENSE file and setup.py sets license_files to it, so a license text exists. GitHub simply did not classify it. Read the file before shipping glom inside a product, instead of relying on the repository badge.

The front page also stops short of showing the spec language beyond path strings. The tutorial, the full API documentation and the FAQ live on Read the Docs, and there is a browser playground called glompad for trying specs without installing anything. Anyone evaluating glom for data reshaping rather than plain access will spend most of the evaluation in those documents, not in the repository.

Editorial conclusion

Use glom when your code reaches into JSON, API responses or object graphs where a missing key halfway down is normal and you want the failure to say where. Skip it for flat data, where plain indexing is shorter. Before adopting, read the spec documentation on Read the Docs, because the repository front page only demonstrates path strings, and check the LICENSE file, since GitHub reports the license as NOASSERTION.

Frequently asked questions

How do I install glom?

Run pip install glom. The install also gives you the glom command-line tool, which is registered as a console script.

Which Python versions does glom support?

The project says glom is tested on Python 3.7 to 3.14 and on PyPy3. It is a pure-Python package.

What error does glom raise when a path does not exist?

It raises a PathAccessError that names the key that could not be accessed, its index in the path and the full Path object. Plain subscripting on a None value gives only a TypeError.

Can the glom command line read YAML or TOML files?

The --target-format flag accepts json, python, toml or yaml and defaults to json. setup.py defines optional yaml and toml extras for the parsers.

Official sources

  1. Issues
  2. mahmoud/glom on GitHub
  3. Project website
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/mahmoud-glom.svg)](https://hysenlabs.com/projects/mahmoud-glom)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/mahmoud-glom.svg)](https://hysenlabs.com/projects/mahmoud-glom)

Was this useful?