Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Resolve mypy type lints when running with Python 3.8 (minimum supported version) #15603

Closed
4 of 24 tasks
MadLittleMods opened this issue May 15, 2023 · 1 comment
Closed
4 of 24 tasks
Assignees
Labels
A-CI Issues related to CI on the Synapse repository T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@MadLittleMods
Copy link
Contributor

MadLittleMods commented May 15, 2023

Spawning from #15602, where we should be running mypy with our minimum supported Python version since later versions can include overloads, etc which aren't backwards compatible.

Before we can actually merge the PR which updates the CI to use Python 3.8, we have to resolve the lints that pop up first so we don't just have a broken CI after merging #15602

TODO Python 3.8

TODO Python 3.7

We're no longer trying to target Python 3.7 given that EOL is weeks away (wasted effort)

Dev notes

Find/replace from the mypy output to generate that list:

Find:

^(.*):(\d+): (.*)$

Replace:

 - [ ] [`$1:$2`](https://github.com/matrix-org/synapse/blob/ba572647b291e593e70a30e45c234c9766472ff3/$1#L$2): `$3`
@MadLittleMods MadLittleMods added T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. A-CI Issues related to CI on the Synapse repository labels May 15, 2023
@MadLittleMods MadLittleMods self-assigned this May 15, 2023
@MadLittleMods MadLittleMods changed the title Resolve mypy type lints when running with Python 3.7 (minimum supported version) Resolve mypy type lints when running with Python 3.8 (minimum supported version) May 15, 2023
MadLittleMods added a commit that referenced this issue May 16, 2023
Fix the following `mypy` errors when running `mypy` with Python 3.7:
```
synapse/storage/controllers/stats.py:58: error: "Counter" is not subscriptable, use "typing.Counter" instead  [misc]

tests/test_state.py:267: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
```

Part of #15603

In Python 3.9, `typing` is deprecated and the types are subscriptable (generics) by default, https://peps.python.org/pep-0585/#implementation
@MadLittleMods
Copy link
Contributor Author

Closing as all of the linked PR's are now merged and the mypy CI pass on #15602 is now passing ✅

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-CI Issues related to CI on the Synapse repository T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

No branches or pull requests

1 participant