Skip to content
Draft
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
4 changes: 4 additions & 0 deletions .evergreen/combine-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

set -eu

# Export before sourcing so that any uv sync inside setup-dev-env.sh uses them.
export UV_NO_LOCK=1
export UV_EXCLUDE_NEWER="${UV_EXCLUDE_NEWER:-$(python3 -c 'from datetime import datetime, timedelta, timezone; print((datetime.now(timezone.utc) - timedelta(days=7)).strftime("%Y-%m-%dT%H:%M:%SZ"))')}"

# Set up the virtual env.
. .evergreen/scripts/setup-dev-env.sh
uv sync --group coverage
Expand Down
4 changes: 0 additions & 4 deletions .evergreen/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ else
fi

cleanup_tests() {
# Avoid leaving the lock file in a changed state when we change the resolution type.
if [ -n "${TEST_MIN_DEPS:-}" ]; then
git checkout uv.lock || true
fi
cd $PREV_DIR
}

Expand Down
3 changes: 3 additions & 0 deletions .evergreen/scripts/setup-dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ fi
# Ensure dependencies are installed.
bash $HERE/install-dependencies.sh

# Never create or update uv.lock, in CI or locally.
export UV_NO_LOCK=1

# Only run the next part if not running on CI.
if [ -z "${CI:-}" ]; then
# Add the default install path to the path if needed.
Expand Down
6 changes: 6 additions & 0 deletions .evergreen/scripts/setup_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import platform
import shutil
import stat
from datetime import datetime, timedelta, timezone
from pathlib import Path
from urllib import request

Expand Down Expand Up @@ -169,6 +170,11 @@ def handle_test_env() -> None:

write_env("PIP_QUIET") # Quiet by default.
write_env("PIP_PREFER_BINARY") # Prefer binary dists by default.
write_env("UV_NO_LOCK", "1")
exclude_newer = os.environ.get("UV_EXCLUDE_NEWER") or (
datetime.now(timezone.utc) - timedelta(days=7)
).strftime("%Y-%m-%dT%H:%M:%SZ")
write_env("UV_EXCLUDE_NEWER", exclude_newer)

# Set an environment variable for the test name and sub test name.
write_env(f"TEST_{test_name.upper()}")
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ defaults:
run:
shell: bash -eux {0}

env:
UV_NO_LOCK: "1"

Comment thread
aclark4life marked this conversation as resolved.
permissions:
contents: read

Expand All @@ -30,6 +33,8 @@ jobs:
with:
enable-cache: true
python-version: "3.10"
- name: Set UV_EXCLUDE_NEWER
run: echo "UV_EXCLUDE_NEWER=${UV_EXCLUDE_NEWER:-$(date -u -d '7 days ago' '+%Y-%m-%dT%H:%M:%SZ')}" >> $GITHUB_ENV
- name: Install just
run: uv tool install rust-just
- name: Install Python dependencies
Expand Down Expand Up @@ -72,6 +77,8 @@ jobs:
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Set UV_EXCLUDE_NEWER
run: echo "UV_EXCLUDE_NEWER=${UV_EXCLUDE_NEWER:-$(date -u -d '7 days ago' '+%Y-%m-%dT%H:%M:%SZ')}" >> $GITHUB_ENV
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
Expand All @@ -94,6 +101,8 @@ jobs:
with:
enable-cache: true
python-version: "3.10"
- name: Set UV_EXCLUDE_NEWER
run: echo "UV_EXCLUDE_NEWER=${UV_EXCLUDE_NEWER:-$(date -u -d '7 days ago' '+%Y-%m-%dT%H:%M:%SZ')}" >> $GITHUB_ENV
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
Expand Down Expand Up @@ -122,6 +131,8 @@ jobs:
with:
enable-cache: true
python-version: "3.10"
- name: Set UV_EXCLUDE_NEWER
run: echo "UV_EXCLUDE_NEWER=${UV_EXCLUDE_NEWER:-$(date -u -d '7 days ago' '+%Y-%m-%dT%H:%M:%SZ')}" >> $GITHUB_ENV
- name: Install just
run: uv tool install rust-just
- id: setup-mongodb
Expand All @@ -147,6 +158,8 @@ jobs:
with:
enable-cache: true
python-version: "3.10"
- name: Set UV_EXCLUDE_NEWER
run: echo "UV_EXCLUDE_NEWER=${UV_EXCLUDE_NEWER:-$(date -u -d '7 days ago' '+%Y-%m-%dT%H:%M:%SZ')}" >> $GITHUB_ENV
- name: Install just
run: uv tool install rust-just
- name: Install dependencies
Expand All @@ -166,6 +179,8 @@ jobs:
with:
enable-cache: true
python-version: "3.10"
- name: Set UV_EXCLUDE_NEWER
run: echo "UV_EXCLUDE_NEWER=${UV_EXCLUDE_NEWER:-$(date -u -d '7 days ago' '+%Y-%m-%dT%H:%M:%SZ')}" >> $GITHUB_ENV
- name: Install just
run: uv tool install rust-just
- name: Install dependencies
Expand All @@ -190,6 +205,8 @@ jobs:
with:
enable-cache: true
python-version: "${{matrix.python}}"
- name: Set UV_EXCLUDE_NEWER
run: echo "UV_EXCLUDE_NEWER=${UV_EXCLUDE_NEWER:-$(date -u -d '7 days ago' '+%Y-%m-%dT%H:%M:%SZ')}" >> $GITHUB_ENV
- name: Install just
run: uv tool install rust-just
- name: Install dependencies
Expand All @@ -211,6 +228,8 @@ jobs:
with:
enable-cache: true
python-version: "3.10"
- name: Set UV_EXCLUDE_NEWER
run: echo "UV_EXCLUDE_NEWER=${UV_EXCLUDE_NEWER:-$(date -u -d '7 days ago' '+%Y-%m-%dT%H:%M:%SZ')}" >> $GITHUB_ENV
- name: Install just
run: uv tool install rust-just
- name: Install dependencies
Expand Down Expand Up @@ -300,6 +319,8 @@ jobs:
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: "3.9"
- name: Set UV_EXCLUDE_NEWER
run: echo "UV_EXCLUDE_NEWER=${UV_EXCLUDE_NEWER:-$(date -u -d '7 days ago' '+%Y-%m-%dT%H:%M:%SZ')}" >> $GITHUB_ENV
- id: setup-mongodb
uses: mongodb-labs/drivers-evergreen-tools@master
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ xunit-results/
coverage.xml
server.log
.coverage
uv.lock
11 changes: 0 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,3 @@ repos:
language: python
require_serial: true
additional_dependencies: ["shrub.py>=3.10.0", "pyyaml>=6.0.2"]

- id: uv-lock
name: uv-lock
entry: uv lock
language: python
require_serial: true
files: ^(uv\.lock|pyproject\.toml|requirements.txt|requirements/.*\.txt)$
pass_filenames: false
fail_fast: true
additional_dependencies:
- "uv>=0.8.4"
10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,9 @@ From the spawn host or Ubuntu image, do the following:
## Dependabot updates

Dependabot will raise PRs at most once per week, grouped by GitHub Actions updates and Python requirement
file updates. We have a pre-commit hook that will update the `uv.lock` file when requirements change.
To update the lock file on a failing PR, you can use a method like `gh pr checkout <pr number>`, then run
`just lint uv-lock` to update the lock file, and then push the changes. If a typing dependency has changed,
also run `just typing` and handle any new findings.
file updates. To handle a failing Dependabot PR:

1. Check out the PR: `gh pr checkout <pr number>`
2. Re-run the linters to pick up any formatting changes: `just lint`
3. If a typing dependency changed, run `just typing` and fix any new errors.
4. Commit the changes and push: `git add -u && git commit -m "Address linter/typing issues" && git push`
Loading
Loading