Skip to content

Commit fc5ebad

Browse files
committed
build: specify python version
1 parent 9fde468 commit fc5ebad

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ coverage/
2727
venv/
2828
/pyvenv.cfg
2929
/pip-selfcheck.json
30-
.python-version
3130

3231
# Node
3332
node_modules/

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11.6

Makefile

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ VIRTUAL_ENV ?= venv
22
NODE_BIN = node_modules/.bin
33
SOURCE_DIRS = adhocracy-plus apps tests
44
ARGUMENTS=$(filter-out $(firstword $(MAKECMDGOALS)), $(MAKECMDGOALS))
5+
PYTHON_MIN_VERSION = 3.11
6+
PYTHON_MAX_VERSION = 3.13
57

68
# for mac os gsed is needed (brew install gnu-sed and brew install gsed)
79
SED = sed
@@ -57,9 +59,16 @@ help:
5759

5860
.PHONY: install
5961
install:
62+
if [ ! -f $(VIRTUAL_ENV)/bin/python3 ]; then python3 -m venv $(VIRTUAL_ENV); fi
63+
@python_version=`$(VIRTUAL_ENV)/bin/python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'`; \
64+
if echo "$$python_version" | awk -F. -v min="$(PYTHON_MIN_VERSION)" -v max="$(PYTHON_MAX_VERSION)" \
65+
'{ if ($$1 == 3 && $$2 >= min && $$2 < max) print "yes" }' | grep -q yes; then \
66+
echo "Python version $$python_version is compatible"; \
67+
else \
68+
echo "Warning: Python version $$python_version detected. This project requires Python >= $(PYTHON_MIN_VERSION) and < $(PYTHON_MAX_VERSION)"; \
69+
fi
6070
npm install --no-save
6171
npm run build
62-
if [ ! -f $(VIRTUAL_ENV)/bin/python3 ]; then python3 -m venv $(VIRTUAL_ENV); fi
6372
$(VIRTUAL_ENV)/bin/python -m pip install --upgrade -r requirements/dev.txt
6473
$(VIRTUAL_ENV)/bin/python manage.py migrate
6574

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ adhocracy+ is designed to make online participation easy and accessible to every
1414
### Requirements
1515

1616
* nodejs (+ npm)
17-
* python 3.x (+ venv + pip)
17+
* python>=3.11,<3.13
18+
* We recommend using pyenv or similar to run a supported python version.
19+
* The latest supported version is listed in `.python-version`, which pyenv will automatically follow.
1820
* libpq (only if postgres should be used)
1921
* sqlite3 [with JSON1 enabled](https://code.djangoproject.com/wiki/JSON1Extension)
2022
* redis (in production, not needed for development)

changelog/0001.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### Added
2+
3+
- Specify python version in new .python-version file, which pyenv ingests
4+
5+
### Changed
6+
7+
- README mentions supported python versions
8+
- `make install` will now output a warning if the dev user is running a non-supported python version

0 commit comments

Comments
 (0)