drop support for Python 3.9

This commit is contained in:
Maximilian Hils 2023-02-27 08:21:41 +01:00 committed by Maximilian Hils
parent 5259d1e31a
commit 46bfb35488
9 changed files with 19 additions and 33 deletions

View file

@ -2,6 +2,7 @@
import contextlib
import inspect
import textwrap
import typing
from pathlib import Path
from mitmproxy import addonmanager
@ -33,15 +34,9 @@ def category(name: str, desc: str, hooks: list[type[hooks.Hook]]) -> None:
for params in all_params:
for param in params:
try:
mod = inspect.getmodule(param.annotation).__name__
if mod == "typing":
# this is ugly, but can be removed once we are on Python 3.9+ only
imports.add(
inspect.getmodule(param.annotation.__args__[0]).__name__
)
types.add(param.annotation._name)
else:
imports.add(mod)
imports.add(inspect.getmodule(param.annotation).__name__)
for t in typing.get_args(param.annotation):
imports.add(inspect.getmodule(t).__name__)
except AttributeError:
raise ValueError(f"Missing type annotation: {params}")
imports.discard("builtins")

View file

@ -66,7 +66,7 @@ While there are plenty of options around[^1], we recommend the installation usin
packages. Most of them (pip, virtualenv, pipenv, etc.) should just work, but we don't have the capacity to
provide support for it.
1. Install a recent version of Python (we require at least 3.9).
1. Install a recent version of Python (we require at least 3.10).
2. Install [pipx](https://pipxproject.github.io/pipx/).
3. `pipx install mitmproxy`