purpose of add_init_py?

50 views
Skip to first unread message

Jeff Olsen

unread,
Jul 27, 2018, 6:04:35 PM7/27/18
to please-build
I am running into a problem using scipy with please.  The .so files are not found because please is adding __init__.py files in the pex file.

Example:

example.py
----
from scipy import stats
----

BUILD

---
pip_library(
    name = 'scipy',
    version = '1.1.0',
    deps = [":numpy"],
    zip_safe = False,
)

pip_library(
    name = 'numpy',
    version = '1.15.0',
    zip_safe = False,
)

python_binary(
    name = 'example',
    main = 'example.py',
    deps = [":scipy"],
)
---

plz run :example

ERROR

if you remove all the __init__.py that please adds inside of scipy, it works fine

Is the purpose just so you do not have to put __init__.py in your normal source directories?

If so, I will add a flag to python_binary to not add the __init__.py when building.

-Jeff

Peter Ebden

unread,
Jul 31, 2018, 5:07:38 AM7/31/18
to please-build
Yup, that is exactly why it is there. There might be a few specific cases for third-party libraries as well.

I suppose we can have the flag, although I'm a bit curious why it affects scipy in that way. I'd have expected adding those files was pretty safe...
Reply all
Reply to author
Forward
0 new messages