Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing a Python Monorepo in PyCharm

I'm experimenting with monorepos & python. The idea is having multiple projects in the same repo, each project should have its own virtualenv.

I find it kinda cumbersome managing all of that in PyCharm.

PyCharm supports managing multiple projects in with different venvs: https://www.jetbrains.com/help/pycharm/opening-multiple-projects.html?_ga=2.5681206.409054178.1602169802-543218074.1500382704

But it's not very friendly if you have many projects, I will have to "open" and "attach" each and every one of them.

Let's see an example in this repo:

Under the project directory I have 2 projects:

Project Layout Example

The 2 projects directories are marked in bold (just like the root one), basically meaning they are "PyCharm projects".

Under the preferences window, you can see all the projects:

enter image description here

But there's no option of adding new projects there. If I had a 3rd project, I would have to open it and attach it to the current window.

Am I missing something? Is there an easier way of marking a sub-directory as a project? Imagine cloning a repository with 10 projects or more, configuring all the settings on PyCharm is going to be very frustrating.

like image 260
orlevii Avatar asked Mar 01 '26 03:03

orlevii


1 Answers

You can share some of the files into the .idea folder via your repository. This folder and particularly the .idea/modules.xml file contains all the configuration details for your project(s).

Therefore, you only have to do the setup once (or as projects are added) then the configuration will be replicated.

like image 104
Spack Avatar answered Mar 03 '26 16:03

Spack



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!