Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused dependencies and update typing imports for 3.11 #1923

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ci:
skip: [
'pip-audit',
'yesqa',
'creosote',
'no-commit-to-branch',
# 'hadolint-docker',
'docker-compose-check',
Expand Down Expand Up @@ -52,9 +53,9 @@ repos:
rev: v3.15.0
hooks:
- id: pyupgrade
args: ['--keep-runtime-typing', '--py310-plus']
args: ['--keep-runtime-typing', '--py311-plus']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: v0.1.4
hooks:
- id: ruff
args: ['--fix', '--exit-non-zero-on-fix']
Expand Down Expand Up @@ -148,6 +149,26 @@ repos:
args: ['-c', 'pyproject.toml']
additional_dependencies:
- 'bandit[toml]'
- repo: https://github.com/fredrikaverpil/creosote
rev: v3.0.0
hooks:
- id: creosote
args:
- --venv=.venv
- --path=funnel
- --path=tests
- --path=migrations/versions
- --deps-file=requirements/base.in
- --exclude-dep=argon2-cffi # Optional dep for passlib
- --exclude-dep=bcrypt # Optional dep for passlib
- --exclude-dep=gunicorn # Not imported, used as server
- --exclude-dep=linkify-it-py # Optional dep for markdown-it-py
- --exclude-dep=psycopg # Optional dep for SQLAlchemy
- --exclude-dep=rq-dashboard # Creosote fails to recognise the import
- --exclude-dep=tzdata # Data-only dep, therefore no import statement
- --exclude-dep=urllib3 # Required to silence a pip-audit warning
- --exclude-dep=wtforms-sqlalchemy # Temp dep on an unreleased git branch

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion funnel/models/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@
get_args,
get_origin,
)
from typing_extensions import get_original_bases
from uuid import UUID, uuid4

from sqlalchemy import event
from sqlalchemy.orm import column_keyed_dict
from sqlalchemy.orm.exc import NoResultFound
from typing_extensions import get_original_bases
from werkzeug.utils import cached_property

from baseframe import __
Expand Down
3 changes: 1 addition & 2 deletions funnel/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

from __future__ import annotations

from typing import Optional, TypeAlias, TypeVar, Union
from typing_extensions import ParamSpec
from typing import Optional, ParamSpec, TypeAlias, TypeVar, Union

from flask.typing import ResponseReturnValue
from werkzeug.wrappers import Response # Base class for Flask Response
Expand Down
3 changes: 1 addition & 2 deletions funnel/utils/markdown/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

from collections.abc import Callable, Iterable, Mapping
from dataclasses import dataclass
from typing import Any, ClassVar, Literal, overload
from typing_extensions import Self
from typing import Any, ClassVar, Literal, Self, overload

from markdown_it import MarkdownIt
from markupsafe import Markup
Expand Down
2 changes: 1 addition & 1 deletion funnel/utils/markdown/mdit_plugins/toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import re
from collections.abc import MutableMapping, Sequence
from functools import reduce
from typing_extensions import TypedDict
from typing import TypedDict

from markdown_it import MarkdownIt
from markdown_it.renderer import OptionsDict, RendererHTML
Expand Down
3 changes: 1 addition & 2 deletions funnel/utils/mustache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import types
from collections.abc import Callable
from copy import copy
from typing import TypeVar
from typing_extensions import ParamSpec
from typing import ParamSpec, TypeVar

from chevron import render
from markupsafe import Markup, escape as html_escape
Expand Down
3 changes: 1 addition & 2 deletions funnel/views/notifications/mixins.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""Notification helpers and mixins."""

from collections.abc import Callable
from typing import Generic, TypeVar, overload
from typing_extensions import Self
from typing import Generic, Self, TypeVar, overload

import grapheme

Expand Down
3 changes: 1 addition & 2 deletions funnel/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

import re
from html import unescape as html_unescape
from typing import Any, TypeVar
from typing_extensions import TypedDict
from typing import Any, TypedDict, TypeVar
from urllib.parse import quote as urlquote

from flask import request, url_for
Expand Down
3 changes: 1 addition & 2 deletions funnel/views/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from __future__ import annotations

from datetime import datetime
from typing import cast
from typing_extensions import TypedDict
from typing import TypedDict, cast

import requests
import vimeo
Expand Down
Loading
Loading