Skip to content

Commit

Permalink
Require Python 3.9 for PerfkitBenchmarker
Browse files Browse the repository at this point in the history
This will allow using newer language features.

PiperOrigin-RevId: 465148664
  • Loading branch information
pmkc authored and copybara-github committed Aug 3, 2022
1 parent 877aa39 commit f9fd29a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES.next.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Breaking changes:

- Require Python 3.9+
- The core_os os_type was removed from the Azure provider as
[the image was deleted](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/endorsed-distros#supported-distributions-and-versions),
- It will be replaced by
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.9

WORKDIR /pkb

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ running with PKB.
## Python 3

The recommended way to install and run PKB is in a virtualenv with the latest
version of Python 3. Most Linux distributions and recent Mac OS X versions
already have Python 3 installed at `/usr/bin/python3`.
version of Python 3 (at least Python 3.9). Most Linux distributions and recent
Mac OS X versions already have Python 3 installed at `/usr/bin/python3`.

If Python is not installed, you can likely install it using your distribution's
package manager, or see the
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ layout: page

## Python

PerfKitBenchmarker requires [Python](https://www.python.org/downloads/) and is
tested on Python 3.7. We recommend using a
PerfKitBenchmarker requires [Python](https://www.python.org/downloads/) 3.9+
and is tested on Python 3.9. We recommend using a
[virtual environment](https://docs.python.org/3/tutorial/venv.html) to manage
different Python versions and their required `pip` dependencies.

Expand Down
4 changes: 3 additions & 1 deletion perfkitbenchmarker/pkb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Runs all benchmarks in PerfKitBenchmarker.
"""Runs benchmarks in PerfKitBenchmarker.
All benchmarks in PerfKitBenchmarker export the following interface:
Expand Down Expand Up @@ -1792,6 +1792,8 @@ def CollectMeminfo(vm):


def Main():
"""Entrypoint for PerfKitBenchmarker."""
assert sys.version_info >= (3, 9), 'PerfKitBenchmarker requires Python 3.9+'
log_util.ConfigureBasicLogging()
_InjectBenchmarkInfoIntoDocumentation()
_ParseFlags()
Expand Down
7 changes: 6 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ blinker>=1.3
packaging
pandas>=1.1.5
PyYAML==5.4.1
pint>=0.7
# TODO(pclay): fix % parsing in 0.19+
pint<0.19
numpy>=1.16.5
contextlib2>=0.5.1
six>=1.13.0
Expand All @@ -30,3 +31,7 @@ google-cloud-datastore
google-cloud-monitoring
beautifulsoup4
requests

# unlike setup.py requirements.txt cannot require a Python version AFAICT
# this hack requires a non-existent package when Python is less than 3.9
PerfkitBenchmarker_requires_Python_39;python_version<"3.9"
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = py37,flake8,scripts
envlist = py39,py310,flake8,scripts

[testenv]
usedevelop = True
Expand Down

0 comments on commit f9fd29a

Please sign in to comment.