Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using Python 3.6 internally and in CI #11175

Merged
merged 4 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
297 changes: 10 additions & 287 deletions .travis.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build-support/bin/bootstrap_pants_pex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd "$REPO_ROOT" || exit 1

# This script is used to generate pants.pex, which is used to run Pants in CI.

export PY="${PY:-python3}"
export PY="${PY:-python3.7}"

# shellcheck source=build-support/common.sh
source "${REPO_ROOT}/build-support/common.sh"
Expand Down
5 changes: 2 additions & 3 deletions build-support/bin/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def main() -> None:


class PythonVersion(Enum):
py36 = "3.6"
py37 = "3.7"

def __str__(self) -> str:
Expand All @@ -78,8 +77,8 @@ def create_parser() -> argparse.ArgumentParser:
"--python-version",
type=PythonVersion,
choices=list(PythonVersion),
default=PythonVersion.py36,
help="Run Pants with this version (defaults to 3.6).",
default=PythonVersion.py37,
help="Run Pants with this version.",
)
parser.add_argument(
"--remote-execution-enabled",
Expand Down
34 changes: 11 additions & 23 deletions build-support/bin/generate_travis_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def all_entries(cls) -> List[Dict[str, str]]:
"BOOTSTRAPPED_PEX_KEY_PREFIX=daily/${TRAVIS_BUILD_NUMBER}/${TRAVIS_BUILD_ID}/pants.pex",
"NATIVE_ENGINE_SO_KEY_PREFIX=monthly/native_engine_so",
"MACOS_PYENV_PY27_VERSION=2.7.18",
"MACOS_PYENV_PY36_VERSION=3.6.10",
"MACOS_PYENV_PY37_VERSION=3.7.7",
"MACOS_PYENV_PY38_VERSION=3.8.3",
# NB: We must set `PYENV_ROOT` on macOS for Pyenv to work properly. However, on Linux, we must not
Expand Down Expand Up @@ -111,7 +110,6 @@ def all_entries(cls) -> List[Dict[str, str]]:


class PythonVersion(Enum):
py36 = "py36"
py37 = "py37"
py38 = "py38"

Expand All @@ -120,24 +118,16 @@ def __str__(self) -> str:

@property
def number(self) -> int:
return {self.py36: 36, self.py37: 37, self.py38: 38}[self] # type: ignore[index]
return {self.py37: 37, self.py38: 38}[self] # type: ignore[index]

@property
def decimal(self) -> float:
return {self.py36: 3.6, self.py37: 3.7, self.py38: 3.8}[self] # type: ignore[index]
return {self.py37: 3.7, self.py38: 3.8}[self] # type: ignore[index]

def default_stage(self, *, is_bootstrap: bool = False) -> Stage:
if is_bootstrap:
return {
self.py36: Stage.bootstrap,
self.py37: Stage.bootstrap_cron,
self.py38: Stage.bootstrap_cron,
}[
self # type: ignore[index]
]
return {self.py36: Stage.test, self.py37: Stage.test_cron, self.py38: Stage.test_cron,}[
self # type: ignore[index]
]
return {self.py37: Stage.bootstrap, self.py38: Stage.bootstrap_cron}[self] # type: ignore[index]
return {self.py37: Stage.test, self.py38: Stage.test_cron}[self] # type: ignore[index]


# ----------------------------------------------------------------------
Expand Down Expand Up @@ -291,7 +281,7 @@ def _linux_before_install(
def linux_shard(
*,
load_test_config: bool = True,
python_version: PythonVersion = PythonVersion.py36,
python_version: PythonVersion = PythonVersion.py37,
use_docker: bool = False,
install_travis_wait: bool = False,
) -> Dict:
Expand Down Expand Up @@ -377,7 +367,6 @@ def _osx_env_with_pyenv() -> List[str]:
return [
*_osx_env(),
'PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY27_VERSION}/bin:${PATH}"',
'PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY36_VERSION}/bin:${PATH}"',
'PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY37_VERSION}/bin:${PATH}"',
'PATH="${PYENV_ROOT}/versions/${MACOS_PYENV_PY38_VERSION}/bin:${PATH}"',
]
Expand All @@ -386,7 +375,7 @@ def _osx_env_with_pyenv() -> List[str]:
def osx_shard(
*,
load_test_config: bool = True,
python_version: PythonVersion = PythonVersion.py36,
python_version: PythonVersion = PythonVersion.py37,
osx_image: Optional[str] = None,
) -> Dict:
setup = {
Expand Down Expand Up @@ -607,10 +596,9 @@ def rust_tests_linux() -> Dict:
"name": "Rust tests - Linux",
"env": [
"CACHE_NAME=rust_tests.linux",
# TODO: Despite being successfully linked at build time, the Linux rust tests
# shard is unable to locate `libpython3.6m.so.1.0` at runtime without this pointer:
# OSX appears to be fine.
'LD_LIBRARY_PATH="/opt/python/3.6.7/lib:${LD_LIBRARY_PATH}"',
# Despite being successfully linked at build time, the Linux Rust tests are unable to
# locate libpython3.7m.so.1.0 at runtime without this pointer.
'LD_LIBRARY_PATH="/opt/python/3.7.1/lib:${LD_LIBRARY_PATH}"',
],
}

Expand All @@ -628,7 +616,7 @@ def rust_tests_osx() -> Dict:
# See https://gist.github.com/stuhood/856a9b09bbaa86141f36c9925c14fae7
"osx_image": "xcode8",
"before_install": [
'./build-support/bin/install_python_for_ci.sh "${MACOS_PYENV_PY36_VERSION}"',
'./build-support/bin/install_python_for_ci.sh "${MACOS_PYENV_PY37_VERSION}"',
# We don't use the standard travis "addons" section here because it will either silently
# fail (on older images) or cause a multi-minute `brew update` (on newer images), neither of
# which we want. This doesn't happen if we just manually run `brew cask install`.
Expand Down Expand Up @@ -772,7 +760,7 @@ def ignore_aliases(self, data):


def main() -> None:
supported_python_versions = [PythonVersion.py36, PythonVersion.py37]
supported_python_versions = [PythonVersion.py37]
generated_yaml = yaml.dump(
{
# Conditions are documented here: https://docs.travis-ci.com/user/conditions-v1
Expand Down
2 changes: 1 addition & 1 deletion build-support/bin/native/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -euo pipefail

REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../../.. && pwd -P)

export PY=${PY:-python3}
export PY=${PY:-python3.7}
# Consumed by the cpython crate.
export PYTHON_SYS_EXECUTABLE="${PY}"

Expand Down
2 changes: 1 addition & 1 deletion build-support/bin/native/print_engine_hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# shellcheck source=build-support/pants_venv
source "${REPO_ROOT}/build-support/pants_venv"

export PY="${PY:-python3}"
export PY="${PY:-python3.7}"
activate_pants_venv 1>&2 # Redirect to ensure that we don't interfere with stdout.

calculate_current_hash
2 changes: 1 addition & 1 deletion build-support/bin/upload_coverage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

export PY=${PY:-python3}
export PY=${PY:-python3.7}
export PYTHON_SYS_EXECUTABLE="${PY}"

REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd -P)
Expand Down
10 changes: 2 additions & 8 deletions build-support/pants_venv
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ function activate_venv() {
source "$(venv_dir)/bin/activate"
}

function remove_venv() {
rm -rf "$(venv_dir)"
# Also remove legacy folders.
rm -rf "${venv_dir_prefix}.venv" "${venv_dir_prefix}.py{2,3}.venv"
}

function create_venv() {
remove_venv
rm -rf "$(venv_dir)"
"${REPO_ROOT}/build-support/virtualenv" "$(venv_dir)"
}

Expand All @@ -42,7 +36,7 @@ function ensure_gcc() {
ERROR: unable to execute 'gcc'. Please verify that your compiler is installed, in your
\$PATH and functional.

Hint: on Mac OS X, you may need to accept the XCode EULA: 'sudo xcodebuild -license accept'.
Hint: on macOS, you may need to accept the XCode EULA: 'sudo xcodebuild -license accept'.
MESSAGE
)"
fi
Expand Down
6 changes: 3 additions & 3 deletions pants
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
# WRAPPER_SRCPATH=/src/wrapper/src/main/python \
# exec /src/pantsbuild-pants/pants "$@"
#
# The script defaults to running with Python 3. To use a specific Python version,
# such as 3.7, prefix the script with `PY=python3.7`.
# The script defaults to running with Python 3.7. To use another Python version,
# such as 3.8, prefix the script with `PY=python3.8`.

set -e

Expand All @@ -57,7 +57,7 @@ source "${HERE}/build-support/pants_venv"
# shellcheck source=build-support/bin/native/bootstrap_code.sh
source "${HERE}/build-support/bin/native/bootstrap_code.sh"

export PY="${PY:-python3}"
export PY="${PY:-python3.7}"
Eric-Arellano marked this conversation as resolved.
Show resolved Hide resolved

PANTS_EXE="${HERE}/src/python/pants/bin/pants_loader.py"

Expand Down
1 change: 1 addition & 0 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ root_patterns = [
[python-setup]
requirement_constraints = "3rdparty/python/constraints.txt"
resolve_all_constraints = "nondeployables"
interpreter_constraints = [">=3.7,<3.9"]

[black]
config = "pyproject.toml"
Expand Down