Benchmarks: Add extras to poetry (#6247)

Previously, we had dropped extras from the requirements when converting
to poetry, skewing the results towards poetry for the
`apache-airflow[all]` benchmark.
This commit is contained in:
konsti 2024-08-20 14:41:07 +02:00 committed by GitHub
parent 6dc05a3598
commit 422730d516
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -374,14 +374,13 @@ class Poetry(Suite):
pyproject = tomli.load(fp)
# Add the dependencies to the pyproject.toml.
pyproject["tool"]["poetry"]["dependencies"].update(
{
str(requirement.name): str(requirement.specifier)
if requirement.specifier
else "*"
for requirement in requirements
}
)
for requirement in requirements:
version = str(requirement.specifier) if requirement.specifier else "*"
if requirement.extras:
entry = {"version": version, "extras": sorted(requirement.extras)}
else:
entry = version
pyproject["tool"]["poetry"]["dependencies"][requirement.name] = entry
with open(os.path.join(cwd, "pyproject.toml"), "wb") as fp:
tomli_w.dump(pyproject, fp)