{"id":1764,"library":"types-six","title":"Typing Stubs for six","description":"This package provides typing stubs for the `six` library, enabling static type checking for code that uses `six`. It is part of the community-maintained Typeshed project, which regularly releases updated stubs for third-party packages. The current version, 1.17.0.20260408, aims for compatibility with `six==1.17.*` and is designed for modern Python 3 environments.","status":"active","version":"1.17.0.20260408","language":"en","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","type-checking","six","python2-compatibility","typeshed"],"install":[{"cmd":"pip install types-six","lang":"bash","label":"Install types-six"}],"dependencies":[{"reason":"Runtime library for which types-six provides type annotations. You must install `six` separately for your code to run.","package":"six","optional":false}],"imports":[{"note":"You import the runtime `six` library, and `types-six` provides the type hints automatically for type checkers. There are no direct imports from `types-six` itself.","symbol":"six.moves.urllib.parse","correct":"import six.moves.urllib.parse"}],"quickstart":{"code":"import six.moves.urllib.parse\n\ndef get_scheme(url: six.text_type) -> six.text_type:\n    parsed_url = six.moves.urllib.parse.urlparse(url)\n    return parsed_url.scheme\n\nurl_str: six.text_type = 'http://example.com/path'\nscheme: six.text_type = get_scheme(url_str)\nprint(f\"The scheme is: {scheme}\")\n\n# To type-check this:\n# 1. pip install six types-six mypy\n# 2. Save the code above as example.py\n# 3. Run: mypy example.py","lang":"python","description":"This example demonstrates using a common utility from the `six` library (`six.moves.urllib.parse`) and applying type hints from `types-six`. After installing `six`, `types-six`, and a type checker like `mypy`, you can run `mypy example.py` to verify the types. `types-six` ensures that `mypy` understands the types of `six`'s functions and constants, such as `six.text_type`."},"warnings":[{"fix":"For new Python 3 projects, refactor code to use standard Python 3 library functions directly. Only use `six` if maintaining a codebase that must run on both Python 2 and Python 3.","message":"The `six` library is primarily intended for maintaining Python 2 and 3 compatibility in a single codebase. For new Python 3-only projects, it is generally recommended to use native Python 3 features directly (e.g., `urllib.parse` instead of `six.moves.urllib.parse`) to avoid unnecessary abstraction layers and potential confusion.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your development environment's Python version meets the `types-six` requirement (`>=3.10`). For type-checking older Python projects that use `six`, `types-six` is not suitable.","message":"`types-six` (and Typeshed stubs generally) are designed for modern Python versions. Specifically, `types-six` requires Python `>=3.10`, even though the runtime `six` library itself supports Python `2.7` and `3.3+`. This means `types-six` cannot be used to provide type hints for older Python 2 or Python 3 projects.","severity":"gotcha","affected_versions":"All versions of types-six (current: 1.17.0.20260408)"},{"fix":"Always install the `six` runtime library (`pip install six`) alongside `types-six` if your project actually uses `six`.","message":"`types-six` is a stub-only package. It provides type information solely for static analysis tools (like Mypy, Pyright, PyCharm) and does not contain any executable code or influence runtime behavior. You must install the `six` runtime library separately (`pip install six`) for your application to function.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}