Drop support for Python 3.9#1248
Conversation
📝 WalkthroughWalkthroughPython 3.9 support is dropped across the project. The minimum required version is raised to 3.10 in ChangesDrop Python 3.9, raise minimum to 3.10
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
sanders41
left a comment
There was a problem hiding this comment.
The Dockerfile is still using 3.9
Line 1 in f51bb17
Also there are a lot of depreciations around typing. They are only warnings at this point, but at some point in the future they will become errors. We could either update them here or open a new issue to update them.
uv run ruff check --select UP meilisearch tests
...
Found 413 errors.
[*] 390 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
Will update this.
Will set up the Ruff rules along with pyupgrade in the next PR. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Dockerfile (1)
1-12:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRun the container as a non-root user.
The image still runs as root (no
USERdirective), which increases blast radius if the process is compromised. Add a dedicated unprivileged user and switch before runtime.Suggested patch
FROM python:3.10-slim-trixie COPY --from=ghcr.io/astral-sh/uv:0.11.19 /uv /uvx /bin/ WORKDIR /home/package + +RUN useradd --create-home --shell /usr/sbin/nologin appuser -COPY pyproject.toml . -COPY uv.lock . +COPY --chown=appuser:appuser pyproject.toml . +COPY --chown=appuser:appuser uv.lock . # Install dependencies RUN uv sync --frozen --no-install-project + +USER appuser🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile` around lines 1 - 12, The Dockerfile currently lacks a USER directive, meaning the container runs as root which is a security risk. After the RUN command that executes uv sync --frozen --no-install-project, add a RUN directive to create a dedicated unprivileged user (for example, with a name like app or appuser) with a home directory, then add a USER directive to switch to that user before the container runtime. This ensures the process runs with minimal privileges and reduces the impact if the application is compromised.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@Dockerfile`:
- Around line 1-12: The Dockerfile currently lacks a USER directive, meaning the
container runs as root which is a security risk. After the RUN command that
executes uv sync --frozen --no-install-project, add a RUN directive to create a
dedicated unprivileged user (for example, with a name like app or appuser) with
a home directory, then add a USER directive to switch to that user before the
container runtime. This ensures the process runs with minimal privileges and
reduces the impact if the application is compromised.
Can you please check again? I don't see any references to |
sanders41
left a comment
There was a problem hiding this comment.
Interesting, I was on my phone earlier and it took me to the main repo instead of your branch. I'm on a computer now and everything looks correct.
Strift
left a comment
There was a problem hiding this comment.
Great 🙌
Thanks @sanders41 for the review! I updated the required checks.
Description
Related issue
Fixes #1247
What does this PR do?
3.9.UV_PYTHONenvironment variable into a more genericPYTHON_VERSIONvariable so it can be reused throughout the workflow.types-requestsdependency from thelintgroup, as it is no longer needed.requestshas shipped inline type annotations (py.typed) since v2.34.0 ; Seeuv lock --upgradeto refresh all lockfile dependencies to their latest compatible versions for minimum supported Python3.10.Tests
1)
uv lock --upgrade2)
uv run pytest -qPR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Summary
This PR drops support for Python 3.9 and updates the minimum supported version to Python 3.10.
Changes
Python Version Updates
>=3.9to>=3.10inpyproject.toml.github/workflows/tests.yml(integration test matrix now runs3.10–3.13).github/workflows/pre-release-tests.yml(matrix reduced to3.10–3.13)tox.ini(py39replaced withpy310)README.mdinstallation requirements to require Python 3.10+Dockerfilebase image frompython:3.9-slim-trixietopython:3.10-slim-trixieEnvironment Variable Refactoring (GitHub Actions)
UV_PYTHONwithPYTHON_VERSIONacross workflows for consistent interpreter selectionactions/setup-pythonandastral-sh/setup-uv:.github/workflows/documentation.yml.github/workflows/pypi-publish.yml.github/workflows/tests.ymlDependency Updates
types-requestsfromdependency-groups.lintinpyproject.toml(inline types are available inrequests≥ 2.34.0)Lockfile Refresh
uv lock --upgradeto refresh lockfile dependencies for Python 3.10+ minimum support.Verification
uv lock --upgrade --dry-runsucceeded with dependency resolution completing in 1.55s (including updates such asmypy,playwright, andrequests)uv run pytest -qmeilisearchpackage