mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-10 19:42:58 +00:00
Use Python 3.12 for internal code (#2222)
* Use Python 3.12 for internal code * Add changelog entry
This commit is contained in:
2
.github/actions/create-dev-env/action.yml
vendored
2
.github/actions/create-dev-env/action.yml
vendored
@@ -7,7 +7,7 @@ runs:
|
|||||||
- name: Set Up Python 🐍
|
- name: Set Up Python 🐍
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: 3.12
|
||||||
|
|
||||||
- name: Install Dev Dependencies 📦
|
- name: Install Dev Dependencies 📦
|
||||||
run: |
|
run: |
|
||||||
|
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
- name: Set Up Python 🐍
|
- name: Set Up Python 🐍
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.12
|
||||||
|
|
||||||
- name: Install pre-commit 📦
|
- name: Install pre-commit 📦
|
||||||
run: |
|
run: |
|
||||||
|
2
.github/workflows/sphinx.yml
vendored
2
.github/workflows/sphinx.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
|||||||
- name: Set Up Python 🐍
|
- name: Set Up Python 🐍
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: 3.12
|
||||||
|
|
||||||
- name: Install Doc Dependencies 📦
|
- name: Install Doc Dependencies 📦
|
||||||
run: |
|
run: |
|
||||||
|
@@ -17,7 +17,7 @@ repos:
|
|||||||
rev: v3.19.1
|
rev: v3.19.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: [--py39-plus]
|
args: [--py312-plus]
|
||||||
|
|
||||||
# Automatically sort python imports
|
# Automatically sort python imports
|
||||||
- repo: https://github.com/PyCQA/isort
|
- repo: https://github.com/PyCQA/isort
|
||||||
@@ -31,7 +31,7 @@ repos:
|
|||||||
rev: 25.1.0
|
rev: 25.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
args: [--target-version=py39]
|
args: [--target-version=py312]
|
||||||
|
|
||||||
# Check python code static typing
|
# Check python code static typing
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
@@ -141,10 +141,10 @@ repos:
|
|||||||
rev: 1.9.1
|
rev: 1.9.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: nbqa-pyupgrade
|
- id: nbqa-pyupgrade
|
||||||
args: [--py39-plus]
|
args: [--py312-plus]
|
||||||
- id: nbqa-isort
|
- id: nbqa-isort
|
||||||
- id: nbqa-black
|
- id: nbqa-black
|
||||||
args: [--target-version=py39]
|
args: [--target-version=py312]
|
||||||
- id: nbqa-flake8
|
- id: nbqa-flake8
|
||||||
|
|
||||||
# Run black on python code blocks in documentation files.
|
# Run black on python code blocks in documentation files.
|
||||||
@@ -156,7 +156,7 @@ repos:
|
|||||||
# the python code blocks include jupyter-specific additions such as % or !
|
# the python code blocks include jupyter-specific additions such as % or !
|
||||||
# See https://github.com/adamchainz/blacken-docs/issues/127 for an upstream
|
# See https://github.com/adamchainz/blacken-docs/issues/127 for an upstream
|
||||||
# feature request about this.
|
# feature request about this.
|
||||||
args: [--target-version=py39, --skip-errors]
|
args: [--target-version=py312, --skip-errors]
|
||||||
|
|
||||||
# pre-commit.ci config reference: https://pre-commit.ci/#configuration
|
# pre-commit.ci config reference: https://pre-commit.ci/#configuration
|
||||||
ci:
|
ci:
|
||||||
|
@@ -11,6 +11,7 @@ Affected: all images.
|
|||||||
- **Non-breaking:** don't create extra free space in runners for cuda images ([#2218](https://github.com/jupyter/docker-stacks/pull/2218)).
|
- **Non-breaking:** don't create extra free space in runners for cuda images ([#2218](https://github.com/jupyter/docker-stacks/pull/2218)).
|
||||||
- **Non-breaking:** revert "Pin some packages to fix `r-notebook` and `datascience-notebook` under aarch64" ([#2220](https://github.com/jupyter/docker-stacks/pull/2220)).
|
- **Non-breaking:** revert "Pin some packages to fix `r-notebook` and `datascience-notebook` under aarch64" ([#2220](https://github.com/jupyter/docker-stacks/pull/2220)).
|
||||||
- **Non-breaking:** Simplify and improve `test_packages.py` ([#2219](https://github.com/jupyter/docker-stacks/pull/2219)).
|
- **Non-breaking:** Simplify and improve `test_packages.py` ([#2219](https://github.com/jupyter/docker-stacks/pull/2219)).
|
||||||
|
- **Non-breaking:** Use Python 3.12 for internal code ([#2222](https://github.com/jupyter/docker-stacks/pull/2222)).
|
||||||
|
|
||||||
## 2025-02-17
|
## 2025-02-17
|
||||||
|
|
||||||
|
2
mypy.ini
2
mypy.ini
@@ -8,7 +8,7 @@
|
|||||||
# We use mypy as part of pre-commit checks
|
# We use mypy as part of pre-commit checks
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
python_version = 3.9
|
python_version = 3.12
|
||||||
follow_imports = error
|
follow_imports = error
|
||||||
strict = True
|
strict = True
|
||||||
no_incremental = True
|
no_incremental = True
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import logging
|
import logging
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import docker
|
import docker
|
||||||
from docker.models.containers import Container
|
from docker.models.containers import Container
|
||||||
@@ -17,7 +16,7 @@ class DockerRunner:
|
|||||||
docker_client: docker.DockerClient = docker.from_env(),
|
docker_client: docker.DockerClient = docker.from_env(),
|
||||||
command: str = "sleep infinity",
|
command: str = "sleep infinity",
|
||||||
):
|
):
|
||||||
self.container: Optional[Container] = None
|
self.container: Container | None = None
|
||||||
self.image_name: str = image_name
|
self.image_name: str = image_name
|
||||||
self.command: str = command
|
self.command: str = command
|
||||||
self.docker_client: docker.DockerClient = docker_client
|
self.docker_client: docker.DockerClient = docker_client
|
||||||
@@ -34,9 +33,9 @@ class DockerRunner:
|
|||||||
|
|
||||||
def __exit__(
|
def __exit__(
|
||||||
self,
|
self,
|
||||||
exc_type: Optional[type[BaseException]],
|
exc_type: type[BaseException] | None,
|
||||||
exc_val: Optional[BaseException],
|
exc_val: BaseException | None,
|
||||||
exc_tb: Optional[TracebackType],
|
exc_tb: TracebackType | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
assert self.container is not None
|
assert self.container is not None
|
||||||
LOGGER.info(f"Removing container {self.container.name} ...")
|
LOGGER.info(f"Removing container {self.container.name} ...")
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from tagging.images_hierarchy import ALL_IMAGES
|
from tagging.images_hierarchy import ALL_IMAGES
|
||||||
from tagging.manifests import ManifestInterface
|
from tagging.manifests import ManifestInterface
|
||||||
@@ -8,7 +7,7 @@ from tagging.taggers import TaggerInterface
|
|||||||
|
|
||||||
|
|
||||||
def get_taggers_and_manifests(
|
def get_taggers_and_manifests(
|
||||||
short_image_name: Optional[str],
|
short_image_name: str | None,
|
||||||
) -> tuple[list[TaggerInterface], list[ManifestInterface]]:
|
) -> tuple[list[TaggerInterface], list[ManifestInterface]]:
|
||||||
if short_image_name is None:
|
if short_image_name is None:
|
||||||
return [[], []] # type: ignore
|
return [[], []] # type: ignore
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from tagging.manifests import (
|
from tagging.manifests import (
|
||||||
AptPackagesManifest,
|
AptPackagesManifest,
|
||||||
@@ -32,7 +31,7 @@ from tagging.taggers import (
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ImageDescription:
|
class ImageDescription:
|
||||||
parent_image: Optional[str]
|
parent_image: str | None
|
||||||
taggers: list[TaggerInterface] = field(default_factory=list)
|
taggers: list[TaggerInterface] = field(default_factory=list)
|
||||||
manifests: list[ManifestInterface] = field(default_factory=list)
|
manifests: list[ManifestInterface] = field(default_factory=list)
|
||||||
|
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
import pytest # type: ignore
|
||||||
|
|
||||||
@@ -56,9 +55,9 @@ LOGGER = logging.getLogger(__name__)
|
|||||||
)
|
)
|
||||||
def test_healthy(
|
def test_healthy(
|
||||||
container: TrackedContainer,
|
container: TrackedContainer,
|
||||||
env: Optional[list[str]],
|
env: list[str] | None,
|
||||||
cmd: Optional[list[str]],
|
cmd: list[str] | None,
|
||||||
user: Optional[str],
|
user: str | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
running_container = container.run_detached(
|
running_container = container.run_detached(
|
||||||
tty=True,
|
tty=True,
|
||||||
@@ -104,9 +103,9 @@ def test_healthy(
|
|||||||
)
|
)
|
||||||
def test_healthy_with_proxy(
|
def test_healthy_with_proxy(
|
||||||
container: TrackedContainer,
|
container: TrackedContainer,
|
||||||
env: Optional[list[str]],
|
env: list[str] | None,
|
||||||
cmd: Optional[list[str]],
|
cmd: list[str] | None,
|
||||||
user: Optional[str],
|
user: str | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
running_container = container.run_detached(
|
running_container = container.run_detached(
|
||||||
tty=True,
|
tty=True,
|
||||||
@@ -142,8 +141,8 @@ def test_healthy_with_proxy(
|
|||||||
)
|
)
|
||||||
def test_not_healthy(
|
def test_not_healthy(
|
||||||
container: TrackedContainer,
|
container: TrackedContainer,
|
||||||
env: Optional[list[str]],
|
env: list[str] | None,
|
||||||
cmd: Optional[list[str]],
|
cmd: list[str] | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
running_container = container.run_detached(
|
running_container = container.run_detached(
|
||||||
tty=True,
|
tty=True,
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
import pytest # type: ignore
|
||||||
import requests
|
import requests
|
||||||
@@ -32,7 +31,7 @@ LOGGER = logging.getLogger(__name__)
|
|||||||
def test_start_notebook(
|
def test_start_notebook(
|
||||||
container: TrackedContainer,
|
container: TrackedContainer,
|
||||||
http_client: requests.Session,
|
http_client: requests.Session,
|
||||||
env: Optional[list[str]],
|
env: list[str] | None,
|
||||||
expected_command: str,
|
expected_command: str,
|
||||||
expected_start: bool,
|
expected_start: bool,
|
||||||
expected_warnings: list[str],
|
expected_warnings: list[str],
|
||||||
|
@@ -4,7 +4,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
from contextlib import closing
|
from contextlib import closing
|
||||||
from typing import Any, Optional
|
from typing import Any
|
||||||
|
|
||||||
import docker
|
import docker
|
||||||
import pytest # type: ignore
|
import pytest # type: ignore
|
||||||
@@ -72,7 +72,7 @@ class TrackedContainer:
|
|||||||
image_name: str,
|
image_name: str,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
):
|
):
|
||||||
self.container: Optional[Container] = None
|
self.container: Container | None = None
|
||||||
self.docker_client: docker.DockerClient = docker_client
|
self.docker_client: docker.DockerClient = docker_client
|
||||||
self.image_name: str = image_name
|
self.image_name: str = image_name
|
||||||
self.kwargs: Any = kwargs
|
self.kwargs: Any = kwargs
|
||||||
|
@@ -40,8 +40,7 @@ Example:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from collections.abc import Iterable
|
from collections.abc import Callable, Iterable
|
||||||
from typing import Callable
|
|
||||||
|
|
||||||
import pytest # type: ignore
|
import pytest # type: ignore
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
# Copyright (c) Jupyter Development Team.
|
# Copyright (c) Jupyter Development Team.
|
||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
THIS_DIR = Path(__file__).parent.resolve()
|
THIS_DIR = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
@@ -23,7 +22,7 @@ ALL_IMAGES = {
|
|||||||
|
|
||||||
|
|
||||||
def get_test_dirs(
|
def get_test_dirs(
|
||||||
short_image_name: Optional[str],
|
short_image_name: str | None,
|
||||||
) -> list[Path]:
|
) -> list[Path]:
|
||||||
if short_image_name is None:
|
if short_image_name is None:
|
||||||
return []
|
return []
|
||||||
|
@@ -27,7 +27,7 @@ import logging
|
|||||||
import re
|
import re
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from typing import Any, Optional
|
from typing import Any
|
||||||
|
|
||||||
from docker.models.containers import Container
|
from docker.models.containers import Container
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
@@ -44,9 +44,9 @@ class CondaPackageHelper:
|
|||||||
self.running_container: Container = CondaPackageHelper.start_container(
|
self.running_container: Container = CondaPackageHelper.start_container(
|
||||||
container
|
container
|
||||||
)
|
)
|
||||||
self.requested: Optional[dict[str, set[str]]] = None
|
self.requested: dict[str, set[str]] | None = None
|
||||||
self.installed: Optional[dict[str, set[str]]] = None
|
self.installed: dict[str, set[str]] | None = None
|
||||||
self.available: Optional[dict[str, set[str]]] = None
|
self.available: dict[str, set[str]] | None = None
|
||||||
self.comparison: list[dict[str, str]] = []
|
self.comparison: list[dict[str, str]] = []
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Reference in New Issue
Block a user