# https://packaging.python.org/en/latest/tutorials/installing-packages/
$ python3 -m pip --version
$ python3 -m ensurepip --default-pip
# https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/
$ pip install -r requirements.txt # from a file
$ pip install -e git+https://git.repo/some_pkg.git # from git
$ pip install -e git+https://git.repo/some_pkg.git@feature # from a branch
"""Using virtual environments allows you to avoid
installing Python packages globally which could
break system tools or other projects."""
$ python3 -m pip install ttrack # py2 project
# https://github.com/conda-forge/miniforge
$ curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
$ bash Mambaforge-$(uname)-$(uname -m).sh
$ mamba create --name "py27" python=2.7 -y
$ mamba env list
$ mamba activate py27
$ mamba list
$ pip --version
$ pip install ttrack
# Every package (code) has a home 🏡
import os
import inspect
import setuptools
os.path.abspath(inspect.getfile(setuptools))
# https://setuptools.pypa.io/en/latest/userguide/quickstart.html#setup-py
from setuptools import find_packages
setup(
name='my_package',
version='0.0.1',
packages=find_packages(
where='src',
include=['mypackage*'],
exclude=['mypackage.tests'],
),
)
$ python3 -m pip install -e .
# https://python-poetry.org/docs/
$ curl -sSL https://install.python-poetry.org | python3 -
$ mkdir my_package
$ poetry new my_package