Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should GitHub repo package folder of a Python project include to manage dependencies?

I have a question that I cannot seem to find the right answer for (perhaps I am articulating it incorrectly).

My program is dependent on Numpy and datetime. should I include those inside the modules folder? Or is it assumed that some of the fundamental packages are already going to be installed on the computer the end user will use?

Layout:

PROGRAM_NAME/
-main
-Readme
--/Modules
  -__init__
  -constants
  -program_name
like image 842
rivesalex Avatar asked Sep 15 '25 18:09

rivesalex


2 Answers

Edit: You could start by adding a requirements.txt to your project, although this is outdated advice if you want to build a package, but will be fine for small projects. If you want to build a package, take a look at this documentation about PEP517: https://peps.python.org/pep-0517/

You can also use other build tools to build packages like https://github.com/python-poetry/poetry

This shell command will export your projects dependencies as a file named requirements.txt:

pip freeze > requirements.txt

Once you’ve got your requirements file, you can head over to a different computer or new virtual environment and run the following:

pip install -r requirements.txt

A requirements file is a list of all of a project’s dependencies. This includes the dependencies needed by the dependencies. It also contains the specific version of each dependency, specified with a double equals sign (==).

Read more here: https://realpython.com/lessons/using-requirement-files/

like image 135
DanOPT Avatar answered Sep 17 '25 08:09

DanOPT


The best place to put dependencies would be in a requirements.txt file. Then to install all the requirements, use pip install -r /path/to/requirements.txt.

More information on requirements.txt can be found here in the pip documentation.

like image 23
Zachary Elkins Avatar answered Sep 17 '25 08:09

Zachary Elkins