fix: resolve Python 3.8/3.9 compatibility issues

- Fix incorrect os.sys.version_info to sys.version_info
- Add missing sys import
- Update setup.py version to match __version__
- Fix author name consistency (Fahad Gilani)
- Add typing-extensions for Python <3.10 compatibility
- Apply black formatting to fix whitespace issues
- Add debug workflow to help diagnose CI failures

This should resolve the failing tests on Python 3.8 and 3.9.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Fahad
2025-06-08 21:11:58 +04:00
parent 873354864a
commit ead177fe8a
3 changed files with 73 additions and 9 deletions

60
.github/workflows/test_debug.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Debug Test Failures
on:
workflow_dispatch:
push:
branches: [ main ]
jobs:
debug-python38:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Show Python version
run: |
python --version
python -c "import sys; print(sys.version_info)"
- name: Install basic dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip --version
- name: Try installing MCP
continue-on-error: true
run: |
pip install "mcp>=1.0.0" -v
- name: Try installing google-generativeai
continue-on-error: true
run: |
pip install "google-generativeai>=0.8.0" -v
- name: Install all dependencies
continue-on-error: true
run: |
pip install -e . -v
pip install -r requirements.txt -v
- name: Show installed packages
run: |
pip list
- name: Try importing modules
continue-on-error: true
run: |
python -c "import mcp" && echo "✓ mcp imported successfully" || echo "✗ Failed to import mcp"
python -c "import google.generativeai" && echo "✓ google.generativeai imported successfully" || echo "✗ Failed to import google.generativeai"
python -c "import gemini_server" && echo "✓ gemini_server imported successfully" || echo "✗ Failed to import gemini_server"
- name: Run a simple test
continue-on-error: true
run: |
python -m pytest tests/test_imports.py -v

View File

@@ -7,6 +7,7 @@ Enhanced for large-scale code analysis with 1M token context window
import asyncio
import json
import os
import sys
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
@@ -445,13 +446,14 @@ marked with their paths and content boundaries."""
"author": __author__,
"default_model": DEFAULT_MODEL,
"max_context_tokens": f"{MAX_CONTEXT_TOKENS:,}",
"python_version": f"{os.sys.version_info.major}.{os.sys.version_info.minor}.{os.sys.version_info.micro}",
"python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
"server_started": datetime.now().isoformat(),
}
return [TextContent(
type="text",
text=f"""🤖 Gemini MCP Server v{__version__}
return [
TextContent(
type="text",
text=f"""🤖 Gemini MCP Server v{__version__}
Updated: {__updated__}
Author: {__author__}
@@ -461,8 +463,9 @@ Configuration:
• Python: {version_info['python_version']}
• Started: {version_info['server_started']}
For updates, visit: https://github.com/BeehiveInnovations/gemini-mcp-server"""
)]
For updates, visit: https://github.com/BeehiveInnovations/gemini-mcp-server""",
)
]
else:
return [TextContent(type="text", text=f"Unknown tool: {name}")]

View File

@@ -13,17 +13,18 @@ if readme_path.exists():
setup(
name="gemini-mcp-server",
version="1.0.0",
version="2.2.0",
description="Model Context Protocol server for Google Gemini",
long_description=long_description,
long_description_content_type="text/markdown",
author="Fahad Yousaf",
author="Fahad Gilani",
python_requires=">=3.8",
py_modules=["gemini_server"],
install_requires=[
"mcp>=1.0.0",
"google-generativeai>=0.8.0",
"python-dotenv>=1.0.0",
"typing-extensions>=4.0.0;python_version<'3.10'",
],
extras_require={
"dev": [