From 61a2ec1a9c7848c5fec5e4b86d6c289ef16f25bf Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 28 Mar 2026 15:28:39 +0100 Subject: support Python >= 3.13 --- .dockerignore | 1 + .github/workflows/ci.yml | 6 ++++-- Dockerfile | 3 ++- Makefile | 42 ++++++++++++++++++------------------------ requirements.txt | 2 ++ 5 files changed, 27 insertions(+), 27 deletions(-) create mode 100644 requirements.txt diff --git a/.dockerignore b/.dockerignore index cb61aa2..069ef0d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,5 @@ !app.py !index.html +!requirements.txt !server.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6495393..d21b61a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,8 +8,7 @@ jobs: test: strategy: matrix: - # The cgi module was removed in 3.13. - python-version: ['3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] runs-on: ubuntu-latest name: 'Python ${{ matrix.python-version }}' steps: @@ -19,6 +18,9 @@ jobs: uses: actions/setup-python@v6 with: python-version: '${{ matrix.python-version }}' + cache: pip + - name: Install dependencies + run: pip install -q -r requirements.txt - name: Run tests run: make test diff --git a/Dockerfile b/Dockerfile index dcfd587..515d205 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ -# The cgi module was removed in 3.13. FROM python:3.12-alpine RUN mkdir -p /var/lib/void @@ -6,6 +5,8 @@ RUN mkdir -p /var/lib/void COPY [".", "/usr/src/"] WORKDIR /usr/src +RUN pip install -q -r requirements.txt + # I don't know why, but in Docker, simple print() statements show nothing: # https://stackoverflow.com/q/29663459 # Fixed by adding the -u flag: diff --git a/Makefile b/Makefile index e710702..6fa09b6 100644 --- a/Makefile +++ b/Makefile @@ -3,43 +3,37 @@ include prelude.mk PORT ?= 23666 $(eval $(call noexpand,PORT)) -URL := http://localhost:$(PORT)/ -STATE := ./void.state +url := http://localhost:$(PORT)/ +state := ./void.state + +venv_dir := .venv +venv_activate := . '$(call escape,$(venv_dir)/bin/activate)' .PHONY: all all: serve +.PHONY: venv/reset +venv/reset: + rm -rf -- '$(call escape,$(venv_dir))' + mkdir -p -- '$(call escape,$(venv_dir))' + python -m venv -- '$(call escape,$(venv_dir))' + +.PHONY: venv +venv: venv/reset + $(venv_activate) && pip install -q -r requirements.txt + .PHONY: serve serve: - ./server.py --port '$(call escape,$(PORT))' --void '$(call escape,$(STATE))' + $(venv_activate) && ./server.py --port '$(call escape,$(PORT))' --void '$(call escape,$(state))' .PHONY: clean clean: - rm -f -- '$(call escape,$(STATE))' + rm -f -- '$(call escape,$(state))' .PHONY: view view: - xdg-open '$(call escape,$(URL))' &> /dev/null + xdg-open '$(call escape,$(url))' &> /dev/null .PHONY: test test: ./test/test.sh - -.PHONY: build -build: docker/build - -.PHONY: docker/build -docker/build: - docker compose build --progress plain --pull - -.PHONY: docker/serve -docker/serve: build/docker - docker compose up - -.PHONY: deploy -deploy: docker/build - docker compose up -d - -.PHONY: undeploy -undeploy: - docker compose down --rmi all --volumes diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..38fbfd8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +# The cgi module was removed in 3.13. +legacy-cgi; python_version >= '3.13' -- cgit v1.3