Skip to content

Commit 7b58a40

Browse files
authored
chore: blue-krill v2.1.0 & some minor enhancements (TencentBlueKing#216)
1 parent ede5798 commit 7b58a40

11 files changed

Lines changed: 71 additions & 49 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ name = "蓝鲸 PaaS 平台 Python 工具集"
33
version = "0.0.1"
44
description = "BlueKing PaaS Python SDK"
55
authors = ["blueking <blueking@tencent.com>"]
6+
package-mode = false
67

78
[tool.poetry.dependencies]
89
python = ">=3.8.1,<3.12"
910

1011
[tool.poetry.group.dev.dependencies]
11-
ruff = "^0.1.7"
12+
ruff = "^0.9.7"
1213

1314
[tool.ruff]
1415
line-length = 119
@@ -80,8 +81,8 @@ ignore = [
8081
"PERF203",
8182
# tryceratops: 忽略后,允许抛出异常时,使用较长的字符串作为异常信息,可能会降低异常的可使用性
8283
"TRY003",
83-
# tryceratops: 忽略后,允许在 except 语句块中使用裸的 raise 语句,不要求必须使用 raise ... from
84-
"TRY200",
84+
# flake80-bugbear: 忽略后,允许在 except 语句块中使用裸的 raise 语句,不要求必须使用 raise ... from
85+
"B904",
8586
# flake8-simplify: 忽略后,允许使用 exception: pass 语句,不要求必须用 contextlib.suppress 替换
8687
"SIM105",
8788
# flake8-simplify: 忽略后,不强制要求用三元表达式替换普通的短 if-else 语句

sdks/blue-krill/CHANGE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Change logs
22

3+
### 2.1.0
4+
5+
- Feature: improve editionctl tool in various places: debounce, conditional linking and event filtering
6+
- Refactor: fix ruff linter issues
7+
- Drop support for Python3.8 and Django 1.x
8+
39
### 2.0.7
410

511
- Feature: (py 3.11+) add StrStructuredEnum, IntStructuredEnum class

sdks/blue-krill/blue_krill/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
# We undertake not to change the open source license (MIT license) applicable
1616
# to the current version of the project delivered to anyone in the future.
1717

18-
__version__ = "2.0.7"
18+
__version__ = "2.1.0"

sdks/blue-krill/blue_krill/auth/jwt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ClientJWTAuth(AuthBase):
5454

5555
_default_expires_in = 3600
5656

57-
def __init__(self, auth_conf: JWTAuthConf, prefix: str = "Bearer", expires_in: int = None):
57+
def __init__(self, auth_conf: JWTAuthConf, prefix: str = "Bearer", expires_in: Optional[int] = None):
5858
self.auth_conf = auth_conf
5959
self.prefix = prefix
6060
self.expires_in = expires_in or self._default_expires_in

sdks/blue-krill/blue_krill/data_types/enum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class FeatureFlagMeta(type):
6161
_feature_flag_fields_: Dict[str, FeatureFlagField]
6262

6363
def __new__(mcs, cls_name: str, bases, dct: Dict): # noqa: N804
64-
_feature_flag_fields_ = {}
64+
_feature_flag_fields_: Dict[str, Any] = {}
6565
for base in bases:
6666
_feature_flag_fields_.update(getattr(base, "_feature_flag_fields_", {}))
6767

@@ -87,7 +87,7 @@ def __iter__(cls):
8787
yield feature
8888

8989

90-
class FeatureFlag(str, metaclass=FeatureFlagMeta):
90+
class FeatureFlag(str, metaclass=FeatureFlagMeta): # type: ignore
9191
def __new__(cls, value):
9292
"""Cast a string into a predefined feature flag."""
9393
for field in cls._get_feature_fields_().values():

sdks/blue-krill/blue_krill/storages/blobstore/s3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import logging
1919
from os import PathLike
2020
from shutil import copyfileobj
21-
from typing import BinaryIO
21+
from typing import BinaryIO, Optional
2222

2323
from blue_krill.storages.blobstore.base import BlobStore, SignatureType
2424
from blue_krill.storages.blobstore.exceptions import DownloadFailedError, ObjectAlreadyExists, UploadFailedError
@@ -56,7 +56,7 @@ def __init__(
5656
self.endpoint_url = endpoint_url
5757
self.region_name = region_name
5858

59-
def get_client(self, signature_version: str = None):
59+
def get_client(self, signature_version: Optional[str] = None):
6060
return boto3.resource(
6161
"s3",
6262
aws_access_key_id=self.aws_access_key_id,

sdks/blue-krill/poetry.lock

Lines changed: 47 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/blue-krill/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "blue-krill"
99
description = "Tools and common packages for blueking PaaS platform."
1010
requires-python = ">=3.9,<3.12"
1111
license = "MIT"
12-
version = "2.0.7"
12+
version = "2.1.0"
1313
# classifieres is dynamic because we want to create Python classifiers automatically
1414
dynamic = ["classifiers"]
1515
readme = "README.md"
@@ -54,7 +54,7 @@ celery = "^5.0.5"
5454
pytest = "^6.2.2"
5555
pytest-django = "^4.1.0"
5656
# mypy
57-
mypy = "^0.910"
57+
mypy = "^1.15.0"
5858
# install extension stubs if missing
5959
types-requests = "2.31.0.6"
6060
types-setuptools = "^57.0.0"

sdks/blue-krill/tests/async_utils/test_poll_task.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ def subtask(self, *args, **kwargs):
5454
class BasePoller(TaskPoller):
5555
"""Base poller using fake task"""
5656

57-
def query(self) -> PollingResult: ...
57+
def query(self) -> PollingResult:
58+
# The subclass should implement this method
59+
raise NotImplementedError
5860

5961
@classmethod
6062
def get_async_task(cls):

sdks/blue-krill/tests/editions/test_editionctl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ def config(self, tmp_path):
107107
project_root=tmp_path / "project",
108108
editions_root=editions_root,
109109
editions=[
110-
EditionConf(name="e1", directory="e1"),
111-
EditionConf(name="e2", directory="e2"),
110+
EditionConf(name="e1", rel_directory="e1"),
111+
EditionConf(name="e2", rel_directory="e2"),
112112
],
113113
)
114114

0 commit comments

Comments
 (0)