Skip to content

Commit

Permalink
feat(dependencies): upgrade django to 4.x, and some other libs (#1087)
Browse files Browse the repository at this point in the history
  • Loading branch information
wklken authored Nov 4, 2024
1 parent e72f5b0 commit 8fa766f
Show file tree
Hide file tree
Showing 15 changed files with 2,341 additions and 2,873 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
name: ruff
language: python
types: [python]
entry: bash -c 'cd src/dashboard && ruff --config=pyproject.toml --force-exclude --fix .'
entry: bash -c 'cd src/dashboard && ruff check --config=pyproject.toml --force-exclude --fix .'
files: src/dashboard/
- id: mypy
name: mypy
Expand All @@ -38,7 +38,7 @@ repos:
name: ruff
language: python
types: [python]
entry: bash -c 'cd src/esb && ruff --config=pyproject.toml --force-exclude --fix .'
entry: bash -c 'cd src/esb && ruff check --config=pyproject.toml --force-exclude --fix .'
files: ^src/esb/
- id: mypy
name: mypy
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG IMAGE=python
ARG TAG=3.10.12-slim-bullseye
ARG TAG=3.10.15-slim-bullseye
FROM ${IMAGE}:${TAG}

RUN apt-get update && apt-get install -y libssl-dev libffi-dev \
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FORCE:
.PHONY: init
init:
pip install -U pip setuptools
pip install poetry==1.8.2
pip install poetry==1.8.4
poetry install
pip install pre-commit
pre-commit install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
class ResourcePermission(BaseModel):
class Config:
arbitrary_types_allowed = True
keep_untouched = (cached_property,)
ignored_types = (cached_property,)

id: int
name: str
Expand Down
19 changes: 2 additions & 17 deletions src/dashboard/apigateway/apigateway/apps/audit/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,8 @@

logger = logging.getLogger(__name__)


_record_audit_log_signal = Signal(
providing_args=[
"event_id",
"system",
"username",
"op_type",
"op_status",
"op_object_group",
"op_object_type",
"op_object_id",
"op_object",
"data_before",
"data_after",
"comment",
]
)
# provide_args: [event_id: str, system: str, username: str, op_type: str, op_status: str, op_object_group: str, op_object_type: str, op_object_id: int, op_object: str, data_before: Union[list, dict, str, None], data_after: Union[list, dict, str, None], comment: Optional[str] = None]
_record_audit_log_signal = Signal()


@receiver(_record_audit_log_signal, dispatch_uid="record_audit_log")
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/apigateway/apigateway/biz/esb/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class AppComponentPermissionData(BaseModel):
class ComponentPermission(BaseModel):
class Config:
arbitrary_types_allowed = True
keep_untouched = (cached_property,)
ignored_types = (cached_property,)

id: int
board: str
Expand Down
1 change: 0 additions & 1 deletion src/dashboard/apigateway/apigateway/biz/releaser.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def _do_release(self, releases: Release, release_history: ReleaseHistory): # ru
"""发布资源版本"""


#
@dataclass
class MicroGatewayReleaser(BaseGatewayReleaser):
"""微网关发布器"""
Expand Down
9 changes: 7 additions & 2 deletions src/dashboard/apigateway/apigateway/conf/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from urllib.parse import quote

import pymysql
import urllib3
from celery.schedules import crontab
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_bytes
Expand All @@ -32,8 +33,12 @@
from apigateway.conf.utils import get_default_keepalive_options

pymysql.install_as_MySQLdb()
# Patch version info to forcedly pass Django client check
pymysql.version_info = 1, 4, 2, "final", 0
# Patch version info to force pass Django client check
pymysql.version_info = 1, 4, 6, "final", 0

# Patch the SSL module for compatibility with legacy CA credentials.
# https://stackoverflow.com/questions/72479812/how-to-change-tweak-python-3-10-default-ssl-settings-for-requests-sslv3-alert
urllib3.util.ssl_.DEFAULT_CIPHERS = "ALL:@SECLEVEL=1"

env = Env()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class KubernetesModel(BaseModel):
"""K8S 自定义资源的通用结构声明"""

class Config:
allow_population_by_field_name = True
populate_by_name = True

def __str__(self):
return repr(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


class ConfigControllerAuth(KubernetesModel):
secret = Field(default="", description="jwt secret key", helm_value=True, helm_value_default="")
secret: str = Field(default="", description="jwt secret key", helm_value=True, helm_value_default="")


class ConfigController(KubernetesModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class StageRewrite(KubernetesModel):


class BkGatewayStageSpec(GatewayCustomResourceSpec):
domain = Field(default="", description="访问域名", helm_value=True, helm_value_default="")
path_prefix = Field(
domain: str = Field(default="", description="访问域名", helm_value=True, helm_value_default="")
path_prefix: str = Field(
default="", description="访问路径前缀", helm_value=True, helm_value_default="/", alias="pathPrefix"
)
vars: Dict[str, str] = Field(default_factory=dict, description="环境变量", helm_value=True)
Expand Down
Loading

0 comments on commit 8fa766f

Please sign in to comment.