Skip to content

Conversation

@chrisdoc
Copy link

Description

This PR adds ruff linting and formatting to the project, it does so by creating a ruff.toml configuration in the root directory. It also adds a ruff check command to the python github workflow to ensure PRs are checked against the ruff configuration.

Motivation and Context

To have a common line rules and code style including formatting.

How Has This Been Tested?

Locally by running uvx ruff check

Breaking Changes

Requires linting and reformatting existing code.

Types of changes

  • New MCP Server
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My server follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

Copy link
Member

@dsp-ant dsp-ant left a comment

Choose a reason for hiding this comment

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

In generally I like this. If we accept this, we should make the same change to the Python-SDK.

@dsp-ant dsp-ant self-requested a review November 27, 2024 09:56
@chrisdoc
Copy link
Author

Thanks for the feedback @dsp-ant , I made a few changes and I can create another PR in the Python SDK once this gets merged into main

Copy link
Member

@dsp-ant dsp-ant left a comment

Choose a reason for hiding this comment

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

I think this looks good as is.

At the moment all projects manage their own pyproject and venv. We might want to consider to have toplevel pyproject.toml to ensure we have ruff avaialble and that it gets picked up. I am actually not sure what the most pythonic approach here is. At the moment one would have to do uvx ruff and the checks aren't clear.

Do you mind making sure the repo is clear of lint issues before we merge this?

@dsp-ant dsp-ant force-pushed the main branch 23 times, most recently from 95f0c00 to 111806d Compare January 13, 2025 19:43
@dsp-ant dsp-ant force-pushed the main branch 20 times, most recently from c114833 to 4f3dc11 Compare January 14, 2025 03:05
@djwessel
Copy link

@dsp-ant what's missing to merge this in? Is it just addressing the current lint issues in the repo? If so I can open a new PR with those fixes (there doesn't seem to be too many issues as far as I've seen).

@jerome3o-anthropic
Copy link
Member

hey @djwessel - sorry for the delay here - this looks like a good change, when it lands will it block merges/deploys (i.e. are there are tonne of formatting needed for all the servers?)

Copy link
Member

@cliffhall cliffhall left a comment

Choose a reason for hiding this comment

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

Hi @chrisdoc! This is a good improvement, but two things:

  1. Discrepancy between what's run in python.yml and what's documented in CONTRIBUTING.md. Running it at the root level turns up an error in scripts/release.py. But the python.yml runs ruff in src/ and would not catch those errors.
  2. There are a bunch errors that would cause the Github workflow to fail. I think this PR has to fix those (or add another PR and get it merged before this one).
warning: `incorrect-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `incorrect-blank-line-before-class`.
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.
scripts/release.py:196:5: F841 Local variable `version` is assigned to but never used
    |
194 |     # Detect package type
195 |     path = directory.resolve(strict=True)
196 |     version = gen_version()
    |     ^^^^^^^ F841
197 |
198 |     changes = []
    |
    = help: Remove assignment to unused variable `version`

src/fetch/src/mcp_server_fetch/server.py:1:1: UP035 `typing.Tuple` is deprecated, use `tuple` instead
  |
1 | from typing import Annotated, Tuple
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
2 | from urllib.parse import urlparse, urlunparse
  |

src/fetch/src/mcp_server_fetch/server.py:114:6: UP006 Use `tuple` instead of `Tuple` for type annotation
    |
112 | async def fetch_url(
113 |     url: str, user_agent: str, force_raw: bool = False, proxy_url: str | None = None
114 | ) -> Tuple[str, str]:
    |      ^^^^^ UP006
115 |     """Fetch the URL and return the content in a form ready for the LLM, as well as a prefix string with status information.
116 |     """
    |
    = help: Replace with `tuple`

src/fetch/src/mcp_server_fetch/server.py:115:5: D200 One-line docstring should fit on one line
    |
113 |       url: str, user_agent: str, force_raw: bool = False, proxy_url: str | None = None
114 |   ) -> Tuple[str, str]:
115 | /     """Fetch the URL and return the content in a form ready for the LLM, as well as a prefix string with status information.
116 | |     """
    | |_______^ D200
117 |       from httpx import AsyncClient, HTTPError
    |
    = help: Reformat to one line

Found 30 errors (26 fixed, 4 remaining).
No fixes available (3 hidden fixes can be enabled with the `--unsafe-fixes` option).
cliffhall@Millennium-Falcon mcp-servers % git merge main
Already up to date.
cliffhall@Millennium-Falcon mcp-servers % uvx ruff check                                 
warning: `incorrect-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `incorrect-blank-line-before-class`.
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.
scripts/release.py:196:5: F841 Local variable `version` is assigned to but never used
    |
194 |     # Detect package type
195 |     path = directory.resolve(strict=True)
196 |     version = gen_version()
    |     ^^^^^^^ F841
197 |
198 |     changes = []
    |
    = help: Remove assignment to unused variable `version`

src/fetch/src/mcp_server_fetch/server.py:1:1: UP035 `typing.Tuple` is deprecated, use `tuple` instead
  |
1 | from typing import Annotated, Tuple
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP035
2 | from urllib.parse import urlparse, urlunparse
  |

src/fetch/src/mcp_server_fetch/server.py:114:6: UP006 Use `tuple` instead of `Tuple` for type annotation
    |
112 | async def fetch_url(
113 |     url: str, user_agent: str, force_raw: bool = False, proxy_url: str | None = None
114 | ) -> Tuple[str, str]:
    |      ^^^^^ UP006
115 |     """Fetch the URL and return the content in a form ready for the LLM, as well as a prefix string with status information.
116 |     """
    |
    = help: Replace with `tuple`

src/fetch/src/mcp_server_fetch/server.py:115:5: D200 One-line docstring should fit on one line
    |
113 |       url: str, user_agent: str, force_raw: bool = False, proxy_url: str | None = None
114 |   ) -> Tuple[str, str]:
115 | /     """Fetch the URL and return the content in a form ready for the LLM, as well as a prefix string with status information.
116 | |     """
    | |_______^ D200
117 |       from httpx import AsyncClient, HTTPError
    |
    = help: Reformat to one line

Found 4 errors.

@cliffhall cliffhall added enhancement New feature or request waiting for submitter Waiting for the submitter to provide more info labels Apr 15, 2025
@cliffhall
Copy link
Member

Closing as this appears to be abandoned

@cliffhall cliffhall closed this Jul 3, 2025
alejandrorico9 pushed a commit to bukhr/MCPservers that referenced this pull request Jul 15, 2025
…redential_injection

feat: support google client secret injection via environment variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request waiting for submitter Waiting for the submitter to provide more info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants