{"library":"glom","title":"glom","description":"glom is a declarative object transformer and formatter for Python, designed to simplify working with nested data structures. It provides path-based access, powerful data transformation using Pythonic specifications, meaningful error messages, and built-in debugging features. The library follows a CalVer versioning scheme (YY.MM.MICRO) and is actively maintained, with version 25.12.0 being a recent release that includes maintenance updates and test fixes for newer Python versions.","status":"active","version":"25.12.0","language":"en","source_language":"en","source_url":"https://github.com/mahmoud/glom","tags":["data transformation","nested data","declarative","object access","data restructuring"],"install":[{"cmd":"pip install glom","lang":"bash","label":"Install glom"}],"dependencies":[{"reason":"Required for TOML support in the CLI for Python versions older than 3.11.","package":"toml","optional":true}],"imports":[{"symbol":"glom","correct":"from glom import glom"},{"note":"T is a specifier for object-oriented access and method calls.","symbol":"T","correct":"from glom import T"},{"note":"Coalesce provides default values for potentially missing or error-raising paths, similar to SQL's COALESCE.","symbol":"Coalesce","correct":"from glom import Coalesce"},{"note":"The 'Call' specifier is deprecated in favor of 'Invoke' since glom 19.10.0, which offers a fuller-featured API for invoking callables.","wrong":"from glom import Call","symbol":"Invoke","correct":"from glom import Invoke"},{"note":"Explicitly using Path can avoid ambiguities, especially with wildcard characters.","symbol":"Path","correct":"from glom import Path"},{"note":"S provides access to the glom scope for additional state management during transformations.","symbol":"S","correct":"from glom import S"}],"quickstart":{"code":"from glom import glom, T\n\ndata = {\n    'user': {\n        'profile': {\n            'name': 'Alice',\n            'email': 'alice@example.com'\n        },\n        'preferences': {\n            'theme': 'dark'\n        }\n    },\n    'messages': [\n        {'id': 1, 'text': 'Hello'},\n        {'id': 2, 'text': 'World'}\n    ]\n}\n\n# Extract a deeply nested value\nuser_name = glom(data, 'user.profile.name')\nprint(f\"User Name: {user_name}\")\n\n# Transform data to a new structure\nuser_summary_spec = {\n    'name': 'user.profile.name',\n    'contact_email': 'user.profile.email',\n    'first_message': ('messages.0.text', str.upper)\n}\n\nuser_summary = glom(data, user_summary_spec)\nprint(f\"User Summary: {user_summary}\")\n\n# Using T for more complex access or method calls\nmessage_ids = glom(data, ('messages', [T['id']]))\nprint(f\"Message IDs: {message_ids}\")","lang":"python","description":"This quickstart demonstrates basic deep access to nested data, transformation into a new dictionary structure, and using the `T` specifier for iterating and extracting specific fields from a list of dictionaries."},"warnings":[{"fix":"If you experience issues, you can temporarily revert the behavior by setting `glom.core.PATH_STAR = False`. The recommended fix is to explicitly use the `Path` specifier, e.g., `Path('a', '*')` instead of `'a.*'`.","message":"The `*` and `**` wildcard behavior for path access became enabled by default in glom 23.1.0. This can break existing specs that used these characters as literal keys.","severity":"breaking","affected_versions":">=23.1.0"},{"fix":"Replace `Call` with `Invoke` in your specs. For calling methods on the target, consider using the `T` object instead.","message":"The `Call` specifier is deprecated in favor of the more comprehensive `Invoke` specifier, introduced in glom 19.10.0. `Invoke` offers a richer API for invoking callables within your specs.","severity":"deprecated","affected_versions":">=19.10.0"},{"fix":"Rely only on documented `glom` functions, classes, and specifiers. If you find undocumented functionality that seems useful, consider filing an issue or pull request.","message":"Not all internal components of the `glom` package are part of its public API. Functionality not explicitly documented in the top-level `glom` package or its official documentation may change or disappear without notice.","severity":"gotcha","affected_versions":"All"},{"fix":"Use the `Coalesce` specifier or the `default` and `skip_exc` kwargs in the `glom()` function to gracefully handle missing data or potential errors. `Coalesce` catches exceptions internally and proceeds to the next spec.","message":"If `glom()` is called without `default` and `skip_exc` parameters, it will raise exceptions on path access failures (e.g., `PathAccessError` for missing keys/attributes).","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure your project runs on Python 3.7 or newer to use glom versions 23.3.0 and above.","message":"Official support for Python 2 and Python 3.6 was dropped in glom 23.3.0, and pre-Python 3.7 syntax was removed in 24.11.0.","severity":"breaking","affected_versions":">=23.3.0"}],"env_vars":null,"last_verified":"2026-04-06T00:00:00.000Z","next_check":"2026-07-05T00:00:00.000Z"}