Conversation
Added `mcp_session_idle_timeout_seconds` configuration option to both Community and Enterprise servers to control automatic cleanup of idle per-session Deephaven registries. Default is 3600 seconds (1 hour). Updated documentation to describe the new setting and its placement in config files. - Added `.python-version` file specifying Python 3.12 - Updated README.md to document `mcp_session_idle_timeout_seconds` in Enterprise
Removed `CommunitySessionConfigurationError` and `EnterpriseSystemConfigurationError` exception classes and their references throughout the codebase. All configuration validation now raises the base `ConfigurationError` exception instead of specialized subclasses. - Removed exception class definitions and documentation from `_exceptions.py` - Updated `_session.py` to use `ConfigurationError` and renamed validation function from `validate_single_community_session_config` to `validate_community_session_config` - Updated `_session_factory.py` to use `ConfigurationError` instead
- Removed unused `TYPE_CHECKING` imports from resource manager modules - Added `validate_community_config` and `redact_community_config` to config module exports - Alphabetized validator and redaction function exports in `__all__`
…as minimum version - Removed Python 3.11 from test matrices in unit-tests.yml and integration-tests.yml - Updated build-wheels.yml and publish-wheels.yml to build with Python 3.12 - Updated reusable-build-wheel.yml example documentation to show Python 3.12
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes the project to Python 3.12, refactors configuration handling into dedicated community/enterprise modules (including a new mcp_session_idle_timeout_seconds setting), and introduces per-MCP-session Deephaven registry lifecycle management with idle-timeout cleanup.
Changes:
- Add
SessionRegistryManagerto manage one Deephaven registry per MCP client session with idle-TTL sweeping; update server lifespan/tools to use it. - Refactor config into
deephaven_mcp.config.community/deephaven_mcp.config.enterprisewith shared validators, plus docs updates formcp_session_idle_timeout_seconds. - Raise minimum Python to 3.12 and modernize typing/overrides; remove unused configuration exception subclasses and update tests accordingly.
Reviewed changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
.python-version |
Sets runtime Python to 3.12. |
pyproject.toml |
Bumps requires-python to 3.12 and updates dependency/tooling constraints. |
README.md |
Documents new mcp_session_idle_timeout_seconds server setting. |
docs/DEVELOPER_GUIDE.md |
Documents new idle-timeout setting and clarifies per-client registry behavior. |
src/deephaven_mcp/_exceptions.py |
Removes unused configuration exception subclasses; consolidates under ConfigurationError. |
src/deephaven_mcp/config/__init__.py |
Updates public re-export surface for new config modules/APIs and constants. |
src/deephaven_mcp/config/_base.py |
Adds DEFAULT_MCP_SESSION_IDLE_TIMEOUT_SECONDS and get_mcp_session_idle_timeout_seconds(). |
src/deephaven_mcp/config/_validators.py |
Introduces shared validation helpers used by both config modules. |
src/deephaven_mcp/config/community.py |
New community config validation/redaction including mcp_session_idle_timeout_seconds. |
src/deephaven_mcp/config/enterprise.py |
New enterprise config validation/redaction including mcp_session_idle_timeout_seconds. |
src/deephaven_mcp/mcp_systems_server/_session_registry_manager.py |
New per-MCP-session registry manager with idle TTL expiry and close semantics. |
src/deephaven_mcp/mcp_systems_server/_lifespan.py |
Lifespan now starts/stops SessionRegistryManager and yields it in context. |
src/deephaven_mcp/mcp_systems_server/server.py |
Wires in idle-timeout reading and per-session registry manager for community/enterprise servers. |
src/deephaven_mcp/mcp_systems_server/_tools/shared.py |
Adds helpers to resolve session id + per-session registry via SessionRegistryManager. |
src/deephaven_mcp/mcp_systems_server/_tools/reload.py |
Reload now clears config cache + closes only the calling MCP session registry. |
src/deephaven_mcp/mcp_systems_server/_tools/session.py |
Uses per-session registry lookup instead of a global registry in lifespan. |
src/deephaven_mcp/mcp_systems_server/_tools/session_community.py |
Switches to per-session registry + consolidated ConfigurationError; updates context usage. |
src/deephaven_mcp/mcp_systems_server/_tools/session_enterprise.py |
Switches to per-session registry + updated enterprise config redaction API. |
src/deephaven_mcp/mcp_systems_server/_tools/pq.py |
Switches enterprise registry access to per-session registry helper. |
src/deephaven_mcp/resource_manager/__init__.py |
Re-exports InstanceTracker and orphan cleanup helpers. |
src/deephaven_mcp/resource_manager/_registry.py |
Updates generics/override usage for Python 3.12 typing modernization. |
src/deephaven_mcp/resource_manager/_registry_community.py |
Uses stdlib typing.override (Python 3.12+). |
src/deephaven_mcp/resource_manager/_registry_enterprise.py |
Uses stdlib typing.override (Python 3.12+). |
src/deephaven_mcp/resource_manager/_manager.py |
Updates generics syntax + override import for Python 3.12 typing modernization. |
src/deephaven_mcp/client/_base.py |
Updates generic wrapper syntax to Python 3.12 style. |
src/deephaven_mcp/client/_session.py |
Updates typing/override usage; switches to consolidated ConfigurationError and new validator name. |
src/deephaven_mcp/client/_session_factory.py |
Switches enterprise config validation error handling to ConfigurationError. |
src/deephaven_mcp/client/_protobuf.py |
Uses stdlib typing.override for Python 3.12+. |
tests/test__version.py |
Minor formatting tweak. |
tests/test__exceptions.py |
Updates tests for removed exception subclasses (now consolidated). |
tests/config/test_init.py |
Updates config surface smoke tests for new exports/constants. |
tests/config/test__base.py |
Adds tests for get_mcp_session_idle_timeout_seconds. |
tests/config/test__validators.py |
Adds coverage for new shared config validators. |
tests/config/test_community.py |
Adds tests for new community config module validation/redaction. |
tests/config/test_enterprise.py |
Adds tests for new enterprise config module validation/redaction. |
tests/mcp_systems_server/test_server.py |
Updates server entrypoint tests for idle-timeout + lifespan signature changes. |
tests/mcp_systems_server/_tools/conftest.py |
Adds request/header mocking and a SessionRegistryManager mock factory. |
tests/mcp_systems_server/_tools/test_shared.py |
Adds coverage for new shared context helpers (session id, registry access, etc.). |
tests/mcp_systems_server/_tools/test_reload.py |
Updates reload tests to per-session close semantics and new context keys. |
tests/mcp_systems_server/_tools/test_session.py |
Updates tool tests to use session_registry_manager in context. |
tests/mcp_systems_server/_tools/test_script.py |
Updates tool tests to use session_registry_manager in context. |
tests/mcp_systems_server/_tools/test_table.py |
Updates tool tests to use session_registry_manager in context. |
tests/mcp_systems_server/_tools/test_catalog.py |
Updates tool tests to use session_registry_manager in context. |
tests/resource_manager/test_init.py |
Updates resource_manager.__all__ surface expectations. |
tests/resource_manager/test__launcher.py |
Stabilizes launcher tests by patching executable discovery. |
tests/client/test__session_factory.py |
Updates tests for consolidated ConfigurationError. |
tests/client/test__session.py |
Updates expected mutually-exclusive validation error wording. |
- Cast session_id to str in get_mcp_session_id to ensure type consistency - Add explicit float type annotation for timeout variable in _read_idle_timeout
- Removed standalone pydocstyle tool and workflow in favor of ruff's built-in pydocstyle (D) rules - Added "D" rules to ruff's select list and configured pydocstyle convention as "pep257" - Added per-file-ignores to exclude test files from docstring checks - Removed pydocstyle from lint dependencies and precommit script - Updated documentation to reflect that ruff now handles both linting and docstring style checking
… single operation - Merged `_validate_config_or_exit` and `_read_idle_timeout` into `_validate_config_and_get_idle_timeout` to eliminate duplicate config file reads - Added `_load_config_and_idle_timeout` helper that leverages ConfigManager's internal caching to read config once for both validation and timeout extraction - Updated `enterprise()` and `community()` server entry points to use the consolidated function - Fixed doc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several important updates across the codebase and documentation. The main changes are: raising the minimum supported Python version to 3.12 (with corresponding dependency and configuration updates), enhancing documentation for new configuration options (notably
mcp_session_idle_timeout_seconds), and cleaning up exception handling by removing unused exception subclasses. Additionally, there are minor improvements to type hinting and code modernization.Key changes include:
Python Version and Dependency Updates
.python-version,pyproject.toml, and mypy configuration. Updated dependencies to match Python 3.12 compatibility, including test and lint dependencies. [1] [2] [3] [4] [5] [6] [7] [8]numbaandpytestdependencies to versions compatible with Python 3.12. [1] [2]Configuration and Documentation Enhancements
mcp_session_idle_timeout_secondsconfiguration option for both Enterprise and Community servers, specifying its purpose and default value. UpdatedREADME.mdanddocs/DEVELOPER_GUIDE.mdaccordingly. [1] [2] [3] [4] [5]Exception Handling Simplification
CommunitySessionConfigurationErrorandEnterpriseSystemConfigurationErrorfrom_exceptions.py, consolidating configuration error handling underConfigurationError. [1] [2] [3] [4]Type Hinting and Modernization
ClientObjectWrapper[T]), and replacedtyping_extensions.overridewith the standard libraryoverridewhere appropriate. Cleaned up related imports. [1] [2] [3] [4] [5]These changes collectively modernize the codebase, improve configuration flexibility, and enhance documentation clarity.