uv sync- Open File → Settings → Python → Interpreter
- Click Add Interpreter → Add Local Interpreter
- Under Environment, select Use existing environment
- Set Type to uv
- In Path to uv specify uv location (usually
/home/<your-user>/.local/bin/uv) - In Uv env use, specify the Python executable from your project’s virtual environment (
/home/<path-to-mlops-repo>/mlops/.venv/bin/python) - Confirm and apply the settings.
After that, PyCharm will use the same uv environment as your project.
-
Install pre-commit with uv:
uv tool install pre-commit --with pre-commit-uv
-
Verify the installation:
pre-commit --version
-
Install the project hooks:
pre-commit install --hook-type commit-msg
-
Test the setup by trying to make a non-conventional commit. The commit should fail and display an error message:
git commit -m "fix workflow error" # > Conventional Commit......................................................Failed # ...
-
If the above test works as expected, pre-commit is successfully configured.
-
Run some Ruff check:
uv run ruff check . -
If no errors are reported, Ruff is installed and working correctly.