{"id":15477065,"url":"https://github.com/cdce8p/python-typing-update","last_synced_at":"2026-03-11T12:24:30.884Z","repository":{"id":36979294,"uuid":"347182968","full_name":"cdce8p/python-typing-update","owner":"cdce8p","description":"Update Python typing syntax","archived":false,"fork":false,"pushed_at":"2025-05-05T08:24:39.000Z","size":585,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T23:43:34.500Z","etag":null,"topics":["python","python-pep585","python-pep604","python-typing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdce8p.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-03-12T19:58:24.000Z","updated_at":"2025-05-05T08:24:41.000Z","dependencies_parsed_at":"2023-10-16T21:33:48.549Z","dependency_job_id":"e52676ad-fbf6-4baa-9aa0-04ab7bc6348f","html_url":"https://github.com/cdce8p/python-typing-update","commit_stats":{"total_commits":344,"total_committers":3,"mean_commits":"114.66666666666667","dds":0.2558139534883721,"last_synced_commit":"e62ba6b9afc83b2ed0fff8e87ccf2f2ebb67f940"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdce8p%2Fpython-typing-update","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdce8p%2Fpython-typing-update/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdce8p%2Fpython-typing-update/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdce8p%2Fpython-typing-update/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdce8p","download_url":"https://codeload.github.com/cdce8p/python-typing-update/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973617,"owners_count":21834105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python-pep585","python-pep604","python-typing"],"created_at":"2024-10-02T03:43:11.534Z","updated_at":"2026-03-11T12:24:30.873Z","avatar_url":"https://github.com/cdce8p.png","language":"Python","readme":"# Python typing update\n\n[![PyPI](https://img.shields.io/pypi/v/python-typing-update?color=blue)](https://pypi.org/project/python-typing-update/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/python-typing-update)](https://github.com/cdce8p/python-typing-update)\n[![GitHub](https://img.shields.io/github/license/cdce8p/python-typing-update)](https://github.com/cdce8p/python-typing-update/blob/main/LICENSE)\n[![image](https://static.pepy.tech/badge/python-typing-update)](https://pepy.tech/project/python-typing-update)\n\nTool to update Python typing syntax.\nIt uses token analysis and\n- [python-reorder-imports][pri]\n- [pyupgrade][pyu]\n- [isort][isort]\n- [autoflake][autoflake]\n- [black][black]\n- [ruff][ruff]\n- git\n\nto try and update the typing syntax the best it can.\n\n**Important**  \nEvery project uses a different formatting style,\nso always check `git diff` before comitting any changes!\nSince this tool uses [pyupgrade][pyu], it's best used for\nprojects that use it already.\n\n\n## Limitations\nDue to the way the tool works, it will reorder the imports multiple times.\nBy default the tool tries to detect if a comment was moved\nand revert all changes to the file. This can be overwritten by using `--force`.\n\nCurrently, it's not possible to update aliases with a different name.\nIn particular, these need to be updated manually:\n| Old typing name | New |\n| --------------- | --- |\n| `Deque` | `collections.deque` |\n| `DefaultDict` | `collections.defaultdict` |\n| `AbstractSet` | `collections.abc.Set` |\n| `ContextManager` | `contextlib.AbstractContextManager` |\n| `AsyncContextMananger` | `contextlib.AbstractAsyncContextManager` |\n\n\n## How it works\n1. Run [python-reorder-import][pri] to add\n   `from __future__ import annotations` to each file.\n2. Run [pyupgrade][pyu] to use generic aliases ([PEP 585][PEP585])\n   and alternative union syntax ([PEP 604][PEP604]) where possible.\n3. Run [autoflake][autoflake] to check if any typing import is now\n   unused. If not, revert changes with `git restore`.\n4. Remove unused imports with [autoflake][autoflake].\n5. Run [isort][isort] to try to restore the previous formatting.\n6. Optional: Run [black][black]. (Requires `black` to be added as `additional_dependency`)  \n   OR: Run [ruff][ruff]. (Requires `ruff` to be added as `additional_dependency`)\n7. Check `git diff` for modified comments.\n   If one is detected, revert changes and print file name.\n   Can be overwritten with `--force`.\n\n\n## Setup pre-commit\n\nAdd this to the `.pre-commit-config.yaml` file\n\n```yaml\nrepos:\n  - repo: https://github.com/cdce8p/python-typing-update\n    rev: \u003cinsert current tag here!\u003e\n    hooks:\n      - id: python-typing-update\n        stages: [manual]\n```\n\nRun with\n```bash\npre-commit run --hook-stage manual python-typing-update --all-files\n```\n\n## Configuration\n\n**`--verbose`**  \nAlways print verbose logging.\n\n**`--limit`**  \nMax number of files that should be changed. No performance improvements,\nsince the limit is only applied **after** all files have been processed.\n\n**`--concurrent-files`**  \nNumber of files to process concurrently during initial load.\n\n**`--full-reorder`**  \nUse additional options from [python-reorder-imports][pri] to rewrite\n- Imports from `mypy_extensions` and `typing_extensions` when possible.\n\n**`--keep-updates`**  \nKeep updates even if no import was removed. Use with caution, might result in more errors.\n\n**`--black`**  \nRun `black` formatting after updates.  \nTo use it, add `black` as `additional_dependency` in your `.pre-commit-config.yaml`.\n\n```yaml\n        additional_dependencies:\n          - black==\u003cinsert current version here!\u003e\n```\n\n**`--ruff`**  \nRun `ruff check --fix` and `ruff format` after updates.  \nTo use it, add `ruff` as `additional_dependency` in your `.pre-commit-config.yaml`.\n\n```yaml\n        additional_dependencies:\n          - ruff==\u003cinsert current version here!\u003e\n```\n\n**`--disable-committed-check`**  \nDon't abort with uncommitted changes. **Don't use it in production!**\nRisk of losing uncommitted changes.\n\n\n### Different mode options\n\n**`--check`**  \nCheck if files would be modified. Return with exitcode `1` or `0` if not. Useful for CI runs.\n\n**`--force`**  \nDon't revert changes if a modified comment is detected.\nCheck `git diff` before committing!\n\n**`--only-force`**  \nOnly update files which are likely to require extra work.\nCheck `git diff` before committing!\n\n\n### Python version options\n\n**`--py310-plus`**  \nSet the minimum Python syntax version to **3.10**. This is the default.\n\n**`--py311-plus`**  \nSet the minimum Python syntax version to **3.11**. (Default: **3.10**)\n\n**`--py312-plus`**  \nSet the minimum Python syntax version to **3.12**. (Default: **3.10**)\n\n**`--py313-plus`**  \nSet the minimum Python syntax version to **3.13**. (Default: **3.10**)\n\n**`--py314-plus`**  \nSet the minimum Python syntax version to **3.14**. (Default: **3.10**)\n\n\n## License\nThis Project is licensed under the MIT license.\nSee [LICENSE][LICENSE_FILE] for the full license text.\n\n\n[pri]: https://github.com/asottile/reorder_python_imports\n[pyu]: https://github.com/asottile/pyupgrade\n[isort]: https://github.com/PyCQA/isort\n[autoflake]: https://github.com/PyCQA/autoflake\n[black]: https://github.com/psf/black\n[ruff]: https://github.com/astral-sh/ruff\n[PEP585]: https://www.python.org/dev/peps/pep-0585/\n[PEP604]: https://www.python.org/dev/peps/pep-0604/\n\n[LICENSE_FILE]: https://github.com/cdce8p/python-typing-update/blob/main/LICENSE\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdce8p%2Fpython-typing-update","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdce8p%2Fpython-typing-update","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdce8p%2Fpython-typing-update/lists"}