Skip to content

Conversation

@doubledare704
Copy link
Owner

No description provided.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @doubledare704, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on refining the aiowhitebit-mcp package by updating dependencies, fixing internal issues, and improving the overall structure. The core changes include version bumps for ruff and pyright in the pre-commit configuration, updating the aiowhitebit dependency, modifying the project metadata in pyproject.toml and setup.py, and enhancing the client and server examples for better clarity and functionality. Additionally, there are changes to the caching mechanism and proxy to improve serialization and error handling.

Highlights

  • Dependency Updates: The pull request updates development dependencies such as ruff, pyright, and pre-commit to their latest versions in .pre-commit-config.yaml and requirements-dev.txt. It also updates the core dependency aiowhitebit to version 0.2.1 in requirements.txt.
  • Metadata Refinement: The pyproject.toml and setup.py files have been updated to include more comprehensive project metadata, such as authors, license information, classifiers, keywords, and project URLs. The version number has also been bumped from 0.2.2 to 0.2.4.
  • Example Enhancements: The example scripts have been improved with better documentation and clarity. Specifically, the claude_desktop_client.py and sse_client.py examples now include docstrings and comments to explain their functionality. The sse_server.py and claude_desktop_server.py examples have been simplified.
  • Code Improvements: Several code improvements have been made, including adding a custom JSON encoder to handle non-serializable objects in the cache, adding a utility function to extract text from responses, and correcting the method name in proxy.py.

Changelog

Click here to see the changelog
  • .pre-commit-config.yaml
    • Updated ruff version from v0.11.6 to v0.11.7.
    • Updated pyright version from v1.1.399 to v1.1.400.
  • MANIFEST.in
    • No functional change, just ensuring the file ends with a newline.
  • README.md
    • No functional change, just a formatting adjustment.
  • examples/README.md
    • No functional change, just ensuring the file ends with a newline.
  • examples/claude_desktop_client.py
    • Added docstring to the file and the use_mcp_client function to explain its purpose.
  • examples/claude_desktop_server.py
    • Simplified the server creation and running process.
  • examples/sse_client.py
    • Added docstring to the file and the check_server function to explain its purpose.
  • examples/sse_server.py
    • Simplified the server creation and running process.
  • pyproject.toml
    • Updated version from 0.2.2 to 0.2.4.
    • Added authors, license, classifiers, keywords, and project URLs.
    • Added a project script entrypoint.
    • Excluded tests/** from pyright's analysis.
  • requirements-dev.txt
    • Updated pytest-cov version from 4.1.0 to 6.1.1.
    • Updated ruff version from 0.11.5 to 0.11.7.
    • Updated pyright version from 1.1.399 to 1.1.400.
    • Updated pre-commit version from 3.6.2 to 4.2.0.
  • requirements.txt
    • Updated aiowhitebit version from 0.2.0 to 0.2.1.
  • setup.py
    • Updated version from 0.2.2 to 0.2.4.
    • Added long description from README.md.
    • Added author information and project URLs.
    • Added classifiers and keywords.
  • src/aiowhitebit_mcp/init.py
    • Updated version from 0.2.2 to 0.2.4.
  • src/aiowhitebit_mcp/cache.py
    • Added a custom JSON encoder to handle non-serializable objects.
    • Improved serialization of objects for caching.
  • src/aiowhitebit_mcp/cli.py
    • Imported asyncio to run the server asynchronously.
    • Modified the server execution to use asyncio.run.
  • src/aiowhitebit_mcp/client.py
    • Added a utility function _extract_text to extract text from responses.
    • Modified API calls to use the _extract_text function.
  • src/aiowhitebit_mcp/proxy.py
    • Corrected the import path for models.
    • Replaced result.dict() with result.model_dump() for pydantic v2 compatibility.
    • Removed the get_kline method.
    • Removed mock objects for testing and raise exceptions instead.
    • Corrected the method name from get_symbols to get_tickers and adjusted the logic to extract symbols.
    • Corrected the method name from get_assets to get_asset_status_list and adjusted the logic to extract assets.
  • src/aiowhitebit_mcp/server.py
    • Removed the get_kline tool.
    • Removed self argument from health function.
    • Added type ignore to websocket client disconnect.
    • Updated FastMCP transport validation and configuration.
    • Removed unused imports and variables.
  • src/aiowhitebit_mcp/templates/base.html
    • No functional change, just ensuring the file ends with a newline.
  • src/aiowhitebit_mcp/templates/cache.html
    • No functional change, just ensuring the file ends with a newline.
  • src/aiowhitebit_mcp/templates/circuit_breakers.html
    • No functional change, just ensuring the file ends with a newline.
  • src/aiowhitebit_mcp/templates/dashboard.html
    • Fixed syntax errors in the JavaScript chart configuration.
  • src/aiowhitebit_mcp/templates/health.html
    • No functional change, just ensuring the file ends with a newline.
  • src/aiowhitebit_mcp/templates/metrics.html
    • No functional change, just ensuring the file ends with a newline.
  • src/aiowhitebit_mcp/templates/rate_limiter.html
    • No functional change, just ensuring the file ends with a newline.
  • src/aiowhitebit_mcp/web_interface.py
    • No functional change, just ensuring the file ends with a newline.
  • tests/test_client.py
    • Added type ignore to client initialization.
  • tests/test_integration.py
    • Adjusted the logic to extract ticker data.
    • Adjusted the logic to extract asset data.
  • typings/aiowhitebit/clients/websocket.pyi
    • No functional change, just ensuring the file ends with a newline.
  • typings/fastmcp/types.pyi
    • No functional change, just ensuring the file ends with a newline.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A code's gentle breeze,
Updates flow with graceful ease,
New versions arise.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request updates dependencies, fixes minor issues, and enhances the WhiteBit MCP project. The changes include updating library versions, improving documentation, and refining code for better readability and maintainability. Overall, the changes seem beneficial, but some areas could be improved.

Summary of Findings

  • Missing asyncio.run() in cli.py: The server.run() calls in src/aiowhitebit_mcp/cli.py should be wrapped in asyncio.run() to properly execute the asynchronous server functions. This is now fixed.
  • Incorrect asset handling in tests: The test_get_assets function in tests/test_integration.py was asserting that the assets were a dictionary when they are actually a list. The assertion has been updated to reflect the correct data structure.
  • Redundant exception handling: In src/aiowhitebit_mcp/proxy.py, the get_ticker and get_tickers methods should re-raise exceptions instead of returning mock objects, as this provides more informative error handling.
  • Missing type ignore: In src/aiowhitebit_mcp/server.py, the disconnect_websocket and close methods are missing a type ignore comment for self.ws_client.disconnect() and await self.ws_client.close() respectively, which can lead to type checking errors.

Merge Readiness

The pull request is almost ready for merging. Addressing the identified issues, particularly the missing asyncio.run() calls in cli.py and the incorrect asset handling in tests/test_integration.py, is crucial. Additionally, re-raising exceptions in proxy.py and adding type ignores in server.py would improve the code's robustness and maintainability. I am unable to directly approve the pull request, and users should have others review and approve this code before merging. Once these points are addressed, the pull request should be in good shape for merging.

- Refactor private API tests to use manual server/client creation
- Add proper cleanup with try/finally blocks
- Ensure server is closed after each test
- Set explicit asyncio_default_fixture_loop_scope in pytest config

The changes improve test isolation and follow the integration tests pattern.
Each test now creates its own server and client instances, making tests
more reliable and easier to debug. The pytest configuration update removes
deprecation warning by explicitly setting the event loop scope to "function".
Enable unsafe fixes in Ruff configuration to allow automatic
fixing of docstring formatting and other similar issues.
This will help maintain consistent code style with less
manual intervention.
removed multiexchange
changed config for pyright
@doubledare704 doubledare704 merged commit dcc0edb into main May 3, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants