Skip to content

Commit 4f42271

Browse files
committed
feat: support python 3.12
1 parent 896a814 commit 4f42271

File tree

8 files changed

+838
-215
lines changed

8 files changed

+838
-215
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
'3.9',
1717
'3.10',
1818
'3.11',
19+
'3.12',
1920
]
2021
max-parallel: 4
2122

app/api/routers/mcp.py

Lines changed: 0 additions & 107 deletions
This file was deleted.

app/api/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ async def generate_text(
366366

367367
params = SamplingParams(max_tokens=max_tokens)
368368

369-
conversation, _ = parse_chat_messages(messages, model_config, tokenizer, content_format="string")
370-
prompt_tokens = apply_hf_chat_template(
369+
conversation, _ = parse_chat_messages(messages, model_config, tokenizer, content_format="string") # type: ignore
370+
prompt_tokens = apply_hf_chat_template( # type: ignore
371371
tokenizer,
372372
conversation=conversation,
373373
tools=None,
@@ -376,7 +376,7 @@ async def generate_text(
376376
chat_template="{% for message in messages %}\n{% if message['role'] == 'user' %}\nUser: {{ message['content'] }}\n{% elif message['role'] == 'assistant' %}\nAssistant: {{ message['content'] }}\n{% endif %}\n{% endfor %}\nAssistant:",
377377
tokenize=True,
378378
)
379-
prompt_obj = TokensPrompt(prompt_token_ids=prompt_tokens)
379+
prompt_obj = TokensPrompt(prompt_token_ids=prompt_tokens) # type: ignore
380380

381381
async def _stream() -> AsyncGenerator[bytes, None]:
382382
start = 0

app/model_services/medcat_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def init_model(self, *args: Any, **kwargs: Any) -> None:
143143
self._supervised_trainer = MedcatSupervisedTrainer(self)
144144
self._unsupervised_trainer = MedcatUnsupervisedTrainer(self)
145145
self._metacat_trainer = MetacatTrainer(self)
146-
self._model.config.general.map_to_other_ontologies = [
146+
self._model.config.general.map_to_other_ontologies = [ # type: ignore
147147
tui.strip() for tui in self._config.MEDCAT2_MAPPED_ONTOLOGIES.split(",")
148148
]
149149

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66
name = "cogstack-model-serve"
77
authors = [{name = "Xi Bai", email = "[email protected]"}]
88
description = "A model serving and governance system for CogStack NLP solutions"
9-
requires-python = ">3.9,<3.12"
9+
requires-python = ">3.9,<3.13"
1010
dynamic = ["version"]
1111
dependencies = [
1212
"medcat[spacy,meta-cat,deid,rel-cat]~=2.2.0; python_version>='3.10'",
@@ -28,7 +28,7 @@ dependencies = [
2828
"graypy~=2.1.0",
2929
"fastapi-users~=13.0.0",
3030
"fastapi-users-db-sqlalchemy~=5.0.0",
31-
"asyncpg~=0.27.0",
31+
"asyncpg~=0.29.0",
3232
"aiosqlite~=0.19.0",
3333
"evaluate~=0.4.1",
3434
"websockets~=12.0",

tests/app/trainers/test_medcat_trainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_save_model_pack():
4545
"model.zip",
4646
"model description",
4747
)
48-
model.save_model_pack.called_once_with("retrained_models_dir", "model")
48+
model.save_model_pack.assert_called_once_with("retrained_models_dir", "model")
4949
assert model.config.meta.description == "model description"
5050

5151

tests/app/trainers/test_metacat_trainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_save_model_pack():
4545
"model.zip",
4646
"model description",
4747
)
48-
model.save_model_pack.called_once_with("retrained_models_dir", "model")
48+
model.save_model_pack.assert_called_once_with("retrained_models_dir", "model")
4949
assert model.config.meta.description == "model description"
5050

5151

0 commit comments

Comments
 (0)