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 f954d35
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 31 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 }}
2 changes: 1 addition & 1 deletion 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
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
15 changes: 14 additions & 1 deletion pkg/dockerfile/standard_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func TestGenerateEmptyCPU(t *testing.T) {
conf, err := config.FromYAML([]byte(`
build:
gpu: false
python_version: "3.12"
predict: predict.py:Predictor
`))
require.NoError(t, err)
Expand Down Expand Up @@ -121,6 +122,7 @@ func TestGenerateEmptyGPU(t *testing.T) {
conf, err := config.FromYAML([]byte(`
build:
gpu: true
python_version: "3.12"
predict: predict.py:Predictor
`))
require.NoError(t, err)
Expand Down Expand Up @@ -155,6 +157,7 @@ func TestGenerateFullCPU(t *testing.T) {
conf, err := config.FromYAML([]byte(`
build:
gpu: false
python_version: "3.12"
system_packages:
- ffmpeg
- cowsay
Expand Down Expand Up @@ -209,6 +212,7 @@ func TestGenerateFullGPU(t *testing.T) {
conf, err := config.FromYAML([]byte(`
build:
gpu: true
python_version: "3.12"
system_packages:
- ffmpeg
- cowsay
Expand Down Expand Up @@ -264,6 +268,7 @@ func TestPreInstall(t *testing.T) {

conf, err := config.FromYAML([]byte(`
build:
python_version: "3.12"
system_packages:
- cowsay
pre_install:
Expand Down Expand Up @@ -303,6 +308,7 @@ func TestPythonRequirements(t *testing.T) {
require.NoError(t, err)
conf, err := config.FromYAML([]byte(`
build:
python_version: "3.12"
python_requirements: "my-requirements.txt"
`))
require.NoError(t, err)
Expand Down Expand Up @@ -349,6 +355,7 @@ func TestGenerateWithLargeModels(t *testing.T) {
conf, err := config.FromYAML([]byte(`
build:
gpu: true
python_version: "3.12"
system_packages:
- ffmpeg
- cowsay
Expand Down Expand Up @@ -454,6 +461,7 @@ func TestGenerateDockerfileWithoutSeparateWeights(t *testing.T) {
conf, err := config.FromYAML([]byte(`
build:
gpu: false
python_version: "3.12"
predict: predict.py:Predictor
`))
require.NoError(t, err)
Expand Down Expand Up @@ -487,6 +495,7 @@ func TestGenerateEmptyCPUWithCogBaseImage(t *testing.T) {
conf, err := config.FromYAML([]byte(`
build:
gpu: false
python_version: "3.12"
predict: predict.py:Predictor
`))
require.NoError(t, err)
Expand Down Expand Up @@ -516,10 +525,10 @@ func TestGeneratePythonCPUWithCogBaseImage(t *testing.T) {
conf, err := config.FromYAML([]byte(`
build:
gpu: false
python_version: "3.12"
system_packages:
- ffmpeg
- cowsay
python_version: "3.12"
python_packages:
- pandas==1.2.0.12
run:
Expand Down Expand Up @@ -624,6 +633,7 @@ func TestGenerateTorchWithStrippedModifiedVersion(t *testing.T) {
build:
gpu: true
cuda: "11.8"
python_version: "3.12"
system_packages:
- ffmpeg
- cowsay
Expand Down Expand Up @@ -675,6 +685,7 @@ func TestGenerateWithStrip(t *testing.T) {
build:
gpu: true
cuda: "11.8"
python_version: "3.12"
system_packages:
- ffmpeg
- cowsay
Expand Down Expand Up @@ -727,6 +738,7 @@ func TestGenerateDoesNotContainDangerousCFlags(t *testing.T) {
build:
gpu: true
cuda: "11.8"
python_version: "3.12"
system_packages:
- ffmpeg
- cowsay
Expand Down Expand Up @@ -758,6 +770,7 @@ func TestGenerateWithPrecompile(t *testing.T) {
build:
gpu: true
cuda: "11.8"
python_version: "3.12"
system_packages:
- ffmpeg
- cowsay
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 f954d35

Please sign in to comment.