setuptools
builds distributions from source code.pip
(un)installs distributions (optionally, from PyPI).twine
publishes distributions to PyPI.
pytest
tests installed distributions.
Created
February 13, 2019 08:11
-
-
Save dmtucker/3c9d5e2c389409aa807f95621bfdd242 to your computer and use it in GitHub Desktop.
no global pip, instead (these both dont work)
mkdir -p ~/.local/pipx/venvs
sudo apt install python3-venv
python3 -m venv ~/.local/pipx/venvs/pipx
~/.local/pipx/venvs/pipx/bin/pip install pipx
ln -snf ~/.local/pipx/venvs/pipx/bin/pipx ~/.local/bin/pipx
~/.local/bin/pipx ensurepath
pipx upgrade pipx
use global python for pipx not pyenv versions (in case you decide to remove them)
- pipx first, then pyenv
pipx install pipenv tox
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
anyone confused over all the py-things in the typical toolchain? we've been discussing this in a PM, but it's probably generally applicable, so i'll share it here. it is my opinion on what goes where:
requirements.txt
: replaced by Toxdeps
orextras_require
(insetup.py
) for libs, replaced by Pipfile (eventually) for appsPipfile
: used for apps, mostly withpipenv
(sincepip
doesn't support it yet)pipenv
: used for apps. kennethreitz says otherwise... he's probably wrongpip
/twine
: used for managing dists, might get merged eventuallypyproject.toml
: replacessetup_requires
, allows for build systems that aren'tsetuptools
(e.g.flit
,poetry
), will probably replacesetup.cfg
virtualenv
: probably replaced bypython3 -m venv
which is stdlibpyenv
: manage multiple pythons on a system (so you're not locked into whatever the OS supports, which tends to be ancient)pipx
: manage global packages (withoutsudo
) in a way that uncomplicatespip install --user
. this is perfect for python packages that aren't necessarily packaged for OSes (e.g. ducttape cli)simplifying... this is the toolchain i use / my view of the world:
pyenv
as necessaryas a user / in production:
pipx
andpipenv
(they usepip
under-the hood, but i generally don't need to know that)as a dev:
pipenv
for apps (note it's presence in dev and prod -- like docker, another deployment tool)tox
+pytest
for testing (tox
manages virtualenvs, including a dev env: https://tox.readthedocs.io/en/latest/example/devenv.html)pyproject.toml
(always, starting now) +setuptools
(for now... i want to look intoflit
) for buildnote that
pip
andpython3 -m venv
/virtualenv
is pretty much never used directly.