Skip to content

Commit

Permalink
Benchmarks: Add extras to poetry (#6247)
Browse files Browse the repository at this point in the history
Previously, we had dropped extras from the requirements when converting
to poetry, skewing the results towards poetry for the
`apache-airflow[all]` benchmark.
  • Loading branch information
konstin authored Aug 20, 2024
1 parent 6dc05a3 commit 422730d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions scripts/benchmark/src/benchmark/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,14 +374,13 @@ def setup(self, requirements_file: str, *, cwd: str) -> None:
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)
Expand Down

0 comments on commit 422730d

Please sign in to comment.