Skip to content

Commit 60600c3

Browse files
committed
minor: runtime release V2.1.0rc3
# Reviewed, transaction id: 55861
1 parent 38325c6 commit 60600c3

4 files changed

Lines changed: 25 additions & 5 deletions

File tree

bk-plugin-framework/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "bk-plugin-framework"
3-
version = "2.3.0rc2"
3+
version = "2.3.0rc3"
44
description = "bk plugin python framework"
55
authors = ["Your Name <you@example.com>"]
66
license = "MIT"
@@ -10,7 +10,7 @@ python = "^3.8.0,<4.0"
1010
pydantic = ">=1.0,<3"
1111
werkzeug = ">=2.0.0, <4.0"
1212
apigw-manager = {version = ">=1.0.6, <4", extras = ["extra"]}
13-
bk-plugin-runtime = "2.1.0rc2"
13+
bk-plugin-runtime = "2.1.0rc3"
1414
jsonschema = ">=2.5.0,<5.0.0"
1515

1616
[tool.poetry.dev-dependencies]

runtime/bk-plugin-runtime/bk_plugin_runtime/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
specific language governing permissions and limitations under the License.
1111
"""
1212

13-
__version__ = "2.1.0rc2"
13+
__version__ = "2.1.0rc3"

runtime/bk-plugin-runtime/bk_plugin_runtime/config/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818

1919
# This will make sure the app is always imported when
2020
# Django starts so that shared_task will use this app.
21+
import django
2122
from blueapps.core.celery import celery_app
23+
from django.utils.functional import cached_property
24+
from django.db.backends.mysql.features import DatabaseFeatures
2225

2326
# app 基本信息
2427

@@ -47,3 +50,20 @@ def get_env_or_raise(key):
4750

4851
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
4952
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
53+
54+
# 兼容低版本 MySQL
55+
class PatchFeatures:
56+
@cached_property
57+
def minimum_database_version(self):
58+
django_version = django.VERSION
59+
if self.connection.mysql_is_mariadb:
60+
return 10, 4
61+
elif django_version < (4, 0):
62+
import pymysql
63+
pymysql.install_as_MySQLdb()
64+
return 5, 7
65+
else:
66+
return 8, 0
67+
68+
# 目前 Django 仅是对 5.7 做了软性的不兼容改动,在没有使用 8.0 特异的功能时,对 5.7 版本的使用无影响
69+
DatabaseFeatures.minimum_database_version = PatchFeatures.minimum_database_version

runtime/bk-plugin-runtime/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[tool.poetry]
22
name = "bk-plugin-runtime"
3-
version = "2.1.0rc2"
3+
version = "2.1.0rc3"
44
description = "bk plugin python django runtime"
55
authors = ["Your Name <you@example.com>"]
66
license = "MIT"
77

88
[tool.poetry.dependencies]
99
python = "^3.8.0,<4.0"
1010
redis = ">=2.10.5,<6"
11-
Django = "^4.2"
11+
Django = ">=2.2.6,<5"
1212
pymysql = ">=1,<2"
1313
gunicorn = ">=19.6.0"
1414
djangorestframework = "^3.15"

0 commit comments

Comments
 (0)