Determine and document the _minimum_ Python language version supported by FawltyDeps #460
Labels
needs-real-projects-test
This issue is more easily tackled once we have a project in `real_project` that illustrate the issue
P3
minor: not priorized
research-needed
type: documentation
Even though FawltyDeps now needs Python >=v3.8 to run (after #459 is merged), we pride ourselves on FawltyDeps being able to analyze projects that are stuck on older Python versions.
However, I don't think we've ever clearly stated what is the minimum Python version that we support analyzing. AFAICS these are the aspects of a project that is likely to determine what minimum version we support:
setup.py
files), we need to be able to parse the Python syntax used in the project being analyzed.Here are the bounds that I'm aware of:
requirements.txt
files and/orsetup.py
files was already established by the time the Python 2 -> 3 transition took place.virtualenv
tool, as the stdlibvenv
module was not added until Python 3.3).pip install ...
orpip install --user ...
outside any virtualenv).That leaves, I believe, Python syntax as the main determining factor for what minimum version we support. Since we use the
ast
module to parse Python code, this question essentially becomes: For a given version of theast
parser that FawltyDeps is running on, what is the oldest version of Python syntax that is supported by this parser?Here is what different versions of
ast.parse()
has to say about supported Python versions:v3.13:
v3.12
v3.11
(same as v3.12)
v3.10
v3.9
(same as v3.10)
v3.8
(same as v3.9)
(for completeness, the
feature_version
flag was added toast.parse()
in Python v3.8, so we would not have any way to control this if we kept support for running on Python v3.7)AFAICS, when the
feature_version
flag is not set, it defaults to the current version, i.e. the one FawltyDeps is running on. We're currently not setting this flag, which means that any older project that we attempt to analyize will fail if it uses syntax that is not forward-compatible to the version FawltyDeps is running on.FWIW, the
feature_version
flag toast.parse()
was added in Python v3.8, so I don't believe dropping support for running FD on Python v3.7 (see #459) has changed what older Python projects we might support.Taking a step back, I suspect this is not a huge problem in practice, as Python tries very hard not to break old code when new syntax is introduced. The biggest problem - I assume - is the introduction of new keywords (e.g.
async
,await
,match
) that might have been used as e.g. variable names in older code.Still, if we want to tackle this, we need a suite of tests with "old" Python source code samples that is incompatible with various "new" Python versions. We also need some way for projects to configure FawltyDeps as to which
feature_version
they need to use.In summary, I see three main ways we can approach this:
feature_version
toast.parse()
, and requires that FawltyDeps is running on a version that supports the given version number. That is, if your project is using Python version v3.4-v3.6, you must run FawltyDeps on Python <v3.13; if your project is using Python version <v3.4, you're out of luck.The text was updated successfully, but these errors were encountered: