{"id":4827,"library":"types-jmespath","title":"Typing Stubs for JMESPath","description":"types-jmespath is a type stub package that provides static type annotations for the `jmespath` library. It is part of the Typeshed project, the central repository for Python type stubs, and is automatically released to PyPI (up to once a day). This package helps type checkers like MyPy and Pyright understand the types used in `jmespath` expressions, improving code quality and maintainability. Its versioning aims to align with `jmespath==1.1.*`, ensuring compatibility.","status":"active","version":"1.1.0.20260408","language":"en","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","jmespath","typeshed","static analysis"],"install":[{"cmd":"pip install types-jmespath","lang":"bash","label":"Install types-jmespath"},{"cmd":"pip install jmespath types-jmespath","lang":"bash","label":"Install JMESPath and its stubs"}],"dependencies":[{"reason":"Provides the core runtime functionality for which these type stubs are generated. This package only contains type annotations, not the JMESPath implementation itself.","package":"jmespath","optional":false}],"imports":[{"note":"This stub package provides type annotations for the `jmespath` library. You do not import directly from `types_jmespath`. Instead, you import from `jmespath`, and type checkers will automatically use the installed stubs.","symbol":"search","correct":"from jmespath import search"}],"quickstart":{"code":"import jmespath\nfrom typing import Any, Dict, List\n\ndata: Dict[str, Any] = {\n    \"store\": {\n        \"book\": [\n            {\"category\": \"reference\", \"author\": \"Nigel Rees\", \"title\": \"Sayings of the Century\", \"price\": 8.95},\n            {\"category\": \"fiction\", \"author\": \"Evelyn Waugh\", \"title\": \"Sword of Honour\", \"price\": 12.99}\n        ],\n        \"bicycle\": {\"color\": \"red\", \"price\": 19.95}\n    }\n}\n\n# Example 1: Simple retrieval\ntitle: Any = jmespath.search(\"store.book[0].title\", data)\nprint(f\"Title: {title}\")\n\n# Example 2: Projection to get all authors\nauthors: List[str] = jmespath.search(\"store.book[*].author\", data)\nprint(f\"Authors: {authors}\")\n\n# Example 3: Filtering based on a condition\nfiction_books: List[Dict[str, Any]] = jmespath.search(\"store.book[?category=='fiction']\", data)\nprint(f\"Fiction books: {fiction_books}\")\n\n# With types-jmespath installed, a type checker (like mypy or pyright)\n# would utilize these stubs to perform static analysis,\n# ensuring that `jmespath.search` calls conform to its expected signature\n# and that return types are handled correctly based on the JMESPath expression.","lang":"python","description":"This quickstart demonstrates basic usage of the `jmespath` library. When `types-jmespath` is installed alongside `jmespath`, type checkers will use the provided stubs to validate the type correctness of your `jmespath` operations without altering runtime behavior."},"warnings":[{"fix":"Ensure your installed `jmespath` version is compatible with the `types-jmespath` version (e.g., `jmespath~=1.1.0` and `types-jmespath~=1.1.0`). You can check the stub's target version on PyPI or Typeshed's statistics page.","message":"The `types-jmespath` package aims to provide accurate annotations for `jmespath==1.1.*`. Using a `jmespath` version outside this range, or significantly older/newer than the stub version, may lead to incorrect type checking results or errors. It is recommended to keep the stub version aligned with your `jmespath` runtime version.","severity":"gotcha","affected_versions":"<1.1.0 or >1.1.* of jmespath, when used with current stubs"},{"fix":"Always install the actual `jmespath` library (e.g., `pip install jmespath`) in addition to `types-jmespath` if you intend to use `jmespath` functionality at runtime.","message":"`types-jmespath` is a stub-only package and does not contain any runtime code. Installing it does not provide the `jmespath` functionality; you must install the `jmespath` library separately for your application to run. Its sole purpose is to provide type hints for static analysis by type checkers.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When contributing fixes or reporting issues, open a pull request or issue directly on the `python/typeshed` GitHub repository.","message":"Issues or inaccuracies found within the `types-jmespath` annotations should be reported to the `typeshed` GitHub repository, not the `jmespath` project itself. The `typeshed` project is responsible for maintaining these third-party stubs.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}