Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ make serve-ssl # HTTPS on :4444 (creates certs if needed)
### Code Quality
```bash
# After writing code
make autoflake isort black pre-commit
make autoflake isort ruff pre-commit

# Before committing, use ty, mypy and pyrefly to check just the new files, then run:
make ruff bandit interrogate pylint verify
Expand Down Expand Up @@ -391,7 +391,7 @@ exempt.
## Coding Standards

- **Python >= 3.11** with type hints; strict mypy
- **Formatting**: Black (line length 200), isort (profile=black)
- **Formatting**: Ruff format (line length 200), isort (profile=black)
- **Linting**: Ruff (`E3`,`E4`,`E7`,`E9`,`F`,`D1`), Pylint per `pyproject.toml`
- **Naming**: `snake_case` functions/modules, `PascalCase` classes, `UPPER_CASE` constants
- **Imports**: Group per isort sections (stdlib, third-party, first-party `mcpgateway`, local)
Expand Down Expand Up @@ -456,4 +456,4 @@ When posting PR reviews, issue comments, or any public-facing text on GitHub, us
- `make` for build/test automation
- `uv` for virtual environment management and for `uv tool run` linter invocations
- Dev-group tools installed in the venv: `pytest`, `mypy`, `bandit`, `pre-commit`, `prospector`, etc. (see `pyproject.toml` `[dependency-groups]`)
- Formatters and linters (`black`, `isort`, `ruff`, `pylint`, `vulture`, `interrogate`, `radon`, `yamllint`, `tomlcheck`) are pinned in the `Makefile` and invoked on demand via `uv tool run`; always prefer the Makefile targets (`make black`, `make ruff`, `make pylint`, etc.) over calling the underlying tools directly
- Formatters and linters (`isort`, `ruff`, `pylint`, `vulture`, `interrogate`, `radon`, `yamllint`, `tomlcheck`) are pinned in the `Makefile` and invoked on demand via `uv tool run`; always prefer the Makefile targets (`make ruff`, `make pylint`, etc.) over calling the underlying tools directly
25 changes: 9 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export UV_BIN
# Targets in this Makefile deliberately split how they use `uv`:
#
# * Execution: invoke tools via `$(VENV_DIR)/bin/<tool>` directly (e.g.
# pytest, black, ruff, pylint, python). `uv run` β€” even with `--active` β€”
# pytest, ruff, pylint, python). `uv run` β€” even with `--active` β€”
# has historically resolved against an unexpected environment when the
# caller has already `source`d the project venv, producing confusing
# "works on my machine" failures. Direct invocation removes the ambiguity:
Expand All @@ -224,7 +224,7 @@ export UV_BIN
# If you add a new target: use `$(VENV_DIR)/bin/<tool>` to *run* something and
# `uv pip ...` to *install* something. Do not reintroduce `uv run`.
#
# Exception β€” tools invoked via `uvx`: `black`, `isort`, `ruff`, `pylint`,
# Exception β€” tools invoked via `uvx`: `isort`, `ruff`, `pylint`,
# `vulture`, `interrogate`, `radon`, `yamllint`, `tomlcheck`, and
# `detect-secrets` are invoked through `uv tool run <spec>` with pinned
# versions (see the pins just below). This isolates the tool versions from
Expand All @@ -236,7 +236,7 @@ export UV_BIN
# to PyPI β€” see DETECT_SECRETS_SPEC below.
#
# Sub-exception β€” pylint needs project context: unlike the pure-AST tools
# (ruff, black, isort, vulture, interrogate, radon), pylint does deep type
# (ruff, isort, vulture, interrogate, radon), pylint does deep type
# inference via astroid and relies on being able to *import* the project
# modules and their runtime dependencies (pydantic, fastapi, …) to avoid
# false positives like E1133 (not-an-iterable) and spurious W0246
Expand Down Expand Up @@ -3603,11 +3603,10 @@ images:
# help: make lint - Run all linters on default targets (mcpgateway)
# help: make lint TARGET=myfile.py - Run file-aware linters on specific file
# help: make lint myfile.py - Run file-aware linters on a file (shortcut)
# help: make lint-quick myfile.py - Fast linters only (ruff, black, isort)
# help: make lint-quick myfile.py - Fast linters only (ruff, isort)
# help: make lint-fix myfile.py - Auto-fix formatting issues
# help: make lint-changed - Lint only git-changed files
# help: lint - Run the full linting suite (see targets below)
# help: black - Reformat code with black (CHECK=1 for dry-run)
# help: autoflake - Remove unused imports / variables with autoflake
# help: isort - Organise & sort imports with isort (CHECK=1 for dry-run)
# help: pylint - Pylint static analysis
Expand Down Expand Up @@ -3676,10 +3675,10 @@ LINTERS := isort pylint mypy bandit pydocstyle pycodestyle \
pytype check-manifest markdownlint vulture

# Linters that work well with individual files/directories
FILE_AWARE_LINTERS := isort black pylint mypy bandit pydocstyle \
FILE_AWARE_LINTERS := isort pylint mypy bandit pydocstyle \
pycodestyle ruff pyright vulture markdownlint

.PHONY: lint $(LINTERS) black black-check isort-check ruff-check ruff-fix ruff-format autoflake lint-py lint-yaml lint-json lint-md lint-strict \
.PHONY: lint $(LINTERS) isort-check ruff-check ruff-fix ruff-format autoflake lint-py lint-yaml lint-json lint-md lint-strict \
lint-count-errors lint-report lint-changed lint-staged lint-commit \
lint-pre-commit lint-pre-push lint-parallel lint-cache-clear lint-stats \
lint-complexity lint-watch lint-watch-quick \
Expand Down Expand Up @@ -3744,7 +3743,7 @@ lint-all:
## Convenience targets
## --------------------------------------------------------------------------- ##

# Quick lint - only fast linters (ruff, black, isort)
# Quick lint - only fast linters (ruff, isort)
.PHONY: lint-quick
lint-quick:
@# Handle file arguments
Expand All @@ -3754,9 +3753,8 @@ lint-quick:
else \
actual_target="$(TARGET)"; \
fi; \
echo "⚑ Quick lint of $$actual_target (ruff + black + isort)..."; \
echo "⚑ Quick lint of $$actual_target (ruff + isort)..."; \
$(MAKE) --no-print-directory ruff RUFF_MODE=check TARGET="$$actual_target"; \
$(MAKE) --no-print-directory black CHECK=1 TARGET="$$actual_target"; \
$(MAKE) --no-print-directory isort CHECK=1 TARGET="$$actual_target"

# Fix formatting issues
Expand All @@ -3776,7 +3774,7 @@ lint-fix:
fi; \
done; \
echo "πŸ”§ Fixing lint issues in $$actual_target..."; \
$(MAKE) --no-print-directory black TARGET="$$actual_target"; \
$(MAKE) --no-print-directory ruff RUFF_MODE=format TARGET="$$actual_target"; \
$(MAKE) --no-print-directory isort TARGET="$$actual_target"; \
$(MAKE) --no-print-directory ruff RUFF_MODE=fix TARGET="$$actual_target"

Expand Down Expand Up @@ -4084,11 +4082,7 @@ isort: uv ## πŸ”€ Sort imports (CHECK=1 for dry-run)
fi

# --- Deprecated aliases (use CHECK=1 instead) ---
# deprecated: black-check - Use "make black CHECK=1" instead (v1.2.0)
# deprecated: isort-check - Use "make isort CHECK=1" instead (v1.2.0)
black-check:
$(call deprecated_target,black-check,make black CHECK=1,1.2.0)
@$(MAKE) --no-print-directory black CHECK=1 TARGET="$(TARGET)"

isort-check:
$(call deprecated_target,isort-check,make isort CHECK=1,1.2.0)
Expand Down Expand Up @@ -4640,7 +4634,6 @@ lint-parallel: ## πŸš€ Run linters in parallel
$(UV_BIN) pip install -q pytest-xdist"
@# Run fast linters in parallel
@$(MAKE) --no-print-directory ruff RUFF_MODE=check TARGET="$(TARGET)" & \
$(MAKE) --no-print-directory black CHECK=1 TARGET="$(TARGET)" & \
$(MAKE) --no-print-directory isort CHECK=1 TARGET="$(TARGET)" & \
wait
@echo "βœ… Parallel linting completed!"
Expand Down
9 changes: 2 additions & 7 deletions llms/mcp-server-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ dev = [
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.0.0",
"black>=23.0.0",
"mypy>=1.5.0",
"ruff>=0.0.290",
]
Expand All @@ -126,10 +125,6 @@ packages = ["src/awesome_server"]
[project.scripts]
awesome-server = "awesome_server.server_fastmcp:main"

[tool.black]
line-length = 100
target-version = ["py311"]

[tool.mypy]
python_version = "3.11"
strict = true
Expand Down Expand Up @@ -178,8 +173,8 @@ install: ## Install in editable mode
dev-install: ## Install with dev extras
$(PYTHON) -m pip install -e ".[dev]"

format: ## Format (black + ruff --fix)
black . && ruff check --fix .
format: ## Format (ruff format + ruff --fix)
ruff format . && ruff check --fix .

lint: ## Lint (ruff, mypy)
ruff check . && mypy src/awesome_server
Expand Down
2 changes: 1 addition & 1 deletion llms/mcpgateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ContextForge: Full Project Overview
- HTML coverage only: `make htmlcov`
- Selective pytest: `pytest -k "fragment"`, `pytest -m "not slow"`
- Lint & static analysis:
- Format & hooks: `make autoflake isort black pre-commit`
- Format & hooks: `make autoflake isort ruff pre-commit`
- Static: `make pylint ruff`, full lint: `make lint`
- Security/docs QA (as configured): `make bandit interrogate verify check-manifest`
- PR readiness (recommended):
Expand Down
2 changes: 1 addition & 1 deletion llms/mkdocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Notes

**Quality & Linting**
- Prefer keeping docs consistent with the project's quality workflow:
- `make autoflake isort black pre-commit` (root) to format Python, sort imports, and run hooks.
- `make autoflake isort ruff pre-commit` (root) to format Python, sort imports, and run hooks.
- Additional docs authoring guidance: `docs/docs/development/documentation.md`.

**Common Tips**
Expand Down
2 changes: 1 addition & 1 deletion llms/plugins-llms.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ async function toolPreInvoke({ payload, context }: any) {

**Testing Plugins**
- Code quality & pre-commit (see AGENTS.md for details):
- `make autoflake isort black pre-commit` formats, orders imports, applies autoflake, and runs pre-commit hooks.
- `make autoflake isort ruff pre-commit` formats, orders imports, applies autoflake, and runs pre-commit hooks.
- `make pylint ruff` runs static analysis; fix findings before committing.
- `make doctest test` executes doctests then pytest; mirrors CI expectations locally.

Expand Down
2 changes: 1 addition & 1 deletion llms/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Testing: Quick Guide for LLMs
- HTML report only: `make htmlcov` (auto-runs coverage if `.coverage` missing).

**Code Quality & Security**
- Formatting & hooks: `make autoflake isort black pre-commit`
- Formatting & hooks: `make autoflake isort ruff pre-commit`
- Static analysis: `make pylint ruff`
- Full lint suite (includes web linters after one-time setup): `make lint` and `make lint-web` (install web linters once if needed)
- Additional checks (varies by repo config): `make bandit interrogate verify check-manifest`
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ mcpgateway = [
]

# --------------------------------------------------------------------
# πŸ›  Tool configurations (black, mypy, etc.)
# πŸ›  Tool configurations (ruff, mypy, etc.)
# --------------------------------------------------------------------
[tool.pytype]
# Directory-specific options:
Expand Down