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

bitter-ability-32190

11/10/2021, 9:33 PM
Last set of
pylint
differences: I'm seeing
./pants lint
and
pylint
(in my
ve
) disagree.
pylint
in ve is fine,
./pants
says
[E1101(no-member), AClass.delete] Instance of 'scoped_session' has no 'commit' member
The code in question is essentially:
Copy code
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()
...
db.session.commit()
I've set my
pants.toml
to match the
ve
's deps (I think it's a representative set)
Copy code
[pylint]
version = "pylint==2.6.0"
lockfile = "3rdparty/pylint_lockfile.txt"
extra_requirements.add = [
    "astroid==2.4.2",
    "flask==1.1.2",
    "flask-sqlalchemy==2.4.4",
    "mccabe==0.6.1",
    "pylint-flask-sqlalchemy==0.2.0",
]
h

hundreds-father-404

11/10/2021, 9:34 PM
are you using a pylint config file perhaps?
b

bitter-ability-32190

11/10/2021, 9:35 PM
👀 I am
It contains:
load-plugins=pylint_flask_sqlalchemy
h

hundreds-father-404

11/10/2021, 9:36 PM
Would be good to double check it's being picked up by Pants's config discovery. Can run with
--no-process-execution-local-cleanup
and inspect the chroot to make sure the config file is there
b

bitter-ability-32190

11/10/2021, 9:36 PM
Y'all need a short option name 😂
1
💯 1
🙈 1
h

hundreds-father-404

11/10/2021, 9:37 PM
I've proposed
--no-local-cleanup
in the past
🙌 1
b

bitter-ability-32190

11/10/2021, 9:39 PM
--leak-chroot
💯 1
pylintrc
is there
👍 1
The plugin is installed in
pylint.pex
h

hundreds-father-404

11/10/2021, 9:44 PM
and the versions in your lockfile == your non-Pants install? could maybe try creating a venv using
pip -r lockfile.txt
and see if you can get Pylint passing that way still
👀 1
b

bitter-ability-32190

11/10/2021, 9:44 PM
Oddly I don't see
flask-sqlachemy
in
requirements.pex
(but I DO see it in
pylint.pex
) 🤔
h

hundreds-father-404

11/10/2021, 9:44 PM
oh hm
pip -r lockfile.txt
wouldn't include your third-party requirements tho
b

bitter-ability-32190

11/10/2021, 9:45 PM
I mean, it should have enough to look for this one specific error though. Worth a shot
h

hundreds-father-404

11/10/2021, 9:45 PM
Oddly I don't see flask-sqlachemy in requirements.pex
Probably shouldn't matter. We use a PEX feature to merge
requirements.pex
and
pylint.pex
into a single
pylint_runner.pex
b

bitter-ability-32190

11/10/2021, 9:47 PM
Makes sense
So running with just the
pylint
lockfile I see the error. We're probably on to something
👍 1
Oh crazy, it was the version of
sqlalchemy
in the
pylint
reqs. I pinned it to the `ve`'s (must've missed this) and now it works
1
So, my mistake. Sorry for the noise. But now
pylint
is clean on our monorepo. One step closer to adoption
🚀 1
h

hundreds-father-404

11/10/2021, 10:11 PM
That's okay, glad you were able to figure this out! This also feels rewarding that we added tool lockfiles to Pants 2.7 so that hopefully issues like this don't creep in over time, where your build breaks over night 🙂
One step closer to adoption
Yay! Although I'll point out that you already have adopted Pants! Pants is meant to be useful even if you're only using it for things like installing and running your linters/formatters. It's not all-or-nothing
💯 1
b

bitter-ability-32190

11/10/2021, 10:15 PM
Well I'm just getting everything set up for adoption at the company I work at 🙂
true adoption
Oh and yay for tool lockfiles too. Eventually the versions won't need to be so exact of every dep, and the lockfile can take over on it's own
5 Views