-
Notifications
You must be signed in to change notification settings - Fork 9.1k
feat: Add Ruff for linting and create configuration file #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dsp-ant
left a comment
There was a problem hiding this 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.
|
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 |
dsp-ant
left a comment
There was a problem hiding this 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?
95f0c00 to
111806d
Compare
c114833 to
4f3dc11
Compare
|
@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). |
|
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?) |
cliffhall
left a comment
There was a problem hiding this 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:
- Discrepancy between what's run in
python.ymland what's documented inCONTRIBUTING.md. Running it at the root level turns up an error inscripts/release.py. But thepython.ymlrunsruffinsrc/and would not catch those errors. - 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.|
Closing as this appears to be abandoned |
…redential_injection feat: support google client secret injection via environment variables
Description
This PR adds ruff linting and formatting to the project, it does so by creating a
ruff.tomlconfiguration 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 checkBreaking Changes
Requires linting and reformatting existing code.
Types of changes
Checklist
Additional context