|
1 | | -# Default Python version if not specified |
2 | | -# This is expected to have the form X.Y. |
3 | | -# The corresponding requirements file is requirements-dev-pyXY.txt. |
4 | | -PYTHON_VERSION ?= 3.13 |
5 | | -PYTHON_VERSION_NO_DOTS = $(subst .,,$(PYTHON_VERSION)) |
| 1 | +# Detect Python version from the system |
| 2 | +PYTHON_VERSION := $(shell python3 -c 'import sys; print(f"{sys.version_info.major}{sys.version_info.minor}")') |
6 | 3 |
|
7 | 4 | # Generate requirements filename based on Python version |
8 | | -REQUIREMENTS_FILE = requirements-dev-py$(PYTHON_VERSION_NO_DOTS).txt |
9 | | - |
10 | | -# A quick one-liner to update all environments using pyenv: |
| 5 | +REQUIREMENTS_FILE = requirements-dev-py$(PYTHON_VERSION).txt |
| 6 | + |
| 7 | +# Testing workflow: |
| 8 | +# 1. GitHub Actions runs tests for each Python version (3.8-3.12) on multiple OSes |
| 9 | +# 2. For each Python version, tests run in two modes: |
| 10 | +# - 'latest': Uses dependencies directly from pyproject.toml |
| 11 | +# - 'frozen': Uses version-specific requirements-dev-pyXY.txt |
| 12 | +# 3. Each Python version gets its own virtual environment (.venvXY) |
| 13 | +# 4. Tests are only blocking in `frozen` mode. Tests run in `latest` mode are |
| 14 | +# allowed to fail and serve as a warning that there may have been a breaking |
| 15 | +# change in a dependency. |
| 16 | +# 5. To run tests locally: |
| 17 | +# - make dev test # uses frozen dependencies |
| 18 | +# - make dev-latest test # uses latest dependencies |
| 19 | +# |
| 20 | +# To update all Python versions using pyenv: |
11 | 21 | # for v in 3.8 3.9 3.10 3.11 3.12 3.13; do |
12 | 22 | # pyenv local $v |
13 | | -# make dev-env update-dev-dep-lockfile PYTHON_VERSION=$v |
| 23 | +# make dev-env update-dev-dep-lockfile |
14 | 24 | # done |
15 | 25 |
|
16 | 26 | dev-env: |
17 | | - python -m venv .venv$(PYTHON_VERSION_NO_DOTS) |
| 27 | + python -m venv .venv$(PYTHON_VERSION) |
18 | 28 | ifeq ($(OS), Windows_NT) |
19 | | - .venv$(PYTHON_VERSION_NO_DOTS)\Scripts\activate |
| 29 | + .venv$(PYTHON_VERSION)\Scripts\activate |
20 | 30 | else |
21 | | - . .venv$(PYTHON_VERSION_NO_DOTS)/bin/activate |
| 31 | + . .venv$(PYTHON_VERSION)/bin/activate |
22 | 32 | endif |
23 | 33 |
|
24 | 34 | dev: dev-env |
|
0 commit comments