21
loading...
This website collects cookies to deliver better user experience
.venv/bin/python
's location - in-project $PROEJCT_ROOT/.venv/bin/python
or global (e.g. ~/.pyenv/versions/$PROJECT_IDENTIFIER/.venv/bin/python
)?Pipfile
looks like this.[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
fastapi = "*"
aiofiles = "*"
uvicorn = "*"
gunicorn = "*"
gtts = {git = "https://github.com/patarapolw/gTTS.git"}
wordfreq = {extras = ["cjk"], version = "*"}
[dev-packages]
[requires]
python_version = "3.9"
Pipfile.lock
, but it doesn't look very readable to me, unlike package.json
or go.mod
(which, of course, have package.lock
and go.sum
to pair with).export PIPENV_VENV_IN_PROJECT="enabled"
to ~/.zshrc
.requirements.txt
; and it can be readable, if not compiled directly from pip freeze >
.requirements.txt
(e.g. .prod.txt
, .dev.txt
); but I have seen NONE with requirements.lock
pip freeze > requirements.lock
; even perhaps adding to git pre-commit hook.cat << EOF > ~/.git/hooks/pre-commit
#!/usr/bin/env bash
source .venv/bin/activate
pip freeze > requirements.lock
EOF
chmod +x ~/.git/hooks/pre-commit
poetry add <PACKAGES>
actually pin versioning into TWO lock files, one with exact, another with >=
; but I distaste this.$ poetry init
...
Would you like to define your main dependencies interactively? (yes/no) [yes] no
Would you like to define your development dependencies interactively? (yes/no) [yes] no
...
poetry config set virtualenvs.in-project true
.>=2.0.1
^2.0.1
~2.0.1
2.0.1
2.0
2
requirements.txt
(TXT file), setup.py
(Python file), or whatever *.toml
files.cat << EOF > requirements.txt
fastapi
aiofiles
EOF
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip freeze | grep -i "$(cat requirements.txt)" > requirements.txt
pip freeze > requirements.lock
python --version > .python-version
# Then, hand-edit requirements.txt