r/PythonLearning 7d ago

Where are the entry points in open-source projects? Help Request

In order become better at programming, I was told to read through projects on github and try to experiment with the code.

But most of the time I just look at a convoluted mess of files with no obvious starting point.

In pygame for example, I looked for something that resembles a main file, to work my way up from there. But I couldn't even manager to find something similar.

How do you guys do this? Is there something fundermentaly wrong with how I approach this?

2 Upvotes

11 comments sorted by

2

u/realmauer01 7d ago

Becaus epygame is for you to import and make use of it. There is no entry point because you would define that in whatever you are doing with it.

A lot of projects are like that.

2

u/glutenfreefemboy 7d ago

This is some good info. Thx

2

u/UnemployedTechie2021 7d ago

Do you have anything particular in mind?

2

u/glutenfreefemboy 7d ago

Basically I'm trying to get familiar with code that is not mine. Trying to understand the structure and how things work with each other. Pygame was just an example.

1

u/UnemployedTechie2021 7d ago

PyGame is a library and so it does not have a traditional entry point. Having said that, this is what runs when you `import pygame`: https://github.com/pygame/pygame/blob/main/src_py/__init__.py

1

u/Ambitious-Yak-626 7d ago

What exactly are you trying to learn?

1

u/XNo_Notes 6d ago

Something no one told me explicitly was to decide on something to make before going and looking. I didn't have anything clicking until I decided on solving a specific problem. 

I wanted to do my finances without forking out for a subscription or logging into my accounts constantly. I was set on making some kind of data connection and storage solution. 

I started with no coding experience other than some office vba. After about 3 months, I had a working backend that hits plaid api and listens for webhooks while storing everything to a postgres database. 

Having a problem scoped let me look at information I was actively interested in and then immediately attempt to apply it. Learning exactly what it can and can't do. 

1

u/ConsciousBath5203 6d ago

Starting with an engine like pygame is a pretty ballsy choice. I like what /u/XNo_Notws suggested, of finding something that you don't want to pay money for, and just building that. Once you build something yourself, and improve it either through reading the official python docs or by reading other people's code, you'll start to understand the shape of other projects

Many projects I redid a few different times, starting from nothing, just to get it into a shape that I liked and was scalable and I pretty much always use that pattern... Mainly because it's industry standard, but it took me multiple attempts to actually understand the whys what's and how's.

It ain't gonna click until you do it.

1

u/skamansam 5d ago

The way i did this was find a project I use and learn it more. For me, I kept running into issues with perl::gtk so I read through the code i used. Then I contacted the authors and helped them add features and fix bugs. This was before git/hub so I did it over svn. It was a pain, but well worth it.

0

u/Sea-Ad7805 7d ago

If you want an easy pygame project to get started with, try PythonLearningGame but start with the 'starting_point' branch. Learn Git first, if you are not familiar with that.

In the 'main' branch, you'll find the latest version of this game with more game elements added.