https://pantsbuild.org/ logo
#development
Title
# development
w

wonderful-iron-54019

06/25/2020, 4:08 PM
[Extra requirements for linting thread]
we have dependencies that are 'dropped in'. to our code post deployment. Airflow and pyspark being the two primary ones
we install them as dev-dependencies in our run environment so that the linter recognizes them
but ddont want to specify them as dependencies for the target. tried specifying them as 
extra_requirements
 but that led to some resolution errors, and im not sure that's the intention. of that config property
h

hundreds-father-404

06/25/2020, 4:10 PM
What’s the error? It’s designed to allow you to add Pylint plugins, but you can use it for this same reason too. The result is that the pex to run Pylint will have the requirements
Also how come you don’t want the targets to include the deps?
w

wonderful-iron-54019

06/25/2020, 4:21 PM
because they are installed on the deployed hardware
we load libraries intto a distributed runtime that includes these dependencies already
Copy code
Failed to resolve compatible distributions:
1: astroid==2.4.2 requires lazy-object-proxy==1.4.* but lazy-object-proxy 1.5.0 was resolved
2: Flask-AppBuilder==1.13.1 requires marshmallow<2.20,>=2.18.0 but marshmallow 3.6.1 was resolved
which is odd to me b/c our lockfile exhibits no issus
h

hundreds-father-404

06/25/2020, 5:20 PM
astroid
is a requirement of Pylint. Does
astroid
show up in your
requirements.txt
or
lockfile
already?
w

wonderful-iron-54019

06/25/2020, 5:20 PM
yes
h

hundreds-father-404

06/25/2020, 5:22 PM
Okay, hm, I suspect the conflict is between Pylint’s reqs vs. what you pinned
we load libraries intto a distributed runtime that includes these dependencies already
I’m not quite sure what you mean. These dependencies are already installed into the environment globally and you want to use those? If that’s the case, both
dependencies
and
--pylint-extra-requirements
wouldn’t help because they would re-install the deps from scratch from PyPI. How are you doing this with v1 currently?
w

wonderful-iron-54019

06/25/2020, 5:23 PM
we have a virtualenv managed with
pipenv
(another enhancement i'd like to work on for pants) and run
pylint src
that lints everything at once, but it has these dev-dependencies installed in. the env for linting purposes
Okay, hm, I suspect the conflict is between Pylint’s reqs vs. what you pinned
I'm using the same versions of everything in my lock file as in my pants.toml so i suspect its a difference b/w the pipenv and pex resolver
h

hundreds-father-404

06/30/2020, 9:33 PM
Is this still an issue? Also, I realized that Pants isn’t loading 3rd party requirements when running Pylint..which means you would be getting lots of
E0401: Unable to import 'foo' (import-error)
Has this been an issue for you?
w

wonderful-iron-54019

07/01/2020, 3:34 PM
@hundreds-father-404 ah just saw this. dropped this work for time, but will circle back to it, yes we have. seen several. of these errors
i. assumed it had to do with. the
dev-dependencies
imports described above. since they were present in several places but yeah this would be a. larger issue for sure
h

hundreds-father-404

07/01/2020, 4:24 PM
Okay, yeah I reproduced it yesterday. Will try to fix today, although I’m bummed that this means performance will be slower because now we have to resolve requirements :/ How important is that part of Pylint to you all of checking that every import is actually valid? I’m wondering if it would be worth the trouble to add a flag so that people can ignore requirements and they would disable that lint in Pylint.
Also, would it help you with the migration from 1.30 to 2.0 if we cherry-picked the fix to 1.30? The two branches have diverged a bit, but if it’s helpful, I can make it work. I’m not sure if you’ll want to have 1.30 Pylint fully working before 2.0, or if it’s fine to wait until 2.0
w

wonderful-iron-54019

07/02/2020, 1:06 PM
sorry eric just saw this again
given that python is interpreted and not. compiled, it will be very handy at catching the class of error where we forget to add a dependency to our targets
a flag makes perfect sense to me if that's preferable than having it always on
i. don't think there's a huge need for cherry picking
we can continue to lint outside of pants until we get to 2.0