Skip to content

Commit 5afb308

Browse files
committed
chore: compatible with py3.14
1 parent ca5b253 commit 5afb308

7 files changed

Lines changed: 49 additions & 20 deletions

File tree

.github/workflows/check-pytest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
python-version: ["3.10", "3.11", "3.12", "3.13"]
19+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
2020

2121
steps:
2222
- uses: actions/checkout@v4

.github/workflows/release-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- uses: actions/setup-python@v5
2222
with:
23-
python-version: "3.13"
23+
python-version: "3.14"
2424

2525
- name: Install system dependencies
2626
run: |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.13-alpine
1+
FROM python:3.14-alpine
22

33
ARG BUILD_ENV
44
ARG IMAGE_VERSION

asgi_webdav/response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from logging import getLogger
99

1010
if sys.version_info >= (3, 14):
11-
import zstd
11+
from compression import zstd
1212
else:
1313
from backports import zstd
1414

fabfile.py

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class EnvValue:
5858
# Target Host
5959
DEPLOY_STAGE = "dev"
6060
DEPLOY_SSH_HOST = "dev.h.rexzhang.com"
61-
DEPLOY_SSH_PORT = 22022
61+
DEPLOY_SSH_PORT = 22
6262
DEPLOY_SSH_USER = "root"
6363
DEPLOY_WORK_PATH = "/root/apps/asgi-webdav"
6464

@@ -67,7 +67,7 @@ class EnvValue:
6767
CR_NAME_SPACE = "rex"
6868

6969
# Docker Image
70-
DOCKER_BASE_IMAGE_TAG = "python:3.13-alpine"
70+
DOCKER_BASE_IMAGE_TAG = "python:3.14-alpine"
7171

7272
@property
7373
def DOCKER_IMAGE_FULL_NAME(self) -> str:
@@ -87,19 +87,28 @@ def get_container_name(self, module: str | None = None) -> str:
8787
CONTAINER_GID = 1000
8888
CONTAINER_UID = 1000
8989

90-
def switch_env_localhost(self):
91-
self.DEPLOY_STAGE = "localhost"
90+
def switch_env_local(self):
91+
self.DEPLOY_STAGE = "local"
9292
self.DEPLOY_WORK_PATH = "/tmp"
9393
self.CONTAINER_GID = 20
9494
self.CONTAINER_UID = 501
9595

96+
def switch_env_prd(self):
97+
self.DEPLOY_STAGE = "prd"
98+
self.DEPLOY_SSH_HOST = "prd.h.rexzhang.com"
99+
96100

97101
ev = EnvValue()
98102

99103

100104
@task
101-
def env_localhost(c):
102-
ev.switch_env_localhost()
105+
def env_local(c):
106+
ev.switch_env_local()
107+
108+
109+
@task
110+
def env_prd(c):
111+
ev.switch_env_prd()
103112

104113

105114
def docker_build(c):
@@ -132,19 +141,37 @@ def docker_deploy(c):
132141
)
133142

134143

144+
def run_restart_script(c):
145+
c.run(f"cd {ev.DEPLOY_WORK_PATH} && ./UpdateContainer.sh")
146+
147+
135148
@task
136149
def deploy(c):
137150
print("deploy container...")
138151

139-
if ev.DEPLOY_STAGE != "localhost":
140-
docker_push_image(c)
141-
142-
c = Connection(
143-
host=ev.DEPLOY_SSH_HOST, port=ev.DEPLOY_SSH_PORT, user=ev.DEPLOY_SSH_USER
144-
)
145-
docker_pull_image(c)
146-
147-
docker_deploy(c)
152+
match ev.DEPLOY_STAGE:
153+
case "local":
154+
docker_deploy(c)
155+
156+
case "dev":
157+
docker_push_image(c)
158+
c = Connection(
159+
host=ev.DEPLOY_SSH_HOST,
160+
port=ev.DEPLOY_SSH_PORT,
161+
user=ev.DEPLOY_SSH_USER,
162+
)
163+
docker_pull_image(c)
164+
docker_deploy(c)
165+
166+
case "prd":
167+
docker_push_image(c)
168+
c = Connection(
169+
host=ev.DEPLOY_SSH_HOST,
170+
port=ev.DEPLOY_SSH_PORT,
171+
user=ev.DEPLOY_SSH_USER,
172+
)
173+
docker_pull_image(c)
174+
run_restart_script(c)
148175

149176

150177
@task

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers = [
2121
"Programming Language :: Python :: 3.11",
2222
"Programming Language :: Python :: 3.12",
2323
"Programming Language :: Python :: 3.13",
24+
"Programming Language :: Python :: 3.14",
2425
"Topic :: Software Development :: Libraries :: Python Modules",
2526
]
2627

requirements.d/basic.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ ASGIMiddlewareStaticFile~=0.6.0
77
xmltodict~=1.0.2
88

99
# config
10-
dataclass-wizard[dotenv]<1.0
10+
dataclass-wizard[dotenv]<1.0; python_version < '3.14'
11+
dataclass-wizard[dotenv]>=0.35.4,<1.0; python_version >= '3.14'
1112
tomli; python_version < '3.11'
1213

1314
# misc

0 commit comments

Comments
 (0)