When we are talking about how to start python we must understand the basic tools that will help you in writing better code debugging and dependency management.
How to start python projects.
To start any project it is always recommended to create the project in its own environment. This means that anything that is installed for python at the global level will not affect this env and vice versa.
sudo apt-get install virtualenv
After installation activate it.
virtualenv env_name -m python3
This will create an env for python 3 and you can start working inside it. Keep in mind that you have to activate the env before running your code to make it work.
Now you can install any packages that you want to use in your python program.
Pep8 is the formatting style that defines how you should format your python program. How you should name your variables and more such conventions. Pep8 is highly recommended for anyone who wants to work with the opensource community.
For dependency management in python, we use pip. It is used for installing packages. You can have a file naming requirements.txt which will have all the packages that you need to install along with the version that you want to install.
HOW TO INSTALL PYTHON PACKAGE:
pip install package_name
HOW TO INSTALL USING REQUIREMENTS.TXT
pip install -r requirements.txt
Well according to me python debugger is best for anyone who is starting. Now how to use it is as below.
Where ever you want to stop the execution of code and see the values or variables or execute whatever you want. You can use the below lines.
import pdb pdb.set_trace()
This will stop the execution of the program and give you control of the program.
Pycharm is very good for python but if you are a power user of sublime that will be awesome.
If you like the article please share and subscribe. You can also join our Facebook group:https://www.facebook.com/groups/327836414579633/ and Linkedin group:https://www.linkedin.com/groups/10441297/