-1

I am looking for a way to setup a GitHub repo in a way that allows someone to clone it and then immediately run the code without needing to setup a virtual environment and then pip install all of the needed packages.

Perhaps I am off base and it is the case that they must install these packages and they can somehow be auto imported, but I'm not sure how that is done.

Or perhaps you can add the virtual environment folder as another folder in the repo, but I feel like you would still have to pip install in that case. (I'm not too familiar with virtual environments.)

I don't want to mess up the project, so I have not messed around with this too much.

Any help would be much appreciated!

Void
  • 169
  • 14
  • 1
    Have you considered publishing Docker images instead? In any case, what you're asking for is how to package a project with all its dependencies effectively. Searching in that direction will give you a few options as well. That said, I wouldn't do either but rather make it as easy as possible for people to run your program in a venv, like clear instructions and e.g. a Makefile. – Ulrich Eckhardt Oct 01 '21 at 08:31
  • 1
    BTW: "I don't want to mess up the project" -- just clone it. In any case, Git makes it easy to get back to a previous state! – Ulrich Eckhardt Oct 01 '21 at 08:32

1 Answers1

1

Actually, you can create a requirements.txt file for the environment, then anyone (or any build server) that receives a copy of the project needs only to run the

 pip install -r requirements.txt 

command to reinstall the packages on which the app depends within the active environment.

Hope this gives you some inspiration. Detailed steps please view this tutorial: Create a requirements.txt file for the environment

Molly Wang-MSFT
  • 7,943
  • 2
  • 9
  • 22