Hey everyone! I hope to have more time today and ...
# general
l
Hey everyone! I hope to have more time today and this weekend to evaluate pants in more depth, but I thought I would ask a bit of advice first. Our repo is currently a monolithic django app and I want to move it to a monorepo with as little disruption as possible. To top it off, our repo structure is a bit unusual, but not that unusual for a django API. I wanted to see how people would approach adopting pants and a monorepo structure. Here is what our current structure currently looks like:
Copy code
repo
├── compose
├── config
    ├── asgi.py
    └── settings
├── docker-compose.yml
├── manage.py
├── poetry.lock
├── proxy
├── pyproject.toml
├── setup.cfg
├── startup.py
├── staticfiles
└── api
    ├── accounts
    ├── authentication
    ├── celery.py
    ├── common
    ├── conftest.py
    ├── users
    └── util
Each django app under the api directory has
tests
directory for tests
👋 1
h
So you have multiple apps but (for now at least) a single service that brings them all into a single settings.py?
and that settings.py lives under config/settings?
l
yep
From the little I played with it so far, it’s been difficult getting the apps to find the settings files
h
That's pretty common
It is fairly opinionated about a good way to organize the codebase for (eventually) multiple services
and its pants.toml has some config useful in Django contexts
that one is pretty important for Django, since settings.py does a lot of runtime deps specified as strings
l
Yep, and that has been very helpful! However, our sittings is at the top level. I realize we can move them into the
api
directory to solve the problem, but I was kind of hoping to get this working before making structural changes
I also thought of maybe creating another repo, and using shallow or partial clone of our existing repo into a “subdirectory” under projects or something like that. Then when we are ready, move it over perminately
h
Ah, so your settings.py is at the root? Not under config/settings?
It shouldn't matter either way, just clarifying
l
the
config
directory holds the settings.py, wsgi.py, etc.
I think I’ll wipe up a repo on github that is like we structure things so that we are all on the same page. But for now, I was kind of wondering how other people approach going from a single project repo, to a monorepo with pants. Especially with Django with the least disruption to developers currently working on it.
It’s hard enough to get buy in with some on the team, and it would be nice to show the advantages on a branch or repo to boost my chances of adoption.
h
To clarify terms, how are you distinguishing "single project repo" from "monorepo". So do you have multiple repos with structure like the one you show above?
If so, one thing you can do is merge all the code under a single tree (like your
api
dir, but for everything), but have separate dirs for your different
settings.py
I assume you intend to have multiple of those
Putting together a github repo we can comment on would actually be a really good idea!
l
No, we only have the one repo above, but we do have a couple of separate deployable services (proxy, api) that share the same settings and django apps. I want to have better separation and modularity around this before it gets out of hand.
h
Gotcha
So yeah, a github repo to poke at would be good
or use example-django as a base for questions?
Either way, more specific questions will get more specific answers 🙂
👍 1