Skip to content

Commit 21588b7

Browse files
committed
fix: Python 3.14, CI fixes, and pre-commit format check
- Fix ruff formatting and mypy return type error in download_post_attachment - Update all Python version references to 3.14 (CI, release, Dockerfile, pyproject.toml, pre-commit, ruff target-version) - Pre-commit now uses ruff format --check to match CI behavior - Update author email to work address
1 parent 4068b70 commit 21588b7

8 files changed

Lines changed: 31 additions & 31 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Python
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.12'
23+
python-version: '3.14'
2424

2525
- name: Install uv
2626
uses: astral-sh/setup-uv@v3
@@ -38,21 +38,18 @@ jobs:
3838
run: uv run mypy src/pararam_nexus_mcp --ignore-missing-imports
3939

4040
test:
41-
name: Test Python ${{ matrix.python-version }}
41+
name: Test
4242
runs-on: ubuntu-latest
43-
strategy:
44-
matrix:
45-
python-version: ['3.12', '3.13']
4643

4744
steps:
4845
- uses: actions/checkout@v4
4946
with:
5047
fetch-depth: 0 # Fetch all history for proper versioning
5148

52-
- name: Set up Python ${{ matrix.python-version }}
49+
- name: Set up Python
5350
uses: actions/setup-python@v5
5451
with:
55-
python-version: ${{ matrix.python-version }}
52+
python-version: '3.14'
5653

5754
- name: Install uv
5855
uses: astral-sh/setup-uv@v3
@@ -77,7 +74,7 @@ jobs:
7774
- name: Set up Python
7875
uses: actions/setup-python@v5
7976
with:
80-
python-version: '3.12'
77+
python-version: '3.14'
8178

8279
- name: Install uv
8380
uses: astral-sh/setup-uv@v3

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Python
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.12'
23+
python-version: '3.14'
2424

2525
- name: Install build tools
2626
run: |
@@ -103,7 +103,7 @@ jobs:
103103
- name: Set up Python
104104
uses: actions/setup-python@v5
105105
with:
106-
python-version: '3.12'
106+
python-version: '3.14'
107107

108108
- name: Install build tools
109109
run: |

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ repos:
1515
require_serial: true
1616

1717
- id: ruff-format
18-
name: ruff (format)
19-
entry: uv run ruff format
18+
name: ruff (format check)
19+
entry: uv run ruff format --check
2020
language: system
2121
types: [python]
2222
args: [src/]
@@ -58,7 +58,7 @@ repos:
5858

5959
# Configuration
6060
default_language_version:
61-
python: python3.13
61+
python: python3.14
6262

6363
# Run on all files by default
6464
files: ''
@@ -68,4 +68,4 @@ exclude: '^(\.git|\.venv|venv|build|dist|\.egg|\.pytest_cache|__pycache__|htmlco
6868
fail_fast: false
6969

7070
# Default stages
71-
default_stages: [pre-commit]
71+
default_stages: [pre-commit]

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
WORKDIR /app
44

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ name = "pararam-nexus-mcp"
33
version = "0.1.0"
44
description = "Model Context Protocol server for pararam.io - a modern communication and collaboration platform"
55
readme = "README.md"
6-
requires-python = ">=3.13"
6+
requires-python = ">=3.14"
77
license = { text = "MIT" }
88
authors = [
9-
{ name = "Ilya Volnistov", email = "i.volnistov@gmail.com" }
9+
{ name = "Ilya Volnistov", email = "i.volnistov@gaijin.team" }
1010
]
1111
keywords = ["mcp", "pararam", "pararam.io", "communication", "messaging", "fastmcp", "async"]
1212
classifiers = [
1313
"Development Status :: 3 - Alpha",
1414
"Intended Audience :: Developers",
1515
"License :: OSI Approved :: MIT License",
1616
"Programming Language :: Python :: 3",
17-
"Programming Language :: Python :: 3.13",
17+
"Programming Language :: Python :: 3.14",
1818
"Topic :: Communications :: Chat",
1919
"Topic :: Software Development :: Libraries",
2020
"Framework :: AsyncIO",
@@ -73,7 +73,7 @@ exclude = [
7373
]
7474
line-length = 120
7575
indent-width = 4
76-
target-version = "py313"
76+
target-version = "py314"
7777

7878
[tool.ruff.lint]
7979
select = [
@@ -137,7 +137,7 @@ line-ending = "auto"
137137

138138
# MyPy configuration
139139
[tool.mypy]
140-
python_version = "3.13"
140+
python_version = "3.14"
141141
strict = true
142142
show_column_numbers = true
143143
show_error_context = false

src/pararam_nexus_mcp/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
class PararamClient:
1717
"""Wrapper for AsyncPararamio with cookie storage and session management. Singleton."""
1818

19-
_instance: 'PararamClient | None' = None
19+
_instance: PararamClient | None = None
2020

21-
def __new__(cls) -> 'PararamClient':
21+
def __new__(cls) -> PararamClient:
2222
"""Create or return singleton instance."""
2323
if cls._instance is None:
2424
cls._instance = super().__new__(cls)
@@ -33,7 +33,7 @@ def __init__(self) -> None:
3333
self._cookie_manager: AsyncFileCookieManager = AsyncFileCookieManager(str(config.pararam_cookie_file))
3434
self._initialized: bool = True
3535

36-
async def __aenter__(self) -> 'PararamClient':
36+
async def __aenter__(self) -> PararamClient:
3737
"""Async context manager entry."""
3838
await self.connect()
3939
return self

src/pararam_nexus_mcp/schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class UploadFileToChatInput(BaseModel):
5353
reply_to_message_id: str | None = Field(None, pattern=r'^\d+$', description='Reply to post number')
5454

5555
@model_validator(mode='after')
56-
def validate_file_source(self) -> 'UploadFileToChatInput':
56+
def validate_file_source(self) -> UploadFileToChatInput:
5757
"""Validate that only one file source is provided."""
5858
if self.file_path and self.file_content:
5959
raise ValueError('Cannot specify both file_path and file_content')

src/pararam_nexus_mcp/tools/posts.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,7 @@ async def get_chat_messages(
374374
try:
375375
client = await get_client()
376376

377-
logger.info(
378-
f'Getting messages from chat {chat_id}, limit: {limit}, before_message_id: {before_message_id}'
379-
)
377+
logger.info(f'Getting messages from chat {chat_id}, limit: {limit}, before_message_id: {before_message_id}')
380378

381379
# Get chat by ID
382380
chat = await client.client.get_chat_by_id(int(chat_id))
@@ -817,9 +815,7 @@ async def upload_file_to_chat(
817815
file_size = uploaded_file.size or actual_path.stat().st_size
818816

819817
chat_name = chat.title or 'Unknown'
820-
message_text = (
821-
f"File '{file_name}' uploaded successfully to chat '{chat_name}' ({file_size} bytes)"
822-
)
818+
message_text = f"File '{file_name}' uploaded successfully to chat '{chat_name}' ({file_size} bytes)"
823819

824820
return success_response(
825821
message=message_text,
@@ -1487,7 +1483,14 @@ async def download_post_attachment(
14871483
except Exception as e:
14881484
# Top-level handler to prevent MCP server crash on unexpected errors
14891485
logger.error('Unexpected error while downloading attachment: %s', e, exc_info=True)
1490-
return error_response(
1486+
return DownloadAttachmentErrorResponse(
14911487
message='Unexpected error occurred',
1488+
success=False,
14921489
error=f'Unexpected error: {e!s}',
1490+
chat_id=chat_id,
1491+
post_no=post_no,
1492+
file_guid=file_guid,
1493+
filename='',
1494+
size=0,
1495+
mime_type='',
14931496
)

0 commit comments

Comments
 (0)