Hello folks! We are restructuring our monorepo to...
# general
o
Hello folks! We are restructuring our monorepo to include some frontend code. We are going from -
Copy code
src
└── <top_namespace>
    ├── services
    └── libs
Copy code
src
├── backend
|   └── <top_namespace>
|      ├── services
|      └── libs
└── frontend
    └── ..
We are thinking of putting all our python related files -
pants
,
pants.toml
, etc. under
src/backend
. Is this pattern okay? Is there any downside to this?
h
Hi! Depends if backend truly does not depend on anything outside of the folder. Targets cannot use ../ to refer to a patent directory. Also, might be worth considering having it in the repo root because support for other languages is on the way. I'm hoping to add Prettier and ESLint support in the next month as a weekend hack project, which will let you use ./pants lint :: to run all Python, JS/TS, and Shell linters in one go
o
oh that’s great!
One hurdle that I encountered while keeping the pants files at the root was the import paths in proto files under backend/. Let me try it again get back.
h
Hm could you please tell me more about that - what's going on?
h
I'm not sure how well things will work with the
pants
script not in the repo root. They will probably work as long as you
cd
into the directory it's in before running it. I'm not 100% sure what happens with git-related Pants actions, like using the
--changed-since
flag
But things like import paths should not be affected, so if you're having an issue with that, then either you need a config change (possibly related to source roots: https://www.pantsbuild.org/docs/source-roots), or we have a bug somewhere.
Hopefully we can clear this up for you!
o
Apologies for the slow followup! I was out the past couple of days as it’s a long weekend here (UK). We’ve decided to continue to keep pants in the root directory as you guys suggested. It’s a much simpler change on our end as well.
Hm could you please tell me more about that - what’s going on?
@hundreds-father-404 - looks like that wasn’t an issue after all. Proto files are all working as expected. I must have done an incorrect search & replace for imports within our proto files.
❤️ 1
I’m hoping to add Prettier and ESLint support in the next month as a weekend hack project, which will let you use ./pants lint :: to run all Python, JS/TS, and Shell linters in one go
Can’t wait for that 😀
🤘 1