Skip to content

Commit

Permalink
feat: deprecate python 3.7 (#1550)
Browse files Browse the repository at this point in the history
Ref: #1431

Signed-off-by: Dmitri Khokhlov <dkhokhlov@gmail.com>
  • Loading branch information
dkhokhlov committed Feb 26, 2024
1 parent ecabcbd commit 46d0eb3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
defaults:
run:
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ lint-go:
lint-python:
$(RUFF) python/cog
$(RUFF) format --check python
@$(PYTHON) -c 'import sys; sys.exit("Warning: python >=3.10 is needed (not installed) to pass linting (pyright)") if sys.version_info < (3, 10) else None'
$(PYRIGHT)

.PHONY: lint
Expand All @@ -106,7 +107,6 @@ mod-tidy:

.PHONY: install-python # install dev dependencies
install-python:
$(PYTHON) -c 'import sys; exit(0) if sys.version_info >= (3, 10) else print("\n\nWarning: python >=3.10 is needed (not installed) to pass linting (pyright)\n\n")'
$(PYTHON) -m pip install '.[dev]'


Expand Down
2 changes: 1 addition & 1 deletion docs/yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ build:
python_version: "3.11.1"
```

Cog supports all active branches of Python: 3.8, 3.9, 3.10, 3.11.
Cog supports all active branches of Python: 3.8, 3.9, 3.10, 3.11, 3.12.

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
5 changes: 5 additions & 0 deletions test-integration/test_integration/fixtures/python_37/cog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build:
gpu: false
python_version: "3.7"

predict: "predict.py:Predictor"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from cog import BasePredictor


class Predictor(BasePredictor):
def predict(self, num: int) -> int:
return num * 2
12 changes: 12 additions & 0 deletions test-integration/test_integration/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,15 @@ def test_build_with_cog_init_templates(tmpdir, docker_image):

assert build_process.returncode == 0
assert "Image built as cog-" in build_process.stderr.decode()


def test_python_37_depricated(docker_image):
def test_build_invalid_schema(docker_image):
project_dir = Path(__file__).parent / "fixtures/python_37"
build_process = subprocess.run(
["cog", "build", "-t", docker_image],
cwd=project_dir,
capture_output=True,
)
assert build_process.returncode > 0
assert "ERROR: Package 'cog' requires a different Python" in build_process.stderr.decode()

0 comments on commit 46d0eb3

Please sign in to comment.