Hello, Has anyone encountered discrepancy in outp...
# general
f
Hello, Has anyone encountered discrepancy in output when running
flake8
on its own and comparing it with
./pants lint ::
? For example, when I run
flake8
, I get:
Copy code
file1.py:17:21: ANN201 Missing return type annotation for public function
file2.py:10:32: ANN201 Missing return type annotation for public function
However, when I run
./pants lint ::
, I get:
Copy code
11:38:23.22 [INFO] Completed: Lint with Flake8 - flake8 succeeded.
...
✓ flake8 succeeded.
Is there a way to get more verbose output of
./pants lint ::
? So as to see what files are linted, what flake8 config, etc.
1
f
You can run Pants in debug log mode:
-ldebug
You can also set whatever options flake8 has for additional logging in a
.flake8
config file.
b
Seems like
flake8
in Pants is either: • Missing the plugin(s) which report that code. Have you added the plugin to https://www.pantsbuild.org/docs/reference-flake8#section-extra-requirements? • Missing the relevant config file(s) which enable the code
My money is on 1
3
h
Yeah, that's a good hunch Josh. That error code is not coming from core flake8
f
@bitter-ability-32190 it’s most likely 1, since we use a bunch of flake8 plugins. Those plugins are defined in pyproject.toml for poetry. Any way to bridge the two without specifying plugins in two places (i.e., pants.toml and pyproject.toml)
b
(FWIW I find it surprising the default lockfile is provided for you. And worse, it has more than just` flake8` in it 😐)
h
it shouldn't @bitter-ability-32190. only this
Copy code
default_version = "flake8>=3.9.2,<4.0"
Pants uses its own internal flake8 lockfile
b
@full-student-91825 it depends on your setup. If you hand the keys solely over to Pants, then you only need to define them in Pants' ecosystem. If you're trying to straddle both Pants and Poetry I think you're SoL. Others might know more about straddling the two though
h
Any way to bridge the two without specifying plugins in two places (i.e., pants.toml and pyproject.toml)
Generally, you can use the poetry_requirements target generator to bridge the gap. Unfortunately, that is not yet integrated with tools https://github.com/pantsbuild/pants/issues/12449
👍 1
b
@hundreds-father-404 re: lockfile: oh that's nuanced. I dind't realize that
h
Which comment are you replying to?
b
(but now I understand the "synthetic lockfile". Also sorry Batyr for side convo)
f
@bitter-ability-32190 np, i am learning too 😄
❤️ 1
thanks a lot! will dig in further.
❤️ 1
h
fyi I commented onhttps://github.com/pantsbuild/pants/issues/12449 with your use case No pressure at all, but if you are interested, it is marked "good first issue". It would allow you to solve this problem without duplicating the requirement strings. We would be super happy to help you implement it, this is a very requested feature
👍 1
f
@hundreds-father-404 sounds good, you can assign it to me (gh handle: oneturkmen) and I can take a look at it this weekend 🙂 (can’t comment on the issue atm due to work laptop)
h
Hm @full-student-91825 I've spent 20 minutes writing instructions and I'm realizing at least the pre-work is a little bit more involved than I expected. Would you be interested in if I do the pre-work, and then write instructions for how to finish out the change?
👍 1
f
@hundreds-father-404 sounds good, though I might not get to the task until next week 😕
👍 1
h
fyi https://github.com/pantsbuild/pants/pull/15186. i still need to update the rest of the call sites
@full-student-91825 https://github.com/pantsbuild/pants/pull/15186 is the first of two prework PRs I plan to do. Feel free to leave a review! It would probably be helpful for you to glance at it to start understanding the problem space