- Define project directory structure in ASCII format in your
README.md
, like below:- ProjectRoot - src - tests - data - unit - integration - docs - examples - project.toml - README.md
- Use Python's inbuilt
venv
to create project's virtual env within the directory like below:pip version pip install --upgrade pip pip version pip list python -m venv .venv source .venv/bin/activate # to activate virtual environmant deactivate # to deactivate virtual environment
- Define dev-setup steps in README.md
- Use Python 3.x latest stable version. Strictly no to Python 2.
- Use contemporary
.toml
instead of legacysetup.py
for project packaging and installation. - Use
pylint
and optionallyflake8
orblack
or anything else for linting - Use
pytest
for unit testing. It is pretty easy and popular too for this. - Use
pytest-cov
for test coverage report - Use
python-dotenv
for loading externalized properties into code. You should externalize things like API-keys, Passwords, Client-ID, and any other environment specific property. - If you are a productivity junkie like me, you will have something like
init-dev-env.sh
defined in the project to make project onboarding of new dev easier. A sample of how it looks like in my project or that of the teams I lead would look like below:#!/usr/bin/env zsh source .venv/bin/activate pip list alias pytu='pytest tests/unit --cache-clear -s' alias pyti='pytest tests/integration --cache-clear -s' alias pyt='pytest --cache-clear -s' alias pyl='pylint . --output-format=colorized' alias flk='flake8' echo "You are now good for development"
Created
December 31, 2024 14:28
-
-
Save karthiks/30a39d9d613270344b988b355fdf3d28 to your computer and use it in GitHub Desktop.
Python Project Setup Checklist
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment