Skip to content

Update minimum python version (3.9) in pyproject.toml and docs - #740

Closed
hikinggrass wants to merge 2 commits into
mobilityhouse:masterfrom
hikinggrass:bugfix/fix-minimum-python-version
Closed

hikinggrass wants to merge 2 commits into
mobilityhouse:masterfrom
hikinggrass:bugfix/fix-minimum-python-version

Conversation

@hikinggrass

Copy link
Copy Markdown
Contributor

Changes included in this PR

  • Update minimum python version (3.9) in pyproject.toml and docs

Current behavior

  • The docs state that a minimum of python 3.7 is supported
  • The classifiers in pyproject.toml state that a minimum of python 3.8 is supported
  • The tool.poetry.dependencies requires python 3.11
  • This results in the latest release (2.1.0) on pypi not being listed in pip index versions ocpp and not being available to install (by default) ob Ubuntu 22.04, which ships python 3.10

New behavior

  • A consistent minimum python version of 3.9 is used (lower than that did not work without further changes)

Impact

  • Installing is possible again on older python versions

Checklist

  1. Does your submission pass the existing tests?
  2. Are there new tests that cover these additions/changes?
  3. Have you linted your code locally before submission?

Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
@hikinggrass

Copy link
Copy Markdown
Contributor Author

I just saw the commit that added sphinx 8.x as a dependency mentioning python 3.11 as a minimum for development going forward. Then this should probably just be reflected in the docs. Looks like the CI Tests for 3.8 etc. currently also use 3.12 (eg https://github.com/mobilityhouse/ocpp/actions/runs/16022303628/job/45201948389 ) maybe that's why this wasn't detected yet

@mdwcrft

mdwcrft commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

@hikinggrass thanks for this can you run poetry lock + commit the updated lockfile to get the ci tests to pass?

mdwcrft added a commit that referenced this pull request Oct 2, 2026
…from tests (#768)

### The problem

The CI matrix has not been testing the Python versions it claims to. The
`setup-python-build-env` composite action installs Poetry via `pipx`,
and Poetry then builds the project virtualenv from **pipx's own
interpreter**, not the one selected by `actions/setup-python`. Every
matrix job — including the "3.8" one — has actually been running against
the runner's default Python (3.12). This was spotted by @hikinggrass in
the #740 discussion, with a job run demonstrating it:
https://github.com/mobilityhouse/ocpp/actions/runs/16022303628/job/45201948389

Practical consequence: the matrix has never genuinely verified support
below 3.11, which is how the classifier/`requires_python` drift shipped
in 2.1.0 without any red CI.

### The fix

**`.github/workflows/pull-request.yml`**
- After `setup-python`, run `poetry env use "$(which python)"` so the
project venv is built from the matrix interpreter
- Add a **verification step** that asserts `sys.version_info` inside the
venv matches `matrix.version` — the matrix can no longer silently lie;
if the binding ever regresses, the job fails loudly
- Trim the matrix to `3.11 / 3.12 / 3.13` — the range `pyproject.toml`
actually declares (`^3.11`). The 3.8–3.10 jobs are removed rather than
fixed because, once honest, they *cannot* pass today (`poetry install`
refuses interpreters outside the project's range). They return in the
follow-up to #740 when the floor is genuinely lowered.
- Split lint out of the matrix: a single `lint` job on 3.13 runs
black/isort/flake8; matrix jobs run only the test suite. Lint results
don't vary by interpreter, and this also unblocks the #740 follow-up
where lint tools (black 26 ≥3.10, sphinx ≥3.11) won't be installed on
older-Python jobs.

**`Makefile`**
- `tests` split into `lint` and `unit-tests` targets; `make tests` runs
both, so local usage is unchanged

**`.github/workflows/publish-to-pypi.yml`**
- Pinned interpreter bumped 3.10 → 3.13 — it was *below* the package's
own `^3.11` floor and only worked via the same pipx accident — and
Poetry is bound with `poetry env use` the same way

### Verification

- `make tests` (lint + 181 tests) passes locally through the new targets
- The interpreter assertion one-liner validated standalone
- This PR's own CI run exercises the new workflow

### Sequencing

This is deliberately infrastructure-only — no `pyproject.toml` changes.
It merges first so the matrix is trustworthy *before* the Python-floor
change: the follow-up to #740 (lower floor to `^3.9`, lockfile regen,
dev-dependency markers) will extend the matrix to 3.9/3.10, and its
green checks will then actually mean the suite runs on those
interpreters.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mdwcrft

mdwcrft commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

#768 has fixed the CI bug and #782 is raising the minimum to 3.11 so this can be closed

@mdwcrft mdwcrft closed this Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants