Skip to content

Commit

Permalink
Merge pull request #1219 from yuvipanda/new-default
Browse files Browse the repository at this point in the history
Switch default python to 3.10
  • Loading branch information
minrk authored Feb 17, 2023
2 parents 8c0f49e + 847fdff commit 0a4cd19
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 80 deletions.
2 changes: 1 addition & 1 deletion repo2docker/buildpacks/conda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def get_build_scripts(self):
),
]

major_pythons = {"2": "2.7", "3": "3.7"}
major_pythons = {"2": "2.7", "3": "3.10"}

def get_build_script_files(self):
"""
Expand Down
70 changes: 40 additions & 30 deletions repo2docker/buildpacks/conda/environment-linux-64.lock

Large diffs are not rendered by default.

70 changes: 40 additions & 30 deletions repo2docker/buildpacks/conda/environment-linux-aarch64.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion repo2docker/buildpacks/conda/environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
channels:
- conda-forge
dependencies:
- python=3.7
- python=3.10
- nodejs=18
- pip
- ipywidgets==8.0.2
Expand Down
2 changes: 1 addition & 1 deletion repo2docker/buildpacks/conda/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def set_python(py_env_file, py):
default=("linux-64", "linux-aarch64"),
)
args = parser.parse_args()
default_py = "3.7"
default_py = "3.10"
for py in args.py:
for platform in args.platform:
env_file = pathlib.Path(str(ENV_FILE_T).format(py=py))
Expand Down
11 changes: 11 additions & 0 deletions tests/conda/downgrade/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# originally [email protected]
# added python=3.9 pin because implicit downgrade of Python from 3.10 to 3.9 isn't allowed
name: xeus-cling
channels:
- conda-forge
dependencies:
- python=3.9
- xeus-cling=0.6.0
- xtensor=0.20.8
- xtensor-blas=0.16.1
- notebook
30 changes: 30 additions & 0 deletions tests/conda/downgrade/verify
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
import json
import pprint
from subprocess import check_output


def json_sh(cmd):
"""Run a command that produces JSON on stdout and return the parsed result"""
buf = check_output(cmd)
return json.loads(buf.decode("utf8", "replace"))


conda_pkg_list = json_sh(["conda", "list", "--json"])
pprint.pprint(conda_pkg_list)
# make it a dict
pkgs = {pkg["name"]: pkg for pkg in conda_pkg_list}

# base env resolved
assert pkgs["python"]["version"].startswith("3.9"), pkgs["python"]
assert "xeus-cling" in pkgs
assert pkgs["xeus-cling"]["version"] == "0.6.0"

# verify downgrade
# this may be brittle, but it's unlikely any of these old versions
# of packages will be rebuilt
# xeus-cling 0.6.0 pins xeus 0.20, which pins openssl 1.1.1,
# which in turn downgrades Python from >=3.9.16 to 3.9.6

assert pkgs["openssl"]["version"].startswith("1.1.1"), pkgs["openssl"]["version"]
assert pkgs["python"]["version"] == "3.9.6", pkgs["python"]["version"]
4 changes: 2 additions & 2 deletions tests/conda/py-r-postbuild-file/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


def test_sys_version():
"""The default python version should be 3.7"""
assert sys.version_info[:2] == (3, 7)
"""The default python version should be 3.10"""
assert sys.version_info[:2] == (3, 10)


def test_there():
Expand Down
2 changes: 1 addition & 1 deletion tests/conda/py2/verify
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import sys

assert sys.version_info[:2] == (3, 7), sys.version
assert sys.version_info[:2] == (3, 10), sys.version

# verify that we have Python 2 and Python 3 kernelspecs
from jupyter_client.kernelspec import KernelSpecManager
Expand Down
2 changes: 1 addition & 1 deletion tests/conda/py35-binder-dir/verify
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import os
import sys
from subprocess import STDOUT, check_output

assert sys.version_info[:2] == (3, 7), sys.version
assert sys.version_info[:2] == (3, 10), sys.version


def sh(cmd, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion tests/conda/py36-postBuild/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_kernel_env(kernel_conda):
def test_server_env(server_conda):
# this should be the default version
# it will need updating when the default changes
assert server_conda["python"]["version"][:3] == "3.7"
assert server_conda["python"]["version"].split(".")[:2] == ["3", "10"]


def test_conda_install(kernel_conda, server_conda):
Expand Down
14 changes: 4 additions & 10 deletions tests/external/reproductions.repos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,20 @@
ref: b8259dac9eb
verify: python -c 'import matplotlib'
# Test that a full remote/ref works
- name: Binder Examples - Requirements
- name: Binder Examples - Requirements - origin/main
url: https://github.com/binder-examples/requirements
ref: origin/main
verify: python -c 'import matplotlib'
# Test that ref is added to branch if not present
- name: Binder Examples - Requirements
- name: Binder Examples - Requirements - main
url: https://github.com/binder-examples/requirements
ref: main
verify: python -c 'import matplotlib'
# Test that tags work + ref is added to tag if not present
- name: Binder Examples - Requirements
- name: Binder Examples - Requirements - tag
url: https://github.com/binder-examples/requirements
ref: python-3.7
ref: python-3.8
verify: python -c 'import matplotlib'
# Test that custom channels and downgrades don't
# get blocked by pinning
- name: Xeus-Cling
url: https://github.com/QuantStack/xeus-cling
ref: 0.6.0
verify: jupyter kernelspec list
# Zenodo record of https://github.com/binder-examples/requirements
- name: 10.5281/zenodo.3242074
url: 10.5281/zenodo.3242074
Expand Down
2 changes: 1 addition & 1 deletion tests/venv/default/verify
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Verify that the default just provides a py3 environment with jupyter
import sys

assert sys.version_info[:2] == (3, 7), sys.version
assert sys.version_info[:2] == (3, 10), sys.version
import jupyter

with open("/tmp/appendix") as f:
Expand Down
2 changes: 1 addition & 1 deletion tests/venv/numpy/verify
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
import sys

assert sys.version_info[:2] == (3, 7)
assert sys.version_info[:2] == (3, 10)

import numpy

0 comments on commit 0a4cd19

Please sign in to comment.