A Beginner guide to structuring your Python Projects
Packages and Environment
Linting and code style
Get rid of the old make file
Packages and Environment
The old way of doing things
Back then the way to deal with packages in python was to create a new environment with Conda or the included venv and active it, then installing you're packages with pip then freezing them into a requirements.txt so that you're team could install the same deps as you do.
An easier way to approach this problem
With Pipenv you no longer need to use pip and virtualenv separately. They work together.
Simply install it with pip
pip install --user pipenv
Then active your environment
pipenv shell
And install whatever you want !
pipenv install request
Linting and code style
I personally picked pylint cause it felt like it's the more easy and intuitives to use and seem to contain all the use full features and is compatibility with code editor.
pipenv install pylint
Get rid of the old make file
Pipenv give us the possibility to run scripts easily !
Simply give create a Script inside the Scripts section of you're Pipfile
Now i can run pipenv run lint
to lint my files
or
pipenv run start
to start my Django Project !
Thanks for taking time to read this article i hope it help you !
If you have any suggestion or way i can improve it i'll be happy to ear them !
Top comments (0)