Starting off my tech notes, I decided to start from the very basics. When I say basics,what pops into my head is that one of the first requirements that a beginner programmer will run into, is installing packages that might be needed while writing the code. For example one of the requirements for your program could be to read an excel file. One way to fulfil this requirement could be to write your own code from scratch to parse an excel file. But why reinvent the wheel when you can use the ones that are freely available? For this task many libraries already exist on the great wide internet, a simple google search will show the libraries named XLRD or Pandas could do this task by a simple function call.
This is where python package installer, pip, comes in. To gain access to these libraries you will need to install these packages in your local environment. The following command does just this:
pip install "package-name"
If you want to be more specific with your installations:
pip install "package-name"=="version"
Now there will come a time when your programm will be so extensive that you will need to install multiple packages. And writing this command again and again can get monotonous and every body knows programmers loath monotony! For this simple reason, there is a provision to install packages using pip and a configuration file containing the names of all the required packages(and their versions if needed) like so:
pip install -r requirements.txt
Naming the configuration file "requirements.txt" is an accepted practice, but not necessary, but thats how most people do it, but its not necessary, but its best prac.. ok im stuck in a loop! moving on!... requirements.txt file is fairly easy to write and will help you (and any other buddies working on the project) a lot in setting up the environment at a later point in time:
###### Required packages go here ######
pandas
xlrd
some-other-package-name
###### Packages with specific versions ######
tensorflow == 2.3-rc3 # package with version 2.3-rc3 will be installed
matplotlib >= 2.2.5 # flask package with minimum allowed version 1.0
xlwt != 1.0 # Version Exclusion. Anything except version 1.0
I believe this is one of the most useful tools under a python programmer's belt. using the following command you can generate the configuration file containing all the dependencies for your project that can then be used by other members of your team to get setup with the environment and start contributing:
pip freeze > requirements.txt
This will redirect the output of the pip freeze
command to the file requirements.txt
which you can use as you will.
Well this is all for now. If you find I made a mistake or missed something just make a pull request on the repo or write me an email.
I hope this has been helpful ;). Before signing off I have to make a note that today is 20th April in the year 2020 so the symmetry of the
date is just beautifull that and the fact that there is a 420 somewhere in there (͡° ͜ʖ ͡°) . Ok now I think I will sign-off ciao for now.
* ------ * ------ * ------ *