Skip to content

Commit 65ce62d

Browse files
authored
Change pylint settings (#244)
* pylintrc config Signed-off-by: Mihai Criveti <[email protected]> * Pylint cleanup Signed-off-by: Mihai Criveti <[email protected]> * pylint cleanup Signed-off-by: Mihai Criveti <[email protected]> * pylint cleanup Signed-off-by: Mihai Criveti <[email protected]> * pylint cleanup Signed-off-by: Mihai Criveti <[email protected]> --------- Signed-off-by: Mihai Criveti <[email protected]>
1 parent 2e2106c commit 65ce62d

File tree

7 files changed

+44
-14
lines changed

7 files changed

+44
-14
lines changed

.pylintrc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ persistent=yes
8888

8989
# Minimum Python version to use for version dependent checks. Will default to
9090
# the version used to run pylint.
91-
py-version=3.9
91+
py-version=3.11
9292

9393
# Discover python modules and packages in the file system subtree.
9494
recursive=no
@@ -291,7 +291,7 @@ max-args=12
291291
max-positional-arguments = 6
292292

293293
# Maximum number of attributes for a class (see R0902).
294-
max-attributes=10
294+
max-attributes=16
295295

296296
# Maximum number of boolean expressions in an if statement (see R0916).
297297
max-bool-expr=5
@@ -397,7 +397,9 @@ preferred-modules=
397397

398398
# The type of string formatting that logging methods do. `old` means using %
399399
# formatting, `new` is for `{}` formatting.
400-
logging-format-style=new
400+
# Mihai: Not having this set to old triggers: E1205 (logging-too-many-args)
401+
#logging-format-style=new
402+
logging-format-style=old
401403

402404
# Logging modules to check that the string format arguments are in logging
403405
# function parameter format.
@@ -476,7 +478,7 @@ notes-rgx=
476478
[REFACTORING]
477479

478480
# Maximum number of nested blocks for function / method body
479-
max-nested-blocks=5
481+
max-nested-blocks=6
480482

481483
# Complete name of functions that never returns. When checking for
482484
# inconsistent-return-statements if a never returning function is called then

docs/docs/development/developer-onboarding.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
- [ ] Node.js and npm, npx (used for testing with `supergateway` and the HTML/JS Admin UI)
1212
- [ ] Docker, Docker Compose, and Podman
1313
- [ ] Make, GitHub CLI (`gh`), `curl`, `jq`, `openssl`
14-
- [ ] Optional: Visual Studio Code + Dev Containers extension (or WSL2 if on Windows)
14+
- [ ] Optional: Visual Studio Code + Dev Containers extension (or WSL2 if on Windows) + Pyrefly
15+
- [ ] Optional: On Windows, install the WSL and Remote Development extensions
1516

1617
???+ check "Python tooling"
1718
- [ ] `pip install --upgrade pip`

mcpgateway/bootstrap_db.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# -*- coding: utf-8 -*-
2-
# mcpgateway/bootstrap_db.py
2+
"""Database bootstrap/upgrade entry-point for MCP Gateway.
3+
4+
Copyright 2025
5+
SPDX-License-Identifier: Apache-2.0
6+
Authors: Madhav Kandukuri
7+
8+
The script:
9+
10+
1. Creates a synchronous SQLAlchemy ``Engine`` from ``settings.database_url``.
11+
2. Looks for an *alembic.ini* two levels up from this file to drive migrations.
12+
3. If the database is still empty (no ``gateways`` table), it:
13+
- builds the base schema with ``Base.metadata.create_all()``
14+
- stamps the migration head so Alembic knows it is up-to-date
15+
4. Otherwise, it applies any outstanding Alembic revisions.
16+
5. Logs a **"Database ready"** message on success.
17+
18+
It is intended to be invoked via ``python -m mcpgateway.bootstrap_db`` or
19+
directly with ``python mcpgateway/bootstrap_db.py``.
20+
"""
21+
322
# Standard
423
import asyncio
524
import logging
@@ -17,12 +36,15 @@
1736
logger = logging.getLogger(__name__)
1837

1938

20-
async def main():
39+
async def main() -> None:
2140
"""
2241
Bootstrap or upgrade the database schema, then log readiness.
2342
2443
Runs `create_all()` + `alembic stamp head` on an empty DB, otherwise just
2544
executes `alembic upgrade head`, leaving application data intact.
45+
46+
Args:
47+
None
2648
"""
2749
engine = create_engine(settings.database_url)
2850
project_root = Path(__file__).resolve().parents[1]
@@ -34,7 +56,7 @@ async def main():
3456

3557
insp = inspect(engine)
3658
if "gateways" not in insp.get_table_names():
37-
logger.info("Empty DB detected creating baseline schema")
59+
logger.info("Empty DB detected - creating baseline schema")
3860
Base.metadata.create_all(engine)
3961
command.stamp(cfg, "head") # record baseline
4062
else:

mcpgateway/db.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,13 @@
110110
# ---------------------------------------------------------------------------
111111
# 6. Function to return UTC timestamp
112112
# ---------------------------------------------------------------------------
113-
def utc_now():
113+
def utc_now() -> datetime:
114+
"""Return the current Coordinated Universal Time (UTC).
115+
116+
Returns:
117+
datetime: A timezone-aware `datetime` whose `tzinfo` is
118+
`datetime.timezone.utc`.
119+
"""
114120
return datetime.now(timezone.utc)
115121

116122

@@ -122,6 +128,7 @@ class Base(DeclarativeBase):
122128
"""Base class for all models."""
123129

124130

131+
# TODO: cleanup, not sure why this is commented out?
125132
# # Association table for tools and gateways (federation)
126133
# tool_gateway_table = Table(
127134
# "tool_gateway_association",

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ classifiers = [
2424
"Programming Language :: Python :: 3",
2525
"Programming Language :: Python :: 3.11",
2626
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
2728
"Framework :: FastAPI",
2829
"Framework :: AsyncIO",
2930
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
3031
"Topic :: Software Development :: Libraries :: Application Frameworks"
3132
]
3233
readme = "README.md"
33-
requires-python = ">=3.11,<3.13"
34+
requires-python = ">=3.11,<3.14"
3435

3536
# SPDX licence expression + explicit licence file (PEP 639)
3637
license = "Apache-2.0"

tests/unit/mcpgateway/transports/test_sse_transport.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
# Standard
1313
import asyncio
1414
import json
15-
import types
16-
from unittest.mock import AsyncMock, Mock, patch
15+
from unittest.mock import Mock, patch
1716

1817
# Third-Party
1918
from fastapi import Request

tests/unit/mcpgateway/transports/test_websocket_transport.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
"""
1010

1111
# Standard
12-
import asyncio
1312
import logging
14-
import types
1513
from unittest.mock import AsyncMock
1614

1715
# Third-Party

0 commit comments

Comments
 (0)