https://pantsbuild.org/ logo
#general
Title
# general
p

polite-garden-50641

11/23/2022, 9:14 PM
so I tried to upgrade and failed. flake8 6.0.0 supports python 3.8 and above (https://github.com/PyCQA/flake8/blob/b9a7794c4f425ef8419081e6993f99419cc667ea/setup.cfg#L41) pants tries to use it under 3.7 (when calling generate-lockfiles) and fails (this is expected). But unlike other tools (like black) flake 8 doesn't have an
interpreter_constraints
options .... any advice ?
b

busy-vase-39202

11/23/2022, 9:17 PM
Would it be inappropriate to open an issue asking flake8 to support
interpreter_constraints
...?
p

polite-garden-50641

11/23/2022, 9:24 PM
it is less typing to fix the issue: https://github.com/pantsbuild/pants/pull/17628
r

rhythmic-morning-87313

02/17/2023, 7:21 AM
Hm... I'm still having this issue because my codebase is Python 3.11 and using the pattern matching syntax, but the exported flake8 virtualenv is based on 3.9 because some parts of my source codes (the pants plugins...) are marked to use 3.9.
When running
./pants lint ::
, pants automatically calculates the resolve partitions and uses the appropriate python versions for each partition (3.9 / 3.11). This is good. But when exporting the flake8 tool, the exported venv is a single one based on 3.9 only.
So my IDEs/editors are complaining about the pattern matching syntax because flake8 on 3.9 marks them as syntax errors, while the majority of codebase is for 3.11.
What I want is either: • choose a specific "target" resolve partition when exporting a Python tool as venv • use the most recent interpreter version when exporting a Python tool as venv • have multiple venv exports for a single Python tool for each resolve partition
6 Views