SERVER-105429 make poetry requrements file (#36472)

GitOrigin-RevId: c16188de078d8819b30184e34ca87baed6cf57c2
This commit is contained in:
Daniel Moody 2025-05-23 14:00:21 -05:00 committed by MongoDB Bot
parent b86ce5ad6f
commit b4486819a4
12 changed files with 69 additions and 9 deletions

1
.github/CODEOWNERS vendored
View File

@ -22,6 +22,7 @@ package.json @10gen/devprod-correctness @svc-auto-approve-bot
pnpm-lock.yaml @10gen/devprod-correctness @svc-auto-approve-bot pnpm-lock.yaml @10gen/devprod-correctness @svc-auto-approve-bot
poetry.lock @10gen/devprod-build @10gen/devprod-correctness @svc-auto-approve-bot poetry.lock @10gen/devprod-build @10gen/devprod-correctness @svc-auto-approve-bot
pyproject.toml @10gen/devprod-build @10gen/devprod-correctness @svc-auto-approve-bot pyproject.toml @10gen/devprod-build @10gen/devprod-correctness @svc-auto-approve-bot
poetry_requirements.txt @10gen/devprod-build @10gen/devprod-correctness @svc-auto-approve-bot
sbom.json @10gen/server-security @svc-auto-approve-bot sbom.json @10gen/server-security @svc-auto-approve-bot
MODULE.bazel* @10gen/devprod-build @svc-auto-approve-bot MODULE.bazel* @10gen/devprod-build @svc-auto-approve-bot
WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot WORKSPACE.bazel @10gen/devprod-build @svc-auto-approve-bot

View File

@ -58,6 +58,10 @@ filters:
approvers: approvers:
- 10gen/devprod-correctness - 10gen/devprod-correctness
- 10gen/devprod-build - 10gen/devprod-build
- "poetry_requirements.txt":
approvers:
- 10gen/devprod-correctness
- 10gen/devprod-build
- "sbom.json": - "sbom.json":
approvers: approvers:
- 10gen/server-security - 10gen/server-security

View File

@ -75,10 +75,10 @@ RUN ./src/scripts/npm_run.sh jstestfuzz -- --help
WORKDIR /mongo WORKDIR /mongo
# Copy mongodb python deps first # Copy mongodb python deps first
COPY src/pyproject.toml src/poetry.lock ./ COPY src/pyproject.toml src/poetry.lock src/poetry_requirements.txt ./
# Install mongodb python deps with poetry # Install mongodb python deps with poetry
RUN python -m pip install 'poetry==2.0.0' RUN python -m pip install -r poetry_requirements.txt
RUN python -m poetry install --no-root --sync RUN python -m poetry install --no-root --sync
# Add the poetry venv to the $PATH so that it's activated by default # Add the poetry venv to the $PATH so that it's activated by default

View File

@ -39,8 +39,12 @@ def verify_requirements(silent: bool = False, executable=sys.executable):
# This is so the user will have an easier time diagnosing the problem # This is so the user will have an easier time diagnosing the problem
try: try:
import poetry # noqa: F401 import poetry # noqa: F401
except ModuleNotFoundError as ex: except ModuleNotFoundError:
raiseSuggestion(ex, "'poetry==2.0.0'") raise MissingRequirements(
f"Detected one or more packages are out of date. "
f"Try running:\n"
f" buildscripts/poetry_sync.sh -p '{executable}'\n"
)
verbose("Checking required python packages...") verbose("Checking required python packages...")

View File

@ -77,7 +77,7 @@ if [[ "${allow_no_venv}" != 1 ]]; then
# Exploit pip's own enforcement of virtualenv. # Exploit pip's own enforcement of virtualenv.
pip_opts+=('--require-virtualenv') pip_opts+=('--require-virtualenv')
fi fi
run "${py3}" -m pip install "${pip_opts[@]}" "poetry==${poetry_version}" run "${py3}" -m pip install "${pip_opts[@]}" -r poetry_requirements.txt
run env \ run env \
PYTHON_KEYRING_BACKEND="keyring.backends.null.Keyring" \ PYTHON_KEYRING_BACKEND="keyring.backends.null.Keyring" \

View File

@ -38,7 +38,14 @@ class SetUpEC2Instance(PowercycleCommand):
# Second operation - # Second operation -
# Copy buildscripts and mongoDB executables to the remote host. # Copy buildscripts and mongoDB executables to the remote host.
files = ["etc", "buildscripts", "dist-test/bin", "poetry.lock", "pyproject.toml"] files = [
"etc",
"buildscripts",
"dist-test/bin",
"poetry.lock",
"pyproject.toml",
"poetry_requirements.txt",
]
shared_libs = "dist-test/lib" shared_libs = "dist-test/lib"
if os.path.isdir(shared_libs): if os.path.isdir(shared_libs):
@ -63,7 +70,7 @@ class SetUpEC2Instance(PowercycleCommand):
cmds = f"{cmds}; $python_loc -m venv --system-site-packages {venv}" cmds = f"{cmds}; $python_loc -m venv --system-site-packages {venv}"
cmds = f"{cmds}; activate=$(find {venv} -name 'activate')" cmds = f"{cmds}; activate=$(find {venv} -name 'activate')"
cmds = f"{cmds}; . $activate" cmds = f"{cmds}; . $activate"
cmds = f"{cmds}; python3 -m pip install 'poetry==2.0.0'" cmds = f"{cmds}; pushd $remote_dir && python3 -m pip install -r poetry_requirements.txt && popd"
cmds = f"{cmds}; pushd $remote_dir && python3 -m poetry install --no-root --sync && popd" cmds = f"{cmds}; pushd $remote_dir && python3 -m poetry install --no-root --sync && popd"
self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=retry_count) self.remote_op.operation(SSHOperation.SHELL, cmds, retry=True, retry_count=retry_count)

View File

@ -816,6 +816,7 @@ functions:
- *add_git_tag - *add_git_tag
- *kill_processes - *kill_processes
- *cleanup_environment - *cleanup_environment
- *set_up_venv
"do non-compile setup": "do non-compile setup":
- command: manifest.load - command: manifest.load

View File

@ -193,6 +193,7 @@ tasks:
- "src/src/third_party/schemastore.org/**" - "src/src/third_party/schemastore.org/**"
- "src/poetry.lock" - "src/poetry.lock"
- "src/pyproject.toml" - "src/pyproject.toml"
- "src/poetry_requirements.txt"
- "src/x509/**" - "src/x509/**"
exclude_files: exclude_files:
- "src/*_test.pdb" - "src/*_test.pdb"

View File

@ -121,6 +121,7 @@ tasks:
depends_on: [] depends_on: []
commands: commands:
- func: "do pre workstation setup" - func: "do pre workstation setup"
- func: "get engflow creds"
- func: "set up then check workstation script" - func: "set up then check workstation script"
- <<: *gen_burn_in_task_template - <<: *gen_burn_in_task_template

View File

@ -70,7 +70,7 @@ setup_poetry() {
if command -v poetry &> /dev/null; then if command -v poetry &> /dev/null; then
echo "'poetry' command exists; skipping setup" echo "'poetry' command exists; skipping setup"
else else
pipx install poetry==2.0.0 pipx install poetry --pip-args="-r $(pwd)/poetry_requirements.txt"
echo "Finished installing poetry..." echo "Finished installing poetry..."
fi fi
} }

View File

@ -35,7 +35,7 @@ export POETRY_DATA_DIR="$poetry_dir/data"
export POETRY_CACHE_DIR="$poetry_dir/cache" export POETRY_CACHE_DIR="$poetry_dir/cache"
export PIP_CACHE_DIR="$poetry_dir/pip_cache" export PIP_CACHE_DIR="$poetry_dir/pip_cache"
for i in {1..5}; do for i in {1..5}; do
$POETRY_VENV_PYTHON -m pip install "poetry==2.0.0" && RET=0 && break || RET=$? && sleep 1 $POETRY_VENV_PYTHON -m pip install -r src/poetry_requirements.txt && RET=0 && break || RET=$? && sleep 1
echo "Python failed to install poetry, retrying..." echo "Python failed to install poetry, retrying..."
done done

41
poetry_requirements.txt Normal file
View File

@ -0,0 +1,41 @@
backports.tarfile~=1.2.0
build~=1.2.2.post1
CacheControl~=0.14.3
certifi~=2025.4.26
cffi~=1.17.1
charset-normalizer~=3.4.2
cleo~=2.1.0
crashtest~=0.4.1
cryptography~=44.0.2
distlib~=0.3.9
dulwich~=0.22.8
fastjsonschema~=2.21.1
filelock~=3.18.0
idna~=3.10
importlib_metadata~=8.7.0
installer~=0.7.0
jaraco.classes~=3.4.0
jaraco.context~=6.0.1
jaraco.functools~=4.1.0
jeepney~=0.9.0
keyring~=25.6.0
more-itertools~=10.7.0
msgpack~=1.1.0
packaging~=25.0
pkginfo~=1.12.1.2
platformdirs~=4.3.8
poetry~=2.0.0
poetry-core~=2.0.0
pycparser~=2.22
pyproject_hooks~=1.2.0
RapidFuzz~=3.13.0
requests~=2.32.3
requests-toolbelt~=1.0.0
SecretStorage~=3.3.3
shellingham~=1.5.4
tomli~=2.2.1
tomlkit~=0.13.2
trove-classifiers~=2025.5.9.12
urllib3~=2.4.0
virtualenv~=20.31.2
zipp~=3.21.0