Hi there, I'm trying to use the `flake8-requiremen...
# general
r
Hi there, I'm trying to use the
flake8-requirements
plugin. Since my
requirements.txt
is not in the project's root directory, I need to pass the
--requirements-file
option pointing to the requirements in
3rdparty/python
. So I added this to `[flake8].args`:
Copy code
[flake8]
args = [
   ...,
    "--requirements-file=3rdparty/python/requirements.txt",
]
However, the plugin doesn't seem to be able to read the text file. I suspect an issue with the sandbox. Any ideas?
b
I think you might find that Pants can/should just provide the same functionality for you. ā€¢
Package is not listed as a requirement.
-> https://www.pantsbuild.org/docs/reference-python-infer#unowned_dependency_behavior set to
error
ā€¢
Package is required but not used.
right now it's a manual step but I'd love to write a plugin for this. Today you can run
./pants dependees <requirement address>
and pipe through
wc -l
. You should see 1 dependee (the target generator) for dependencies which aren't used
r
Thx @bitter-ability-32190. In the meantime, is there anything I can do to make the plugin works? In the sandbox the requirements files are not present...
b
Because we batch your inputs I don't think you'll find much success even if you did get it working. The
flake8
run will only have a subset of your code, so I imagine you'd get
Package is required but not used.
in a fair number of runs šŸ˜ž
Essentially we run
flake8
on many subset of overall repo to make subsequent runs relatively speedy
r
I see. I'll ditch
flake8-requirements
for now, and wait for your plugin šŸ˜‰. Thanks for your quick response.
b
Defintely look into enabling the linked setting
r
Will do!
Works as expected :
UnownedDependencyError: Pants cannot infer owners for the following imports in the target ...
šŸ™Œ 2
b
That's exactly why I wrote this feature šŸ˜ø
FYI @hundreds-father-404 should we have a snippet in the docs regarding this plugin? I can try and whip up the plugin
h
hould we have a snippet in the docs regarding this plugin?
saying?
b
Basically my two points above. "it won't work, but that's ok because pants can do the same thing ..."
h