TBD: poetry
or pipenv
or other package manager
CMT: Here I use poetry
as an example first
Dev Python Version: 3.7.9
- Download
poetry
by using:
# For linux and unix-like users
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
# For windows user, you will need your powershell or just use the subsystem
# If you wish to use powershell, the follow cmd is for you
# (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
- Install existing dependencies
# Running locally for dev / test env etc
poetry install
# On pp / prod
poetry install --no-dev
- Add new package: never ever pip install :)
# Example
poetry add django
# For dev only
poetry add --dev ipython
# If you wish to test something on you local but not add it to the "lock"
poetry add --no-root xxx
- To run python or some other packages that offer cli
# Boot django server in local
poetry run python manage.py runserver
# Or a lazy way, just enable the shell
poetry shell
python manage.py runserver
- After running
poetry install
on local, for the very first time. Please run:
poetry run pre-commit install
- Start to commit :)
- Show test coverage report on terminal
poetry run pytest --cov-report term --cov spring_cloud tests/