Skip to content

Commit

Permalink
Switch from typing_extensions to typing for Python 3.11 imports (#1922)
Browse files Browse the repository at this point in the history
* Switch from `typing_extensions` to `typing` for Python 3.11 imports
* Remove unnecessary base class in Update model
* Install `z-base-32` from the git repo for unreleased Python 3.12 support (fixes CI builds)
* Switch to forked `wtforms-sqlalchemy` pending upstream release
* Upgrade Python dependencies
  • Loading branch information
jace authored Nov 6, 2023
1 parent 7d3d402 commit ab9f910
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 44 deletions.
3 changes: 1 addition & 2 deletions funnel/devtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import weakref
from collections.abc import Callable, Iterable
from secrets import token_urlsafe
from typing import Any, NamedTuple
from typing_extensions import Protocol
from typing import Any, NamedTuple, Protocol

from flask import Flask

Expand Down
3 changes: 2 additions & 1 deletion funnel/models/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@
ClassVar,
Generic,
Optional,
Protocol,
TypeVar,
Union,
cast,
get_args,
get_origin,
)
from typing_extensions import Protocol, get_original_bases
from typing_extensions import get_original_bases
from uuid import UUID, uuid4

from sqlalchemy import event
Expand Down
3 changes: 1 addition & 2 deletions funnel/models/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
Mapped,
Model,
Query,
TimestampMixin,
TSVectorType,
UuidMixin,
backref,
Expand Down Expand Up @@ -47,7 +46,7 @@ class VISIBILITY_STATE(LabeledEnum): # noqa: N801
RESTRICTED = (2, 'restricted', __("Restricted"))


class Update(UuidMixin, BaseScopedIdNameMixin, TimestampMixin, Model):
class Update(UuidMixin, BaseScopedIdNameMixin, Model):
__tablename__ = 'update'

_visibility_state = sa.orm.mapped_column(
Expand Down
3 changes: 1 addition & 2 deletions funnel/utils/markdown/escape.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import string
from collections.abc import Callable, Iterable, Mapping
from functools import wraps
from typing import Any, Concatenate, SupportsIndex, TypeVar
from typing_extensions import ParamSpec, Protocol, Self
from typing import Any, Concatenate, ParamSpec, Protocol, Self, SupportsIndex, TypeVar

__all__ = ['HasMarkdown', 'MarkdownString', 'markdown_escape']

Expand Down
2 changes: 1 addition & 1 deletion funnel/views/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import defaultdict
from collections.abc import Callable
from functools import wraps
from typing_extensions import Protocol
from typing import Protocol

import requests
from flask import g
Expand Down
3 changes: 2 additions & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ urllib3[socks] # Not required here, but the [socks] extra shows up in test.txt
user-agents
werkzeug
whitenoise
z-base-32
wtforms-sqlalchemy @ git+https://github.com/jace/wtforms-sqlalchemy # See /pull/1
z-base-32 @ git+https://github.com/matusf/z-base-32 # See /issues/13 for Py 3.12 fix
zxcvbn
45 changes: 22 additions & 23 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SHA1:8d570f8f7fb4bd607d33ddb31c5b62c51b09ec48
# SHA1:b825fb2bb7b273cf1c5f4d42e496b72531f87768
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand Down Expand Up @@ -28,7 +28,7 @@ alembic==1.12.1
aniso8601==9.0.1
# via coaster
anyio==4.0.0
# via httpcore
# via httpx
argon2-cffi==23.1.0
# via -r requirements/base.in
argon2-cffi-bindings==21.2.0
Expand All @@ -55,15 +55,15 @@ bleach==6.1.0
# via
# baseframe
# coaster
blinker==1.6.3
blinker==1.7.0
# via
# -r requirements/base.in
# baseframe
# coaster
# flask
boto3==1.28.72
boto3==1.28.78
# via -r requirements/base.in
botocore==1.31.72
botocore==1.31.78
# via
# boto3
# s3transfer
Expand All @@ -83,7 +83,7 @@ cffi==1.16.0
# via
# argon2-cffi-bindings
# cryptography
charset-normalizer==3.3.1
charset-normalizer==3.3.2
# via
# aiohttp
# requests
Expand Down Expand Up @@ -114,7 +114,7 @@ dnspython==2.4.2
# pyisemail
emoji==2.8.0
# via baseframe
filelock==3.12.4
filelock==3.13.1
# via tldextract
flask==3.0.0
# via
Expand Down Expand Up @@ -148,7 +148,7 @@ flask-executor==1.0.0
# via -r requirements/base.in
flask-flatpages==0.8.1
# via -r requirements/base.in
flask-mailman==0.3.0
flask-mailman==1.0.0
# via -r requirements/base.in
flask-migrate==4.0.5
# via
Expand Down Expand Up @@ -200,19 +200,19 @@ html5lib==1.1
# via
# baseframe
# coaster
httpcore==0.18.0
httpcore==1.0.1
# via httpx
httplib2==0.22.0
# via
# oauth2
# oauth2client
httpx[http2]==0.25.0
httpx[http2]==0.25.1
# via
# -r requirements/base.in
# python-telegram-bot
hyperframe==6.0.1
# via h2
icalendar==5.0.10
icalendar==5.0.11
# via -r requirements/base.in
idna==3.4
# via
Expand Down Expand Up @@ -248,7 +248,7 @@ lxml==4.9.3
# via premailer
mako==1.2.4
# via alembic
markdown==3.5
markdown==3.5.1
# via
# coaster
# flask-flatpages
Expand All @@ -274,8 +274,6 @@ mdit-py-plugins==0.4.0
# via -r requirements/base.in
mdurl==0.1.2
# via markdown-it-py
mkdocs-material-extensions==1.3
# via flask-mailman
multidict==6.0.4
# via
# aiohttp
Expand All @@ -302,7 +300,7 @@ packaging==23.2
# marshmallow
passlib==1.7.4
# via -r requirements/base.in
phonenumbers==8.13.23
phonenumbers==8.13.24
# via -r requirements/base.in
premailer==3.10.0
# via -r requirements/base.in
Expand Down Expand Up @@ -422,7 +420,7 @@ semantic-version==2.10.0
# via
# baseframe
# coaster
sentry-sdk==1.32.0
sentry-sdk==1.34.0
# via baseframe
six==1.16.0
# via
Expand All @@ -439,9 +437,8 @@ six==1.16.0
sniffio==1.3.0
# via
# anyio
# httpcore
# httpx
sqlalchemy==2.0.22
sqlalchemy==2.0.23
# via
# -r requirements/base.in
# alembic
Expand All @@ -460,7 +457,7 @@ statsd==4.0.1
# via baseframe
tinydb==4.8.0
# via tuspy
tldextract==5.0.1
tldextract==5.1.0
# via
# coaster
# mxsniff
Expand Down Expand Up @@ -519,16 +516,18 @@ werkzeug==3.0.1
# flask
whitenoise==6.6.0
# via -r requirements/base.in
wtforms==3.1.0
wtforms==3.1.1
# via
# baseframe
# flask-wtf
# wtforms-sqlalchemy
wtforms-sqlalchemy==0.3
# via baseframe
wtforms-sqlalchemy @ git+https://github.com/jace/wtforms-sqlalchemy
# via
# -r requirements/base.in
# baseframe
yarl==1.9.2
# via aiohttp
z-base-32==0.1.2
z-base-32 @ git+https://github.com/matusf/z-base-32
# via -r requirements/base.in
zxcvbn==4.4.28
# via -r requirements/base.in
Expand Down
16 changes: 8 additions & 8 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ flake8-blind-except==0.2.1
# via -r requirements/dev.in
flake8-bugbear==23.9.16
# via -r requirements/dev.in
flake8-builtins==2.1.0
flake8-builtins==2.2.0
# via -r requirements/dev.in
flake8-comprehensions==3.14.0
# via -r requirements/dev.in
flake8-docstrings==1.7.0
# via -r requirements/dev.in
flake8-isort==6.1.0
flake8-isort==6.1.1
# via -r requirements/dev.in
flake8-logging-format==0.9.0
# via -r requirements/dev.in
Expand All @@ -87,7 +87,7 @@ html-tag-names==0.1.2
# via djlint
html-void-elements==0.1.0
# via djlint
identify==2.5.30
identify==2.5.31
# via pre-commit
isort==5.12.0
# via
Expand Down Expand Up @@ -149,7 +149,7 @@ pyupgrade==3.15.0
# via -r requirements/dev.in
reformat-gherkin==3.0.1
# via -r requirements/dev.in
ruff==0.1.3
ruff==0.1.4
# via -r requirements/dev.in
smmap==5.0.1
# via gitdb
Expand All @@ -173,19 +173,19 @@ types-maxminddb==1.5.0
# via types-geoip2
types-mock==5.1.0.2
# via -r requirements/dev.in
types-pyopenssl==23.2.0.2
types-pyopenssl==23.3.0.0
# via types-redis
types-pytz==2023.3.1.1
# via -r requirements/dev.in
types-redis==4.6.0.8
types-redis==4.6.0.9
# via -r requirements/dev.in
types-requests==2.31.0.10
# via -r requirements/dev.in
virtualenv==20.24.6
# via pre-commit
wcwidth==0.2.8
wcwidth==0.2.9
# via reformat-gherkin
wheel==0.41.2
wheel==0.41.3
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
8 changes: 4 additions & 4 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ pytest-cov==4.1.0
# via -r requirements/test.in
pytest-dotenv==0.5.2
# via -r requirements/test.in
pytest-env==1.1.0
pytest-env==1.1.1
# via -r requirements/test.in
pytest-html==4.0.2
pytest-html==4.1.0
# via pytest-selenium
pytest-metadata==3.0.0
# via pytest-html
Expand Down Expand Up @@ -94,9 +94,9 @@ sttable==0.0.1
# via -r requirements/test.in
tenacity==8.2.3
# via pytest-selenium
tomlkit==0.12.1
tomlkit==0.12.2
# via -r requirements/test.in
trio==0.22.2
trio==0.23.1
# via
# selenium
# trio-websocket
Expand Down

0 comments on commit ab9f910

Please sign in to comment.