| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…uced in newer Python versions
This reverts commit 1734919.
There was a problem hiding this comment.
I'm impressed how simple this is! Great job.
One opportunity to remove some branching:
Sorry, something went wrong.
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
|
This is a great improvement. Thanks, @AlexWaygood! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
All our benchmarks have a requires-python field in their pyproject.toml files, e.g.:
pyperformance/pyperformance/data-files/benchmarks/bm_2to3/pyproject.toml
Line 3 in 974e29c
The requires-python field is added to the metadata of each benchmark as a python field here:
pyperformance/pyperformance/_benchmark_metadata.py
Line 22 in 974e29c
pyperformance/pyperformance/_benchmark_metadata.py
Lines 193 to 202 in 974e29c
We can use that metadata to create a new python property on Benchmark objects, which returns a packaging.specifiers.SpecifierSet instance. This property can then be easily used to filter out benchmarks that require a higher version of Python than the version of Python pyperformance is running on.
Fixes #281. Unblocks #280 and #268.
I haven't added a test for this -- I was unsure if it was necessary, and if it was necessary, where that test should go. I'm happy to add one if that would be helpful and there's an obvious place it could go, however!
I manually tested adding a benchmark that used new-in-Python-3.8 features in 1734919, and the CI passed fine (adding the same benchmark to main currently causes the CI to fail — see #280). Passing CI run on my GitHub fork: https://github.com/AlexWaygood/pyperformance/actions/runs/4813903519