Skip to content

Fix Makefile Ruff targets to use configured Python#1062

Merged
VaibhavUpreti merged 1 commit intoTracer-Cloud:mainfrom
Genmin:fix/make-lint-python-module
Apr 29, 2026
Merged

Fix Makefile Ruff targets to use configured Python#1062
VaibhavUpreti merged 1 commit intoTracer-Cloud:mainfrom
Genmin:fix/make-lint-python-module

Conversation

@Genmin
Copy link
Copy Markdown
Contributor

@Genmin Genmin commented Apr 29, 2026

Summary

  • fix Python fallback detection so systems with python3 do not fall through to python
  • run Makefile Ruff targets through $(PYTHON) -m ruff
  • align local lint and format targets with the CI module invocation

Why

Part of #176. The Makefile computes a project Python interpreter, but lint/format targets were invoking bare ruff. That can fail after a standard venv install when Ruff is available as a module but not as a shell command.

Tests

  • make -n lint
  • make -n format-check
  • make -n format
  • make lint
  • make format-check

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 29, 2026

Greptile Summary

This PR fixes two related bugs in the Makefile. First, the python3 detection used python3 -c "import sys" which always produced empty stdout (the command succeeds silently), so ifneq(...,) never matched — meaning PYTHON always fell through to the bare python fallback on non-Windows systems without a venv. Replacing it with command -v python3 correctly captures the interpreter path. Second, the lint, format-check, and format targets now invoke $(PYTHON) -m ruff instead of bare ruff, aligning them with how the rest of the Makefile invokes Python tooling and making them work reliably after a pip install into a venv where ruff may not be on PATH as a standalone binary.

Confidence Score: 5/5

Safe to merge — both changes are correct bug fixes with no functional regressions.

The Python detection fix correctly addresses a real silent bug (empty-output condition that never matched), and the $(PYTHON) -m ruff change is a straightforward alignment with existing Makefile conventions. No P0/P1 issues found.

No files require special attention.

Important Files Changed

Filename Overview
Makefile Two targeted fixes: replaces the broken python3 -c "import sys" detection (which always produced empty output, so the condition never fired) with command -v python3, and routes all ruff targets through $(PYTHON) -m ruff instead of bare ruff.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[make lint / format-check / format] --> B{.venv/bin/python exists?}
    B -- Yes --> C[PYTHON = .venv/bin/python]
    B -- No --> D{OS == Windows_NT?}
    D -- Yes --> E{.venv/Scripts/python.exe exists?}
    E -- Yes --> F[PYTHON = .venv\\Scripts\\python.exe]
    E -- No --> G[PYTHON = python]
    D -- No --> H{"command -v python3\n(NEW: was: python3 -c 'import sys')"}
    H -- Found --> I[PYTHON = python3]
    H -- Not found --> J[PYTHON = python]
    C & F & G & I & J --> K["$(PYTHON) -m ruff check / format app/ tests/\n(NEW: was: bare ruff)"]
Loading

Reviews (1): Last reviewed commit: "fix(dev): run ruff through configured Py..." | Re-trigger Greptile

Copy link
Copy Markdown
Member

@VaibhavUpreti VaibhavUpreti left a comment

Choose a reason for hiding this comment

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

awesome @Genmin , thanks a lot for fixing this!

@VaibhavUpreti VaibhavUpreti merged commit 89f6ee4 into Tracer-Cloud:main Apr 29, 2026
3 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

💜 One more reason the project grows. Thanks @Genmin — your contribution just landed!


👋 Join us on Discord - OpenSRE : hang out, contribute, or hunt for features and issues. Everyone's welcome.

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