-
Notifications
You must be signed in to change notification settings - Fork 70
DRIVERS-3253 add support for uv.lock in install-cli.sh #678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Investigating the following error observed on some platforms (but not others):
Possibly a |
Yeah this might be stretching the lock file's cross-platform capability. |
We could instead add pymongo to a |
Looks like the
Future updates to the lockfiles should hopefully not encounter this issue once the Filed DEVPROD-20614 to track the investigation and update of system-provided |
Alternatively, the |
I think if "CI" is set, we should only ever use the toolchain if present, or fall back to installing |
I don't think we want to condition it on the |
Perhaps we should add a Troubleshooting section to the Readme, and say "if you see this error, here is where to apply the fix". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍
Aside: it looks like the inconsistent
It is unclear since when this downgrade occurred (EVG image event log doesn't reveal any recent changes), but it seems to have taken place sometime after August 1 (no task failures prior). The |
I'm concerned about the discoverability of knowing to make this change when PyMongo drops support for a MongoDB version. |
Added a section to the README documenting the PyMongo dependency and update instructions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thank you!
Ah, we're getting failures on macos arm:
|
|
Odd. The only explicit mention of drivers-evergreen-tools/.evergreen/venv-utils.sh Lines 100 to 102 in ee51679
I cannot find any (relevant) mention of |
I echoed the content of
|
Solved: it's a Python binary compatibility problem due to the It turns out a more suitable command for this purpose which does not require PR description has been updated accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
I found another issue, + declare uv_install_args
+ uv_install_args=(--quiet --force --editable --with-requirements uv-requirements.txt --overrides "${DRIVERS_TOOLS_INSTALL_CLI_OVERRIDES:?}")
+ uv tool install --quiet --force --editable --with-requirements uv-requirements.txt --overrides /Users/steve.silvester/workspace/drivers-evergreen-tools/.evergreen/orchestration/uv-override-dependencies.txt .
× Failed to build `drivers-tools-auth-aws @
│ file:///Users/steve.silvester/workspace/drivers-evergreen-tools/.evergreen/auth_aws`
╰─▶ /Users/steve.silvester/workspace/drivers-evergreen-tools/.evergreen/auth_aws does not appear to be a Python
project, as neither `pyproject.toml` nor `setup.py` are present in the directory
make: *** [run-server] Error 1 It is because we have Adding this file as [project]
name = "drivers-tools-auth-aws"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.9"
dependencies = []
[tool.setuptools]
packages = [] |
I don't this is correct. The error suggests |
No, uv is attempting to build a project in the workspace, and failing to do so, because it has no pyproject.toml file. As to why it occurs when invoking one script and not the other, I'm not sure, but I first noticed this when running our server start script from pymongo, which is also broken in the same way. |
Only because it is attempting to build
and in
However, when run in
The original error message states: |
Apologies for the false alarm, I blew away my local branch and used your latest changes and I no longer see the unexpected behavior. |
I’ll defer to Steve’s review. |
Resolves DRIVERS-3253. Followup to #585 and #676, motivated by this comment in DRIVERS-3249:
Accordingly, this PR proposes creating a
uv.lock
file for eachpyproject.toml
in DET.First,
requires-python
in.evergreen/orchestration
is bumped to3.9
for consistency with.evergreen/pyproject.toml
, as otherwise:Second, a
uv.lock
file is created for eachpyproject.toml
currently in DET under.evergreen
and.evergreen/orchestration
using the commanduv lock
. Quoting uv docs:There is nothing interesting in the lockfile for
.evergreen/pyproject.toml
, which is only used as a convenient means to installmongodl.py
+ related scripts as "tool executables". Regardless, this PR includes this file for consistency.The lockfile for
.evergreen/orchestration/pyproject.toml
inherits the dependencies of mongo_orchestration (its only direct dependency) and pins the package versions to the latest available (per the default "highest" resolution strategy). Notably, this includespymongo
(currently pinned to 4.14.0) as well ascertifi
(the--with
ininstall-cli.sh
is not necessary and therefore removed; this can be restored if it is required by some other downstream project/script beyond.evergreen/orchestration/pyproject.toml
).Note
uv
doesn't yet supportuv.lock
integration withuv tool install
per astral-uv/uv#5815. Theuv run --quiet --frozen --isolated uv pip freeze
uv export
command is used as a workaround. This commandrunsoutputs auv sync --frozen
in an isolated virtual environment, which installs packages according to the project lockfile, thenrequirements.txt
file according to the list of installed packages. The output currently looks like (for$MONGODB_VERSION >= 4.2
):The requirements file is prefixed with
uv-
to avoid potentially conflicting with any pre-existingrequirements.txt
file in the target directory.Third, to continue supporting backward compatibility with MongoDB Server versions that have been dropped by the latest PyMongo release (e.g. server versions 3.6 and 4.0), the
--overrides
flag is added to theuv tool install
command ininstall-cli.sh
script. The overrides file may be specified by a newDRIVERS_TOOLS_INSTALL_CLI_OVERRIDES
environment variable as appropriate for whichever project may be invoking theinstall-cli.sh
script. This env var is used by.evergreen/orchestration/setup.sh
to specify thepymongo
constraints per$MONGODB_VERSION
. The overrides file is nameduv-override-dependencies.txt
in reference to the[override-dependencies]
uv project setting.Note
The
--with
flag cannot be used to override direct dependency requirements:The resulting behavior looks as follows given
MONGODB_VERSION=4.2
(from.evergreen/orchestration
, with--verbose
, focusing on thepymongo
dependency, unrelated lines omitted for brevity):and with
MONGODB_VERSION=4.0
(which appendspymongo<4.14
to the override dependencies file):