Hi :wave: , I’m currently working for a small star...
# welcome
f
Hi 👋 , I’m currently working for a small startup called https://www.myst.ai/. We’re building a time series forecasting platform to help energy companies predict load / generation. I’m investigating migrating our current multi-repo setup to a monorepo. We currently have shared libraries distributed through a private PyPI server but propagating bug fixes / changes has become cumbersome. Pants looks really promising so excited to dive into it!
🙌 3
4
👋 3
h
That sounds amazing. I'm an infrastructure / utility nerd who also cares a lot about climate change. I hope Pants can help you all out!
How's it been going so far trying things out?
f
That’s awesome, I’m in good company! it’s been fairly smooth so far. I do have some questions on how pants interacts with namespace packages. Our current repository structured with pants-related metadata included (which we aren’t married to) would be something like:
Copy code
/3rdparty
  requirements.txt
  BUILD
/lib
  org-project-1/
     org/
       __init__.py # we declare `org` as a namespace package here using `pkg_resources`
       BUILD
       project_1/
          __init__.py
          BUILD
  org-project-2/
      org/
        __init__.py # also here
        BUILD
        project_2/
           __init__.py
           BUILD
pants.toml
First naïve question is: I’m having some trouble getting Pants to run tests in either of the two namespace packages (
org.project_1
and
org.project_2
) since it can’t find the
pkg_resources
module. I’ve tried adding
setuptools
(which ships with pkg_resources) to
3rdparty/requirements.txt
but Pants still can’t find
pkg_resources
. Is there something obvious I’m forgetting to do? Thanks 🙂
Oh hmm, does this maybe have something to do with
module_mapping
Nvm, it seems like
pkg_resources
is already included in the default module name mapping for
setuptools
.
b
That's neat. I love hearing how Pants is helping devs do good in the world. How did you hear of the project?
f
@busy-vase-39202 IIRC through a talk I found on Youtube a couple of years ago!
h
So still having issues with
pkg_resources
? Assuming you're importing from it, dependency inference should pick that up and add a dep on your
3rdparty
setuptools
Have you tried adding an explicit dependency on
3rdparty:setuptools
?
👍 1
f
Adding the explicit dependency works! Not sure why it wasn’t being picked up
h
Oh, is this in an
__init__.py
file? If so, set
[python-infer].inits = true
in pants.toml: https://www.pantsbuild.org/docs/python-backend. Sorry, that's a really common gotcha
f
Ahh yes, that was in an
__init__.py
file! That did the trick 🙏
❤️ 1