# add-typing-final
Auto-fixer for Python code that:
- sets `typing.Final` inside functions for variables that are not reassigned
- and removes `typing.Final` from variables that are reassined.
## How To Use
```sh
uv tool run add-typing-final *files*
```
or
```sh
pipx run add-typing-final *files*
```
### Setting up VS Code keybinding
Add to your `keybindings.json`:
```json
{
"key": "ctrl+shift+t",
"when": "editorLangId == 'python'",
"command": "runCommands",
"args": {
"commands": [
"workbench.action.files.save",
"workbench.action.terminal.newInActiveWorkspace",
"workbench.action.terminal.toggleTerminal",
{
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "uv tool run add-typing-final ${file}\u000Dexit\u000D"
}
}
]
}
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "add-typing-final",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "automation, flake8, mypy, typing",
"author": null,
"author_email": "Lev Vereshchagin <mail@vrslev.com>",
"download_url": "https://files.pythonhosted.org/packages/87/47/8fccac5be9ac922be32f39f8716fd2976ec0b7ef163e4e59f17248f5a939/add_typing_final-0.1.0.tar.gz",
"platform": null,
"description": "# add-typing-final\n\nAuto-fixer for Python code that:\n\n- sets `typing.Final` inside functions for variables that are not reassigned\n- and removes `typing.Final` from variables that are reassined.\n\n## How To Use\n\n```sh\nuv tool run add-typing-final *files*\n```\n\nor\n\n```sh\npipx run add-typing-final *files*\n```\n\n### Setting up VS Code keybinding\n\nAdd to your `keybindings.json`:\n\n```json\n{\n \"key\": \"ctrl+shift+t\",\n \"when\": \"editorLangId == 'python'\",\n \"command\": \"runCommands\",\n \"args\": {\n \"commands\": [\n \"workbench.action.files.save\",\n \"workbench.action.terminal.newInActiveWorkspace\",\n \"workbench.action.terminal.toggleTerminal\",\n {\n \"command\": \"workbench.action.terminal.sendSequence\",\n \"args\": {\n \"text\": \"uv tool run add-typing-final ${file}\\u000Dexit\\u000D\"\n }\n }\n ]\n }\n}\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": null,
"version": "0.1.0",
"project_urls": {
"repository": "https://github.com/vrslev/add-typing-final"
},
"split_keywords": [
"automation",
" flake8",
" mypy",
" typing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "039e9e3f1eaff212e1f48cdc72cc8d593e929dc16abd1946b70c41144d7a111a",
"md5": "91efd7f71e0bcbf9d0cb0df16c75f56d",
"sha256": "8890690d46c180ba8f5dc9a1bf6fe73bdf90357000ef9058cd1c8add3aa9f637"
},
"downloads": -1,
"filename": "add_typing_final-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "91efd7f71e0bcbf9d0cb0df16c75f56d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 4323,
"upload_time": "2024-06-25T07:44:34",
"upload_time_iso_8601": "2024-06-25T07:44:34.635545Z",
"url": "https://files.pythonhosted.org/packages/03/9e/9e3f1eaff212e1f48cdc72cc8d593e929dc16abd1946b70c41144d7a111a/add_typing_final-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "87478fccac5be9ac922be32f39f8716fd2976ec0b7ef163e4e59f17248f5a939",
"md5": "244053207c9e9bcc4ca7c2525ad61044",
"sha256": "90fd095ae627ff7d237442a0cfcb55fbc2122e05ac6bdbcfcceade29eedc7819"
},
"downloads": -1,
"filename": "add_typing_final-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "244053207c9e9bcc4ca7c2525ad61044",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 5213,
"upload_time": "2024-06-25T07:44:37",
"upload_time_iso_8601": "2024-06-25T07:44:37.769695Z",
"url": "https://files.pythonhosted.org/packages/87/47/8fccac5be9ac922be32f39f8716fd2976ec0b7ef163e4e59f17248f5a939/add_typing_final-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-25 07:44:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vrslev",
"github_project": "add-typing-final",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "add-typing-final"
}