Helping those that want to Help you

After cloning a git repo and then manually installing the various dependencies as stated by the author in their README.md. I found from the code that they had missed out dependencies from the list.

This got me thinking about how I can 'Make Things Better?'. Or at the very least get others thinking about how to write their repository code better.

In this case, it was a python project. A project with all the code in one huge python file.

I knew that there was a much better way of doing a lot to this project but I am going to focus on the basics that every python-dev should be doing if they are publishing their projects publicly to GitHub or similar, as the process is already available. Especially in the case of the project I was looking over because it was published only a few months ago.

Requirements.txt Creating this file correctly and adding it to your repository will not only help you when you look back but it will help other developers ensure that they (or you) do not miss any dependency and waste crucial time chasing a rabbit down a hole.

Open the virtual environment that you have been working on in your project. You are using a virtual environment and not clogging up your Python install with random libraries?

To get a list of all the dependencies you added to the environment type:
pip freeze
Your terminal should list each dependency and its version.

Now type:
pip freeze > requirements.txt
This will create a text file with all of the information previously shown from the terminal command.

Update your repository with the text file. Edit your README.md with the following.

To add all of the dependencies to your virtual environment for this project type the following in the terminal:

pip install -r requirements.txt

That's it, you don't need to list all the dependencies anywhere in the README.md as pip has sorted that for you.
Every other developer doesn't need to worry about missing out a dependency as they don't have to manually input each and every one (as there could be quite a lot).

Again
I don't make things
I make things better

#IDMTIMTB

No Comments Yet