Skip to content

Commit

Permalink
Use Python 3.13 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
erbridge committed Jan 6, 2025
1 parent cd453f6 commit 1464913
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 47 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
go-version-file: go.mod
- uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.13
- uses: hynek/setup-cached-uv@v2
- name: Prepare tox
run: uv pip install --system tox tox-uv
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
go-version-file: go.mod
- uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.13
- uses: hynek/setup-cached-uv@v2
- name: Prepare tox
run: uv pip install --system tox tox-uv
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ build:
system_packages:
- "libgl1-mesa-glx"
- "libglib2.0-0"
python_version: "3.12"
python_version: "3.13"
python_packages:
- "torch==2.3"
predict: "predict.py:Predictor"
Expand Down Expand Up @@ -131,7 +131,7 @@ If you're using macOS, you can install Cog using Homebrew:
brew install cog
```

You can also download and install the latest release using our
You can also download and install the latest release using our
[install script](https://cog.run/install):

```sh
Expand All @@ -146,7 +146,7 @@ wget -qO- https://cog.run/install.sh
sh ./install.sh
```

You can manually install the latest release of Cog directly from GitHub
You can manually install the latest release of Cog directly from GitHub
by running the following commands in a terminal:

```console
Expand Down
4 changes: 2 additions & 2 deletions docs/yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ build:
python_version: "3.11.1"
```

Cog supports all active branches of Python: 3.8, 3.9, 3.10, 3.11, 3.12. If you don't define a version, Cog will use the latest version of Python 3.12 or a version of Python that is compatible with the versions of PyTorch or TensorFlow you specify.
Cog supports all active branches of Python: 3.8, 3.9, 3.10, 3.11, 3.12, 3.13. If you don't define a version, Cog will use the latest version of Python 3.13 or a version of Python that is compatible with the versions of PyTorch or TensorFlow you specify.

Note that these are the versions supported **in the Docker container**, not your host machine. You can run any version(s) of Python you wish on your host machine.

Expand Down Expand Up @@ -158,7 +158,7 @@ r8.im is Replicate's registry, but this can be any Docker registry.

If you don't set this, then a name will be generated from the directory name.

If you set this, then you can run `cog push` without specifying the model name.
If you set this, then you can run `cog push` without specifying the model name.

If you specify an image name argument when pushing (like `cog push your-username/custom-model-name`), the argument will be used and the value of `image` in cog.yaml will be ignored.

Expand Down
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func DefaultConfig() *Config {
return &Config{
Build: &Build{
GPU: false,
PythonVersion: "3.12",
PythonVersion: "3.13",
},
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestValidateModelPythonVersion(t *testing.T) {
}{
{
name: "ValidVersion",
pythonVersion: "3.12",
pythonVersion: "3.13",
},
{
name: "MinimumVersion",
Expand All @@ -39,7 +39,7 @@ func TestValidateModelPythonVersion(t *testing.T) {
},
{
name: "FullyQualifiedVersion",
pythonVersion: "3.12.1",
pythonVersion: "3.13.1",
},
{
name: "InvalidFormat",
Expand Down
33 changes: 16 additions & 17 deletions pkg/config/torch_compatibility_matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"ExtraIndexURL": "https://download.pytorch.org/whl/cpu",
"CUDA": null,
"Pythons": [
"3.9",
"3.10",
"3.11",
"3.12",
"3.9"
"3.12"
]
},
{
Expand All @@ -21,10 +21,10 @@
"ExtraIndexURL": "https://download.pytorch.org/whl/cu118",
"CUDA": "11.8",
"Pythons": [
"3.9",
"3.10",
"3.11",
"3.12",
"3.9"
"3.12"
]
},
{
Expand All @@ -35,10 +35,10 @@
"ExtraIndexURL": "https://download.pytorch.org/whl/cu121",
"CUDA": "12.1",
"Pythons": [
"3.9",
"3.10",
"3.11",
"3.12",
"3.9"
"3.12"
]
},
{
Expand All @@ -49,10 +49,10 @@
"ExtraIndexURL": "https://download.pytorch.org/whl/cu124",
"CUDA": "12.4",
"Pythons": [
"3.9",
"3.10",
"3.11",
"3.12",
"3.9"
"3.12"
]
},
{
Expand All @@ -63,11 +63,11 @@
"ExtraIndexURL": "https://download.pytorch.org/whl/cpu",
"CUDA": null,
"Pythons": [
"3.9",
"3.10",
"3.11",
"3.12",
"3.13",
"3.9"
"3.13"
]
},
{
Expand All @@ -78,11 +78,11 @@
"ExtraIndexURL": "https://download.pytorch.org/whl/cu118",
"CUDA": "11.8",
"Pythons": [
"3.9",
"3.10",
"3.11",
"3.12",
"3.13",
"3.9"
"3.13"
]
},
{
Expand All @@ -93,12 +93,11 @@
"ExtraIndexURL": "https://download.pytorch.org/whl/cu121",
"CUDA": "12.1",
"Pythons": [
"3.9",
"3.10",
"3.11",
"3.12",
"3.13",
"3.9",
"3.10"
"3.13"
]
},
{
Expand All @@ -109,11 +108,11 @@
"ExtraIndexURL": "https://download.pytorch.org/whl/cu124",
"CUDA": "12.4",
"Pythons": [
"3.9",
"3.10",
"3.11",
"3.12",
"3.13",
"3.9"
"3.13"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion pkg/dockerfile/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestBaseImageConfigurationExists(t *testing.T) {
}

func TestBaseImageConfigurationExistsNoTorch(t *testing.T) {
exists, _, _, _ := BaseImageConfigurationExists("", "3.12", "")
exists, _, _, _ := BaseImageConfigurationExists("", "3.13", "")
require.True(t, exists)
}

Expand Down
26 changes: 13 additions & 13 deletions pkg/dockerfile/standard_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ predict: predict.py:Predictor

expected := `#syntax=docker/dockerfile:1.4
FROM r8.im/replicate/cog-test-weights AS weights
FROM python:3.12-slim
FROM python:3.13-slim
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib64:/usr/local/nvidia/bin
Expand Down Expand Up @@ -138,7 +138,7 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib64:/usr/local/nvidia/bin
ENV NVIDIA_DRIVER_CAPABILITIES=all
` + testTini() + testInstallPython("3.12") + "RUN rm -rf /usr/bin/python3 && ln -s `realpath \\`pyenv which python\\`` /usr/bin/python3 && chmod +x /usr/bin/python3" + `
` + testTini() + testInstallPython("3.13") + "RUN rm -rf /usr/bin/python3 && ln -s `realpath \\`pyenv which python\\`` /usr/bin/python3 && chmod +x /usr/bin/python3" + `
` + testInstallCog(gen.relativeTmpDir, gen.strip) + `
RUN find / -type f -name "*python*.so" -printf "%h\n" | sort -u > /etc/ld.so.conf.d/cog.conf && ldconfig
WORKDIR /src
Expand Down Expand Up @@ -176,7 +176,7 @@ predict: predict.py:Predictor

expected := `#syntax=docker/dockerfile:1.4
FROM r8.im/replicate/cog-test-weights AS weights
FROM python:3.12-slim
FROM python:3.13-slim
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib64:/usr/local/nvidia/bin
Expand Down Expand Up @@ -236,7 +236,7 @@ ENV PYTHONUNBUFFERED=1
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib64:/usr/local/nvidia/bin
ENV NVIDIA_DRIVER_CAPABILITIES=all
` + testTini() + `RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update -qq && apt-get install -qqy ffmpeg cowsay && rm -rf /var/lib/apt/lists/*
` + testInstallPython("3.12") + "RUN rm -rf /usr/bin/python3 && ln -s `realpath \\`pyenv which python\\`` /usr/bin/python3 && chmod +x /usr/bin/python3" + `
` + testInstallPython("3.13") + "RUN rm -rf /usr/bin/python3 && ln -s `realpath \\`pyenv which python\\`` /usr/bin/python3 && chmod +x /usr/bin/python3" + `
COPY ` + gen.relativeTmpDir + `/requirements.txt /tmp/requirements.txt
ENV CFLAGS="-O3 -funroll-loops -fno-strict-aliasing -flto -S"
RUN --mount=type=cache,target=/root/.cache/pip pip install -r /tmp/requirements.txt
Expand Down Expand Up @@ -280,7 +280,7 @@ build:

expected := `#syntax=docker/dockerfile:1.4
FROM r8.im/replicate/cog-test-weights AS weights
FROM python:3.12-slim
FROM python:3.13-slim
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib64:/usr/local/nvidia/bin
Expand Down Expand Up @@ -394,7 +394,7 @@ ENV PYTHONUNBUFFERED=1
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib64:/usr/local/nvidia/bin
ENV NVIDIA_DRIVER_CAPABILITIES=all
` + testTini() + `RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update -qq && apt-get install -qqy ffmpeg cowsay && rm -rf /var/lib/apt/lists/*` + `
` + testInstallPython("3.12") + `RUN rm -rf /usr/bin/python3 && ln -s ` + "`realpath \\`pyenv which python\\`` /usr/bin/python3 && chmod +x /usr/bin/python3" + `
` + testInstallPython("3.13") + `RUN rm -rf /usr/bin/python3 && ln -s ` + "`realpath \\`pyenv which python\\`` /usr/bin/python3 && chmod +x /usr/bin/python3" + `
COPY ` + gen.relativeTmpDir + `/requirements.txt /tmp/requirements.txt
ENV CFLAGS="-O3 -funroll-loops -fno-strict-aliasing -flto -S"
RUN --mount=type=cache,target=/root/.cache/pip pip install -r /tmp/requirements.txt
Expand Down Expand Up @@ -466,7 +466,7 @@ predict: predict.py:Predictor
require.NoError(t, err)

expected := `#syntax=docker/dockerfile:1.4
FROM python:3.12-slim
FROM python:3.13-slim
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib64:/usr/local/nvidia/bin
Expand Down Expand Up @@ -500,7 +500,7 @@ predict: predict.py:Predictor

expected := `#syntax=docker/dockerfile:1.4
FROM r8.im/replicate/cog-test-weights AS weights
FROM r8.im/cog-base:python3.12
FROM r8.im/cog-base:python3.13
` + testInstallCog(gen.relativeTmpDir, gen.strip) + `
WORKDIR /src
EXPOSE 5000
Expand All @@ -519,7 +519,7 @@ build:
system_packages:
- ffmpeg
- cowsay
python_version: "3.12"
python_version: "3.13"
python_packages:
- pandas==1.2.0.12
run:
Expand All @@ -537,7 +537,7 @@ predict: predict.py:Predictor

expected := `#syntax=docker/dockerfile:1.4
FROM r8.im/replicate/cog-test-weights AS weights
FROM r8.im/cog-base:python3.12
FROM r8.im/cog-base:python3.13
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update -qq && apt-get install -qqy cowsay && rm -rf /var/lib/apt/lists/*
` + testInstallCog(gen.relativeTmpDir, gen.strip) + `
COPY ` + gen.relativeTmpDir + `/requirements.txt /tmp/requirements.txt
Expand Down Expand Up @@ -646,7 +646,7 @@ predict: predict.py:Predictor

expected := `#syntax=docker/dockerfile:1.4
FROM r8.im/replicate/cog-test-weights AS weights
FROM r8.im/cog-base:cuda11.8-python3.12-torch2.3.1
FROM r8.im/cog-base:cuda11.8-python3.13-torch2.3.1
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update -qq && apt-get install -qqy cowsay && rm -rf /var/lib/apt/lists/*
` + testInstallCog(gen.relativeTmpDir, gen.strip) + `
COPY ` + gen.relativeTmpDir + `/requirements.txt /tmp/requirements.txt
Expand Down Expand Up @@ -698,7 +698,7 @@ predict: predict.py:Predictor

expected := `#syntax=docker/dockerfile:1.4
FROM r8.im/replicate/cog-test-weights AS weights
FROM r8.im/cog-base:cuda11.8-python3.12-torch2.3.1
FROM r8.im/cog-base:cuda11.8-python3.13-torch2.3.1
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update -qq && apt-get install -qqy cowsay && rm -rf /var/lib/apt/lists/*
` + testInstallCog(gen.relativeTmpDir, gen.strip) + `
COPY ` + gen.relativeTmpDir + `/requirements.txt /tmp/requirements.txt
Expand Down Expand Up @@ -782,7 +782,7 @@ predict: predict.py:Predictor

expected := `#syntax=docker/dockerfile:1.4
FROM r8.im/replicate/cog-test-weights AS weights
FROM r8.im/cog-base:cuda11.8-python3.12-torch2.3.1
FROM r8.im/cog-base:cuda11.8-python3.13-torch2.3.1
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update -qq && apt-get install -qqy cowsay && rm -rf /var/lib/apt/lists/*
` + testInstallCog(gen.relativeTmpDir, gen.strip) + `
COPY ` + gen.relativeTmpDir + `/requirements.txt /tmp/requirements.txt
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.8"

Expand Down
2 changes: 1 addition & 1 deletion tools/compatgen/internal/torch.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func parseTorchInstallString(s string, defaultVersions map[string]string, cuda *
torchaudio := libVersions["torchaudio"]

// TODO: this could be determined from https://download.pytorch.org/whl/torch/
pythons := []string{"3.8", "3.9", "3.10", "3.11", "3.12"}
pythons := []string{"3.8", "3.9", "3.10", "3.11", "3.12", "3.13"}

return &config.TorchCompatibility{
Torch: torch,
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ commands =
tests: pytest python/tests --cov={env_site_packages_dir}/cog --cov-report term-missing:skip-covered {posargs:-n auto -vv}

[testenv:lint]
base_python = python3.12
base_python = python3.13
skip_install = true
deps = ruff
commands =
ruff check python/cog
ruff format --check python

[testenv:typecheck-pydantic1]
base_python = python3.12
base_python = python3.13
deps =
pyright==1.1.375
pydantic>=1,<2
Expand All @@ -54,14 +54,14 @@ allowlist_externals =
sed

[testenv:typecheck-pydantic2]
base_python = python3.12
base_python = python3.13
deps =
pyright==1.1.375
pydantic>=2,<3
commands = pyright {posargs}

[testenv:integration]
base_python = python3.12
base_python = python3.13
changedir = test-integration
skip_install = true
deps =
Expand Down

0 comments on commit 1464913

Please sign in to comment.