Update README.md
Browse files
README.md
CHANGED
|
@@ -8,7 +8,53 @@ sdk_version: 5.33.0
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
short_description: Analyzes Python code for docstring convention
|
| 12 |
---
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
+
tags:
|
| 12 |
+
- mcp-server-track
|
| 13 |
+
- pydocstyle
|
| 14 |
+
- code-analysis
|
| 15 |
+
- documentation
|
| 16 |
+
- modal
|
| 17 |
short_description: Analyzes Python code for docstring convention
|
| 18 |
---
|
| 19 |
|
| 20 |
+
## Pydocstyle Documentation Checker (via Modal MCP)
|
| 21 |
+
|
| 22 |
+
This Gradio application provides an interface to check Python code for documentation style issues using **Pydocstyle**. The analysis is performed by a Pydocstyle tool running on a [Modal Labs](https://modal.com) Multi-Compute-Platform (MCP) server.
|
| 23 |
+
|
| 24 |
+
### How to Use
|
| 25 |
+
|
| 26 |
+
1. **Input Parameters**:
|
| 27 |
+
* The input field expects a JSON object.
|
| 28 |
+
* This JSON object **must** contain a key named `"code"` whose value is the Python code string you want to analyze.
|
| 29 |
+
* An example is pre-filled for convenience:
|
| 30 |
+
```json
|
| 31 |
+
{
|
| 32 |
+
"code": "# No module docstring here\n\ndef example_function_missing_docstring():\n pass\n\nclass ExampleClassMissingDocstring:\n def method_missing_docstring(self):\n pass\n\ndef well_documented_function():\n \"\"\"This function is well documented.\"\"\"\n return True\n"
|
| 33 |
+
}
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
2. **Submit**: Click the "Submit" button.
|
| 37 |
+
|
| 38 |
+
3. **Output**:
|
| 39 |
+
* The application will send the code to the Pydocstyle tool on the Modal MCP server.
|
| 40 |
+
* The results of the Pydocstyle analysis will be displayed as a JSON object in the output field. This JSON will typically include:
|
| 41 |
+
* `tool`: "pydocstyle"
|
| 42 |
+
* `errors`: A list of documentation errors found, with details like error code, message, and line number.
|
| 43 |
+
* `files_checked`: Number of files checked (usually 1 for the provided code snippet).
|
| 44 |
+
* Any errors encountered during the process.
|
| 45 |
+
|
| 46 |
+
### Configuration
|
| 47 |
+
|
| 48 |
+
For this application to function correctly, the `MODAL_MCP_ENDPOINT` environment variable must be set. This variable should point to your deployed Modal function that handles MCP tool execution (e.g., the `/execute_tool` endpoint).
|
| 49 |
+
|
| 50 |
+
* Create a `.env` file in the `mcp_deploy` directory (or the root of your Space if deploying to Hugging Face Spaces and it's not automatically picked up from this directory).
|
| 51 |
+
* Add the following line to the `.env` file, replacing the placeholder with your actual Modal endpoint URL:
|
| 52 |
+
```
|
| 53 |
+
MODAL_MCP_ENDPOINT="https://your-username--mcp-server-app-execute-tool.modal.run"
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
If the `MODAL_MCP_ENDPOINT` is not set or is incorrect, the application will display an error message upon submission.
|
| 57 |
+
|
| 58 |
+
### Next step
|
| 59 |
+
|
| 60 |
+
Add more tools to analyse different other aspects.
|