SERVER-99694: poetry upgraded to 2.0.0 (#31911)

GitOrigin-RevId: cbb8395dda001099942786db37354fe97e95a558
This commit is contained in:
Udita 2025-02-04 14:00:06 -05:00 committed by MongoDB Bot
parent 4cb56abc46
commit 3d0e855229
10 changed files with 2011 additions and 1517 deletions

View File

@ -135,16 +135,16 @@ http_archive(
# Poetry rules for managing Python dependencies
http_archive(
name = "rules_poetry",
sha256 = "dbabea2a3829aa5885ba46d612b269956d0227b503147a5e1a2cfd635165fcb5",
strip_prefix = "rules_poetry-441f4365f7cafce345083a6325bc6712a2ce5c93",
sha256 = "48001b928488e78f03a47bcc712c56432a471fc6cdd90fe57c884efbfcd13696",
strip_prefix = "rules_poetry-917630033c736c188605cf0f558c34afc1eca540",
urls = [
# Implements retry by relisting each url multiple times to be used as a failover.
# TODO(SERVER-86719): Re-implement http_archive to allow sleeping between retries
"https://github.com/mongodb-forks/rules_poetry/archive/441f4365f7cafce345083a6325bc6712a2ce5c93.tar.gz",
"https://github.com/mongodb-forks/rules_poetry/archive/441f4365f7cafce345083a6325bc6712a2ce5c93.tar.gz",
"https://github.com/mongodb-forks/rules_poetry/archive/441f4365f7cafce345083a6325bc6712a2ce5c93.tar.gz",
"https://github.com/mongodb-forks/rules_poetry/archive/441f4365f7cafce345083a6325bc6712a2ce5c93.tar.gz",
"https://github.com/mongodb-forks/rules_poetry/archive/441f4365f7cafce345083a6325bc6712a2ce5c93.tar.gz",
"https://github.com/mongodb-forks/rules_poetry/archive/917630033c736c188605cf0f558c34afc1eca540.tar.gz",
"https://github.com/mongodb-forks/rules_poetry/archive/917630033c736c188605cf0f558c34afc1eca540.tar.gz",
"https://github.com/mongodb-forks/rules_poetry/archive/917630033c736c188605cf0f558c34afc1eca540.tar.gz",
"https://github.com/mongodb-forks/rules_poetry/archive/917630033c736c188605cf0f558c34afc1eca540.tar.gz",
"https://github.com/mongodb-forks/rules_poetry/archive/917630033c736c188605cf0f558c34afc1eca540.tar.gz",
],
)

View File

@ -78,7 +78,7 @@ WORKDIR /mongo
COPY src/pyproject.toml src/poetry.lock ./
# Install mongodb python deps with poetry
RUN python -m pip install 'poetry==1.8.3'
RUN python -m pip install 'poetry==2.0.0'
RUN python -m poetry install --no-root --sync
# Add the poetry venv to the $PATH so that it's activated by default

View File

@ -16,7 +16,7 @@
# Our workspace setup requires a specific version of poetry to be
# installed, this script automates the pip install of that version.
poetry_version='1.8.3'
poetry_version='2.0.0'
allow_no_venv=0
python_optarg=""

View File

@ -63,7 +63,7 @@ class SetUpEC2Instance(PowercycleCommand):
cmds = f"{cmds}; $python_loc -m venv --system-site-packages {venv}"
cmds = f"{cmds}; activate=$(find {venv} -name 'activate')"
cmds = f"{cmds}; . $activate"
cmds = f"{cmds}; python3 -m pip install 'poetry==1.8.3'"
cmds = f"{cmds}; python3 -m pip install 'poetry==2.0.0'"
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)

View File

@ -40,7 +40,7 @@ which python3 # This should point to the python in python3-venv
# It is also non standard to install poetry into its own virtual environment.
# However, the idea is to make even fewer unpinned dependencies.
# Install poetry 1.8.3 into the virtual env, then install all
# Install poetry 2.0.0 into the virtual env, then install all
# required python dependencies to build and test.
buildscripts/poetry_sync.sh

View File

@ -7,8 +7,8 @@ Returns nonzero if poetry.lock and pyproject.toml are not synced
import subprocess
POETRY_LOCK_V183 = (
"""# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand."""
POETRY_LOCK_V200 = (
"""# This file is automatically @generated by Poetry 2.0.0 and should not be changed by hand."""
)
# This has a great error message as part of the failure case
@ -16,7 +16,7 @@ subprocess.run(["poetry", "check", "--lock"], check=True)
# Check if the poetry lock file was generated with poetry 1.8.3
with open("poetry.lock", "r") as poetry_lock:
if POETRY_LOCK_V183 not in poetry_lock.read(len(POETRY_LOCK_V183)):
raise Exception("""Poetry lockfile was not generated by poetry 1.8.3.
Make sure to have poetry 1.8.3 installed when running poetry lock.
if POETRY_LOCK_V200 not in poetry_lock.read(len(POETRY_LOCK_V200)):
raise Exception("""Poetry lockfile was not generated by poetry 2.0.0.
Make sure to have poetry 2.0.0 installed when running poetry lock.
If you are seeing this message please follow the poetry install steps in docs/building.md.""")

View File

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

3458
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,10 @@
[tool.poetry]
[project]
name = "mdb-python-deps"
version = "1.0.0"
requires-python = ">=3.10,<4.0"
#dynamic = [ "dependencies" ]
description = "MongoDB python dependencies"
authors = ["MongoDB"]
authors = [ { name = "MongoDB" } ]
readme = "README.md"
# These packages are included as a TODO if we want to run resmoke with pex
# Currently this does nothing
@ -14,6 +16,18 @@ packages = [
{ include = "buildscripts/idl" },
{ include = "buildscripts/util" },
]
dependencies = [
"networkx", # This is also used as a part of build_metrics so it is sort of required
"pyright==1.1.380",
"flask",
"flask-cors",
"lxml",
"eventlet",
"gevent",
"progressbar2",
"cxxfilt",
"pympler",
]
[tool.poetry.dependencies]
python = ">=3.10,<4.0"
@ -28,7 +42,7 @@ gevent = { version = "*", optional = true }
progressbar2 = { version = "*", optional = true }
cxxfilt = { version = "*", optional = true }
pympler = { version = "*", optional = true }
pyright = "1.1.382"
pyright = "1.1.380"
[tool.poetry.group.aws.dependencies]
boto3 = "^1.34.156"
@ -43,7 +57,7 @@ tabulate = "^0.9.0"
[tool.poetry.group.compile.dependencies]
cheetah3 = "<=3.2.6.post1" # src/mongo/base/generate_error_codes.py
packaging = "^23.1"
packaging = "^24.0"
regex = "^2021.11.10"
setuptools = "^58.1.0"
wheel = "0.37.0"
@ -62,7 +76,7 @@ tenacity = "^9.0.0"
pipx = "1.6.0"
# TODO: Add in pex as we move forward with this
# pex = "^2.1.137"
poetry = "1.8.3"
poetry = "2.0.0"
[tool.poetry.group.evergreen.dependencies]
click = "^8.1.7"
@ -86,7 +100,7 @@ ldaptor = "19.0.0"
[tool.poetry.group.idl.dependencies]
unittest-xml-reporting = "3.0.4" # Pinned because newer versions require lxml which fails to install
packaging = "^23.1"
packaging = "^24.0"
[tool.poetry.group.jira-client.dependencies]
jira = "<=3.1.1"
@ -105,7 +119,7 @@ types-requests = "^2.32.0.20240712"
tqdm = "*"
colorama = "^0.4.6"
evergreen-lint = "^0.1.9"
ruff = "^0.5.6"
ruff = "^0.6.7"
[tool.poetry.group.platform.dependencies]
pypiwin32 = { version = ">=223", markers = "sys_platform == 'win32'" }
@ -143,7 +157,7 @@ proxy-protocol = "^0.11.3"
pkce = "^1.0.3"
oauthlib = "^3.1.1"
requests-oauthlib = "^2.0.0"
packaging = "^23.1"
packaging = "^24.0"
docker = "^7.1.0"
mongomock = "^4.1.2"
pyjwt = "^2.9.0"
@ -161,7 +175,7 @@ opentelemetry-exporter-otlp-proto-common = "*"
mongo-tooling-metrics = "1.0.8"
# This can be installed with "poetry install -E libdeps"
[tool.poetry.extras]
[project.optional-dependencies]
libdeps = [
"flask",
"flask-cors",
@ -175,7 +189,7 @@ libdeps = [
# This entrypoint is included as a TODO if we want to run resmoke with pex
# Currently this does nothing
[tool.poetry.scripts]
[project.scripts]
resmoke = "buildscripts.resmoke:entrypoint"
[tool.ruff]

View File

@ -40,7 +40,7 @@ def verify_requirements(silent: bool = False, executable=sys.executable):
try:
import poetry # noqa: F401
except ModuleNotFoundError as ex:
raiseSuggestion(ex, "'poetry==1.8.3'")
raiseSuggestion(ex, "'poetry==2.0.0'")
verbose("Checking required python packages...")