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

jolly-midnight-72759

10/17/2020, 2:43 AM
Using v2.0.0.rc1, I was trying to build a package for the first time and received the below source roots error. Is this a bug or an issue with my config?
I ran
./pants package acme/src/python/jupyter_stubber:jupyter-stubber-py3-dist
to get this output.
Our
pants.toml
has the following in `[source]`:
Copy code
root_patterns = [
  "src/python",
  "test/python",
  "tests/python",
...
]
h

hundreds-father-404

10/17/2020, 6:06 AM
I wouldn’t expect you to have an init there. Your first init should be at acme/src/python, and nothing above it
That is, you want
acme/src/python/__init__.py
and
acme/src/python/jupyter_stubber/__init__.py
, but not
acme/src/__init__.py
or anything above it The reason this is breaking with 2.0 is that Pants now always includes all ancestor
__init__.py
files, which is really important for how Python modules work. Before, Pants would only include what you explicitly included with
dependencies
, and then it would automagically create missing ones. The end result is that
acme/__init__.py
was ignored before, but now it’s being used
e

enough-analyst-54434

10/17/2020, 6:51 AM
What Eric said, but you actually only want
acme/src/python/jupyter_stubber/__init__.py
👍 1
j

jolly-midnight-72759

10/17/2020, 11:50 AM
Oh boy. I think we have a few of these. Thank you.
2 Views