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

62

u/Codes_with_roh Aug 25 '20 edited Aug 25 '20

stubs basically means:

A small software routine placed into a program that provides a common function. Stubs are used for a variety of purposes. For example, a stub might be installed in a client machine, and a counterpart installed in a server, where both are required to resolve some protocol, remote procedure call (RPC) or other interoperability requirement.

rpm means:

The RPM Package Manager (RPM) is a package management system that runs on Red Hat Enterprise Linux, CentOS, and Fedora. RPM makes it easier for you to distribute, manage, and update software that you create for Red Hat Enterprise Linux, CentOS, and Fedora. Many software vendors distribute their software via a conventional archive file (such as a tarball)

This blog will provide you the information about organizing your repos.

While going through the repo the most important thing to keep in mind is to read and understand the .readme throughly because a well maintained repo contains all the information of usage inside the .readme.

25

u/[deleted] Aug 25 '20

This isn't really how "stubs" is used in practice...

In practice, "stubs" means "a replacement for the real thing". Something that someone else needs to write based on the given example. Eg. you may have a template for implementing context managers, that looks like this:

class $1:
    def __init__(self):
        # A stub for constructor
        pass
    def __enter__(self):
        # A stub for with ... as x:
        pass
    def __exit__(self, v, t, b):
        # A stub for exception handling
        pass

Wiki gives a better description ( https://en.wikipedia.org/wiki/Method_stub )

A method stub or simply stub[1] in software development is a piece of code used to stand in for some other programming functionality. A stub may simulate the behavior of existing code (such as a procedure on a remote machine, such methods are often called mocks) or be a temporary substitute for yet-to-be-developed code. Stubs are therefore most useful in porting, distributed computing as well as general software development and testing.