drop support for Python 3.9
This commit is contained in:
parent
5259d1e31a
commit
46bfb35488
|
@ -15,30 +15,31 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: install-pinned/pyupgrade@423622e7c2088eeba495a591385ec22074284f90
|
||||
- uses: install-pinned/pyupgrade@28e8d2633f6f1a03d5b4709682ce155a66324e6a
|
||||
- name: Run pyupgrade
|
||||
run: |
|
||||
shopt -s globstar
|
||||
export GLOBIGNORE='mitmproxy/contrib/**'
|
||||
pyupgrade --exit-zero-even-if-changed --keep-runtime-typing --py39-plus **/*.py
|
||||
pyupgrade --exit-zero-even-if-changed --keep-runtime-typing --py310-plus **/*.py
|
||||
|
||||
- uses: install-pinned/reorder_python_imports@946c8bbd8fe048a3bee76063c90c938d5a59a9aa
|
||||
- uses: install-pinned/reorder_python_imports@2cc264e0f6bc33907796602661e5b26d8199314d
|
||||
- name: Run reorder-python-imports
|
||||
run: |
|
||||
shopt -s globstar
|
||||
export GLOBIGNORE='mitmproxy/contrib/**'
|
||||
reorder-python-imports --exit-zero-even-if-changed --py39-plus **/*.py
|
||||
- uses: install-pinned/yesqa@4af1e53e86a56db346a03ece9e89c19bfd0e5d0e
|
||||
reorder-python-imports --exit-zero-even-if-changed --py310-plus **/*.py
|
||||
|
||||
- uses: install-pinned/yesqa@4896f663e9c294fddfbf5f4e4fc4f9b1a4556658
|
||||
- name: Run yesqa
|
||||
run: |
|
||||
shopt -s globstar
|
||||
export GLOBIGNORE='mitmproxy/contrib/**'
|
||||
yesqa **/*.py || true
|
||||
- uses: install-pinned/autoflake@19ecc14a8688d57cca9dc6cfd705f16f200ff097
|
||||
- run: autoflake --in-place --remove-all-unused-imports --exclude contrib -r .
|
||||
|
||||
- uses: install-pinned/black@13c8a20eb904ba800c87f0b34ccfd932ac2ff81d
|
||||
- uses: install-pinned/autoflake@dfa39c5f136f5b885c175734a719dc6ad1f11fc7
|
||||
- run: autoflake --in-place --remove-all-unused-imports --exclude mitmproxy/contrib -r .
|
||||
|
||||
- uses: install-pinned/black@3375665f712256be11c3212db472c3dafc217fa1
|
||||
- run: black --extend-exclude mitmproxy/contrib .
|
||||
|
||||
- uses: mhils/add-pr-ref-in-changelog@main
|
||||
|
|
|
@ -49,8 +49,6 @@ jobs:
|
|||
py: "3.11"
|
||||
- os: ubuntu-latest
|
||||
py: "3.10"
|
||||
- os: ubuntu-latest
|
||||
py: "3.9"
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- run: printenv
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
## Unreleased: mitmproxy next
|
||||
|
||||
* mitmproxy now requires Python 3.10 or above.
|
||||
* Fix a bug where the direction indicator in the message stream view would be in the wrong direction.
|
||||
([#5921](https://github.com/mitmproxy/mitmproxy/issues/5921), @konradh)
|
||||
* Fix a bug where peername would be None in tls_passthrough script, which would make it not working.
|
||||
|
|
|
@ -14,8 +14,7 @@ forward, please consider contributing in the following areas:
|
|||
|
||||
## Development Setup
|
||||
|
||||
To get started hacking on mitmproxy, please install a recent version of Python (we require at least Python 3.9).
|
||||
Then, do the following:
|
||||
To get started hacking on mitmproxy, please install the latest version of Python and do the following:
|
||||
|
||||
##### Linux / macOS
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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`
|
||||
|
||||
|
|
|
@ -40,10 +40,7 @@ class Master:
|
|||
# may want to spawn tasks during the initial configuration phase,
|
||||
# which happens before run().
|
||||
self.event_loop = event_loop or asyncio.get_running_loop()
|
||||
try:
|
||||
self.should_exit = asyncio.Event()
|
||||
except RuntimeError: # python 3.9 and below
|
||||
self.should_exit = asyncio.Event(loop=self.event_loop) # type: ignore
|
||||
self.should_exit = asyncio.Event()
|
||||
mitmproxy_ctx.master = self
|
||||
mitmproxy_ctx.log = self.log # deprecated, do not use.
|
||||
mitmproxy_ctx.options = self.options
|
||||
|
|
|
@ -17,13 +17,9 @@ from collections.abc import Callable
|
|||
from typing import Any
|
||||
from typing import cast
|
||||
from typing import Generic
|
||||
from typing import ParamSpec
|
||||
from typing import TypeVar
|
||||
|
||||
try:
|
||||
from typing import ParamSpec
|
||||
except ImportError: # pragma: no cover
|
||||
# Python 3.9
|
||||
from typing_extensions import ParamSpec # type: ignore
|
||||
|
||||
P = ParamSpec("P")
|
||||
R = TypeVar("R")
|
||||
|
|
3
setup.py
3
setup.py
|
@ -37,7 +37,6 @@ setup(
|
|||
"Operating System :: POSIX",
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
|
@ -70,7 +69,7 @@ setup(
|
|||
"hook-dirs = mitmproxy.utils.pyinstaller:hook_dirs",
|
||||
],
|
||||
},
|
||||
python_requires=">=3.9",
|
||||
python_requires=">=3.10",
|
||||
# https://packaging.python.org/en/latest/discussions/install-requires-vs-requirements/#install-requires
|
||||
# It is not considered best practice to use install_requires to pin dependencies to specific versions.
|
||||
install_requires=[
|
||||
|
|
Loading…
Reference in New Issue