Skip to content

Consider matching the Python version used by ehrQL rather than by python:v2 #105

@evansd

Description

@evansd

As things stand at the time of writing, this means installing Python 3.13 rather than 3.10:

# Install python 3.10. This is the version used by the python-docker
# image, used for analyses using the OpenSAFELY pipeline.
--no-install-recommends curl python3.10 python3.10-distutils python3.10-venv \

Given that different images use different versions of Python (ehrql, python:v1, python:v2, python:v3 when it comes etc.) there's no single, obviously correct version to install. But I think it makes sense to prioritise matching the version used by ehrQL for a few reasons:

  1. The main impact of the installed version is to change the error checking and autocomplete behaviour of VS Code. Actually running the code should always be handled by the appropriate Docker container.
  2. Everyone has to write ehrQL but only a much smaller subset of our users choose to use Python for their analysis code.
  3. ehrQL is complex and unfamiliar whereas users who choose to use Python will, by definition, be more familiar with their own code, so autocomplete is much more valuable for ehrQL.
  4. Python's backwards compatibility means that correctly parsing and error checking files intended for an older version is mostly unproblematic.

There's no immediate rush here: autocomplete for ehrQL currently works perfectly well in Codespaces despite the version mismatch. But there remains the risk of drift further down the line and, if autocomplete did break in Codespaces we might not immediately realise it because the tests are all in the ehrQL repository.

If we did do this then it would probably also make sense to have a daily scheduled action which checks that the Python version used here matches the one used by ehrQL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions