https://pantsbuild.org/ logo
b

bitter-ability-32190

11/10/2021, 8:53 PM
I think I might be seeing an inference error:
Copy code
a/
├─ b/
│  ├─ c/
│  │  ├─ d/
│  │  │  ├─ __init__py
│  │  ├─ foo.py
Copy code
# foo.py
from a.b.c import d
Running
pylint
from inside
pants
gives:
E0611(no-name-in-module), ] No name 'd' in module 'a.b.c'
But running
pylint
on the file doesn't have the issue. Setting
[python-infer].inits=true
doesn't seem to alleviate the issue
Additionally
./pants peek a/b/c/foo.py
doesn't show
d
as a dependency.
h

hundreds-father-404

11/10/2021, 8:54 PM
what are the contents of
d/__init__.py
?
b

bitter-ability-32190

11/10/2021, 8:55 PM
non-empty.
Copy code
from typing import Any, Callable


def apply(f: Callable, *args: Any, **kwargs: Any) -> Any:
  return f(*args, **kwargs)
h

hundreds-father-404

11/10/2021, 8:56 PM
is there more to the pylint error? Something is trying to import
a.b.c.d
?
b

bitter-ability-32190

11/10/2021, 8:57 PM
Yeah,
foo.py
is
👍 1
h

hundreds-father-404

11/10/2021, 8:57 PM
to double check, you have a BUILD file in
a/b/c/d
?
🙌 1
b

bitter-ability-32190

11/10/2021, 8:58 PM
Oh my...
oh oops
I suppose
tailor
isn't
__init__.py
-aware?
Or does it refer to
[python-infer].inits
? (In which case I ran
tailor
with it off initially)
h

hundreds-father-404

11/10/2021, 9:00 PM
it is, we have a bad default it looks like for
[python].ignore_solitary_init_files
..
👀 1
you can set that to
= false
under
[python]
(if on Pants 2.8) would you be willing to open a bug report please? that's super confusing this happpened
the option was an attempt to reduce BUILD file boilerplate. People were wondering why we are generating BUILD files in directories with only a single blank
__init__.py
It should probably instead detect if the
__init__.py
is empty or not
b

bitter-ability-32190

11/10/2021, 9:02 PM
Ahh you beat me to it!
Was going to suggest that
1
h

hundreds-father-404

11/10/2021, 9:54 PM
In the meantime to fixing this, I updatd the docs Edit: and it got deleted...let's try again https://www.pantsbuild.org/v2.8/docs/python-backend
b

bitter-ability-32190

11/10/2021, 10:00 PM
There's a typo (or "piritually" is a word I don't know about) 😂
😂 1
b

busy-vase-39202

11/10/2021, 10:11 PM
I kinda need that word to exist now.
6 Views