Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python package naming strategy for company

I work in a data analysis role and my team is just getting set up to use Git. We have various useful bits of Python that we'd like to keep in version control. I'm looking to understand the best way to structure utility code modules/packages in our Git repos.

I'd like to namespace our modules with the company name as in PEP 423. So a module might be named mycorp.graphing or mycorp.numbercruncher

Is this the right approach and can I set up each of these namespaced modules as separate Git repos? I am wondering if each repo should be rooted at the non-namespaced folder (eg. graphing, numbercruncher) and users should be directed to check out any useful ones into a folder called "mycorp" on their python path.

Is there a better way than this?

The tech skills among the team are varied so I need this to be as simple as possible for people to use.

like image 513
Sophie Gage Avatar asked Apr 23 '26 04:04

Sophie Gage


1 Answers

That seems to be the right approach if these packages should be maintained independently. Then you just keep the same folder structure: "mycorp" folder with an empty __init__.py and graphing and numbercruncher subfolders. The subfolders are git repositories.

Then you can add this "mycorp" path to a global PYTHONPATH environment variable and import mycorp.graphing or from mycorp import graphing.

like image 185
ababak Avatar answered Apr 24 '26 16:04

ababak



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!