Skip to content

Commit f954d35

Browse files
committed
Use Python 3.13 by default
1 parent cd453f6 commit f954d35

File tree

10 files changed

+44
-31
lines changed

10 files changed

+44
-31
lines changed

.github/workflows/ci.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
go-version-file: go.mod
4949
- uses: actions/setup-python@v5
5050
with:
51-
python-version: 3.12
51+
python-version: 3.13
5252
- uses: hynek/setup-cached-uv@v2
5353
- name: Prepare tox
5454
run: uv pip install --system tox tox-uv
@@ -138,7 +138,7 @@ jobs:
138138
go-version-file: go.mod
139139
- uses: actions/setup-python@v5
140140
with:
141-
python-version: 3.12
141+
python-version: 3.13
142142
- uses: hynek/setup-cached-uv@v2
143143
- name: Prepare tox
144144
run: uv pip install --system tox tox-uv
@@ -171,7 +171,7 @@ jobs:
171171
go-version-file: go.mod
172172
- uses: goreleaser/goreleaser-action@v6
173173
with:
174-
version: '~> v2'
174+
version: "~> v2"
175175
args: release --clean
176176
env:
177177
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs/yaml.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ build:
100100
python_version: "3.11.1"
101101
```
102102

103-
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.
103+
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.
104104

105105
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.
106106

pkg/config/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func DefaultConfig() *Config {
8080
return &Config{
8181
Build: &Build{
8282
GPU: false,
83-
PythonVersion: "3.12",
83+
PythonVersion: "3.13",
8484
},
8585
}
8686
}

pkg/config/config_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestValidateModelPythonVersion(t *testing.T) {
2020
}{
2121
{
2222
name: "ValidVersion",
23-
pythonVersion: "3.12",
23+
pythonVersion: "3.13",
2424
},
2525
{
2626
name: "MinimumVersion",
@@ -39,7 +39,7 @@ func TestValidateModelPythonVersion(t *testing.T) {
3939
},
4040
{
4141
name: "FullyQualifiedVersion",
42-
pythonVersion: "3.12.1",
42+
pythonVersion: "3.13.1",
4343
},
4444
{
4545
name: "InvalidFormat",

pkg/config/torch_compatibility_matrix.json

+16-17
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
"ExtraIndexURL": "https://download.pytorch.org/whl/cpu",
88
"CUDA": null,
99
"Pythons": [
10+
"3.9",
1011
"3.10",
1112
"3.11",
12-
"3.12",
13-
"3.9"
13+
"3.12"
1414
]
1515
},
1616
{
@@ -21,10 +21,10 @@
2121
"ExtraIndexURL": "https://download.pytorch.org/whl/cu118",
2222
"CUDA": "11.8",
2323
"Pythons": [
24+
"3.9",
2425
"3.10",
2526
"3.11",
26-
"3.12",
27-
"3.9"
27+
"3.12"
2828
]
2929
},
3030
{
@@ -35,10 +35,10 @@
3535
"ExtraIndexURL": "https://download.pytorch.org/whl/cu121",
3636
"CUDA": "12.1",
3737
"Pythons": [
38+
"3.9",
3839
"3.10",
3940
"3.11",
40-
"3.12",
41-
"3.9"
41+
"3.12"
4242
]
4343
},
4444
{
@@ -49,10 +49,10 @@
4949
"ExtraIndexURL": "https://download.pytorch.org/whl/cu124",
5050
"CUDA": "12.4",
5151
"Pythons": [
52+
"3.9",
5253
"3.10",
5354
"3.11",
54-
"3.12",
55-
"3.9"
55+
"3.12"
5656
]
5757
},
5858
{
@@ -63,11 +63,11 @@
6363
"ExtraIndexURL": "https://download.pytorch.org/whl/cpu",
6464
"CUDA": null,
6565
"Pythons": [
66+
"3.9",
6667
"3.10",
6768
"3.11",
6869
"3.12",
69-
"3.13",
70-
"3.9"
70+
"3.13"
7171
]
7272
},
7373
{
@@ -78,11 +78,11 @@
7878
"ExtraIndexURL": "https://download.pytorch.org/whl/cu118",
7979
"CUDA": "11.8",
8080
"Pythons": [
81+
"3.9",
8182
"3.10",
8283
"3.11",
8384
"3.12",
84-
"3.13",
85-
"3.9"
85+
"3.13"
8686
]
8787
},
8888
{
@@ -93,12 +93,11 @@
9393
"ExtraIndexURL": "https://download.pytorch.org/whl/cu121",
9494
"CUDA": "12.1",
9595
"Pythons": [
96+
"3.9",
9697
"3.10",
9798
"3.11",
9899
"3.12",
99-
"3.13",
100-
"3.9",
101-
"3.10"
100+
"3.13"
102101
]
103102
},
104103
{
@@ -109,11 +108,11 @@
109108
"ExtraIndexURL": "https://download.pytorch.org/whl/cu124",
110109
"CUDA": "12.4",
111110
"Pythons": [
111+
"3.9",
112112
"3.10",
113113
"3.11",
114114
"3.12",
115-
"3.13",
116-
"3.9"
115+
"3.13"
117116
]
118117
},
119118
{

pkg/dockerfile/base_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestBaseImageConfigurationExists(t *testing.T) {
5555
}
5656

5757
func TestBaseImageConfigurationExistsNoTorch(t *testing.T) {
58-
exists, _, _, _ := BaseImageConfigurationExists("", "3.12", "")
58+
exists, _, _, _ := BaseImageConfigurationExists("", "3.13", "")
5959
require.True(t, exists)
6060
}
6161

pkg/dockerfile/standard_generator_test.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func TestGenerateEmptyCPU(t *testing.T) {
8787
conf, err := config.FromYAML([]byte(`
8888
build:
8989
gpu: false
90+
python_version: "3.12"
9091
predict: predict.py:Predictor
9192
`))
9293
require.NoError(t, err)
@@ -121,6 +122,7 @@ func TestGenerateEmptyGPU(t *testing.T) {
121122
conf, err := config.FromYAML([]byte(`
122123
build:
123124
gpu: true
125+
python_version: "3.12"
124126
predict: predict.py:Predictor
125127
`))
126128
require.NoError(t, err)
@@ -155,6 +157,7 @@ func TestGenerateFullCPU(t *testing.T) {
155157
conf, err := config.FromYAML([]byte(`
156158
build:
157159
gpu: false
160+
python_version: "3.12"
158161
system_packages:
159162
- ffmpeg
160163
- cowsay
@@ -209,6 +212,7 @@ func TestGenerateFullGPU(t *testing.T) {
209212
conf, err := config.FromYAML([]byte(`
210213
build:
211214
gpu: true
215+
python_version: "3.12"
212216
system_packages:
213217
- ffmpeg
214218
- cowsay
@@ -264,6 +268,7 @@ func TestPreInstall(t *testing.T) {
264268

265269
conf, err := config.FromYAML([]byte(`
266270
build:
271+
python_version: "3.12"
267272
system_packages:
268273
- cowsay
269274
pre_install:
@@ -303,6 +308,7 @@ func TestPythonRequirements(t *testing.T) {
303308
require.NoError(t, err)
304309
conf, err := config.FromYAML([]byte(`
305310
build:
311+
python_version: "3.12"
306312
python_requirements: "my-requirements.txt"
307313
`))
308314
require.NoError(t, err)
@@ -349,6 +355,7 @@ func TestGenerateWithLargeModels(t *testing.T) {
349355
conf, err := config.FromYAML([]byte(`
350356
build:
351357
gpu: true
358+
python_version: "3.12"
352359
system_packages:
353360
- ffmpeg
354361
- cowsay
@@ -454,6 +461,7 @@ func TestGenerateDockerfileWithoutSeparateWeights(t *testing.T) {
454461
conf, err := config.FromYAML([]byte(`
455462
build:
456463
gpu: false
464+
python_version: "3.12"
457465
predict: predict.py:Predictor
458466
`))
459467
require.NoError(t, err)
@@ -487,6 +495,7 @@ func TestGenerateEmptyCPUWithCogBaseImage(t *testing.T) {
487495
conf, err := config.FromYAML([]byte(`
488496
build:
489497
gpu: false
498+
python_version: "3.12"
490499
predict: predict.py:Predictor
491500
`))
492501
require.NoError(t, err)
@@ -516,10 +525,10 @@ func TestGeneratePythonCPUWithCogBaseImage(t *testing.T) {
516525
conf, err := config.FromYAML([]byte(`
517526
build:
518527
gpu: false
528+
python_version: "3.12"
519529
system_packages:
520530
- ffmpeg
521531
- cowsay
522-
python_version: "3.12"
523532
python_packages:
524533
- pandas==1.2.0.12
525534
run:
@@ -624,6 +633,7 @@ func TestGenerateTorchWithStrippedModifiedVersion(t *testing.T) {
624633
build:
625634
gpu: true
626635
cuda: "11.8"
636+
python_version: "3.12"
627637
system_packages:
628638
- ffmpeg
629639
- cowsay
@@ -675,6 +685,7 @@ func TestGenerateWithStrip(t *testing.T) {
675685
build:
676686
gpu: true
677687
cuda: "11.8"
688+
python_version: "3.12"
678689
system_packages:
679690
- ffmpeg
680691
- cowsay
@@ -727,6 +738,7 @@ func TestGenerateDoesNotContainDangerousCFlags(t *testing.T) {
727738
build:
728739
gpu: true
729740
cuda: "11.8"
741+
python_version: "3.12"
730742
system_packages:
731743
- ffmpeg
732744
- cowsay
@@ -758,6 +770,7 @@ func TestGenerateWithPrecompile(t *testing.T) {
758770
build:
759771
gpu: true
760772
cuda: "11.8"
773+
python_version: "3.12"
761774
system_packages:
762775
- ffmpeg
763776
- cowsay

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ classifiers = [
1616
"Programming Language :: Python :: 3.10",
1717
"Programming Language :: Python :: 3.11",
1818
"Programming Language :: Python :: 3.12",
19+
"Programming Language :: Python :: 3.13",
1920
]
2021
requires-python = ">=3.8"
2122

tools/compatgen/internal/torch.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func parseTorchInstallString(s string, defaultVersions map[string]string, cuda *
209209
torchaudio := libVersions["torchaudio"]
210210

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

214214
return &config.TorchCompatibility{
215215
Torch: torch,

tox.ini

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ commands =
3232
tests: pytest python/tests --cov={env_site_packages_dir}/cog --cov-report term-missing:skip-covered {posargs:-n auto -vv}
3333

3434
[testenv:lint]
35-
base_python = python3.12
35+
base_python = python3.13
3636
skip_install = true
3737
deps = ruff
3838
commands =
3939
ruff check python/cog
4040
ruff format --check python
4141

4242
[testenv:typecheck-pydantic1]
43-
base_python = python3.12
43+
base_python = python3.13
4444
deps =
4545
pyright==1.1.375
4646
pydantic>=1,<2
@@ -54,14 +54,14 @@ allowlist_externals =
5454
sed
5555

5656
[testenv:typecheck-pydantic2]
57-
base_python = python3.12
57+
base_python = python3.13
5858
deps =
5959
pyright==1.1.375
6060
pydantic>=2,<3
6161
commands = pyright {posargs}
6262

6363
[testenv:integration]
64-
base_python = python3.12
64+
base_python = python3.13
6565
changedir = test-integration
6666
skip_install = true
6767
deps =

0 commit comments

Comments
 (0)