r/learnpython • • Aug 25 '20

How to read/understand a git repository?

I'm trying to learn how to make a python programs by looking through existing programs in a similar premise as what I'd like to achieve (learning by looking at examples). But one thing I'm having difficulty with is finding out how these github repos are organized.

So far (in the repo I have I'm viewing) I know that bin usually means terminal/command-line commands, docs is typically documentation (as one might expect), test is self explanatory, but some things I don't know is rpm and stubs, amongst others.

Is there a resource to learn how python/git programs are organized? And what to expect when looking through repos?

334 Upvotes

13 comments sorted by

View all comments

19

u/DrMaxwellEdison Django and stuff Aug 25 '20

Great question, and the answer really depends on how the maintainer(s) of that code choose to organize, as there aren't really standards to follow.

What I find is that most often a repo will contain:

  1. The source code in a directory named src or a similar name as the package itself (in the case of your example, libqstile looks right); and

  2. Everything else. Docs, tests, binaries (that's the bin part, by the way), license, notes on how to contribute, CI workflow configurations, etc.

When you're interested in how the code works, put #2 to the side, and focus on #1. Dive into that source folder and get cracking. Often a good place to start is the root __init__.py file, which can give clues as to how different objects are made importable from the top level of the package.