Python Development Workflow for Humans™
Pipenv is meant to replace:
- requirements.txt
- virtualenv / virtualenvwrapper
- pip-tools / pip-compile
Same philosophy as requirements.in, with the TOML syntax.
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[requires]
python_version = "3.4"
[packages]
Django = ">=1.11,<2"
psycopg2 = ">=2.7.3"
django-solo = "*"
[packages.django-yubin]
url = "https://github.com/APSL/django-yubin.git"
ref = "abcd567"
[dev-packages]
bpython = "*"
django-debug-toolbar = ">=1.9.1"
Tom's Obvious, Minimal Language
By Tom Preston-Werner (GitHub, Gravatar, semver)
Rust as an early adopter with Cargo.toml and Cargo.lock
Quite easy to read. Shouldn’t write!
"_meta": {
"hash": {
"sha256": "21fb10662530619307c989ac2fdb4f02ab96d11079930db48eb7e4e9fd0375c9"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.4"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"django": {
"hashes": [
"sha256:ac4c797a328a5ac8777ad61bcd00da279773455cc78b4058de2a9842a0eb6ee8",
],
"version": "==1.11.10"
},
},
}
/etc/cron.d/life-of-brian
PATH=$PATH:/usr/local/bin
42 4 * * * brian cd /srv/life-of-brian && pipenv run ./src/manage.py clearsessions
/etc/systemd/system/life-of-brian.daphne.service
[Unit]
Description=Django daphne
After=syslog.target
[Service]
WorkingDirectory=/srv/life-of-brian
ExecStart=/usr/local/bin/pipenv run daphne -u /tmp/life-of-brian.sock life-of-brian.asgi:channel_layer -v2
RuntimeDirectory=life-of-brian
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target
$ pipenv --venv
/home/brian/.local/share/virtualenvs/life-of-brian-zVxdobNk
/etc/uwsgi-emperor/vassals/life-of-brian.ini
[uwsgi]
username = brian
project = life-of-brian
venv-name= life-of-brian-zVxdobNk
chdir = /srv/%(project)/src
home = /home/%(username)/.local/share/virtualenvs/%(venv-name)
module = %(project).wsgi:application
env = DJANGO_SETTINGS_MODULE=life_of_brian.settings
log = /var/log/uwsgi
daemonize = /var/log/uwsgi/%(project).log
master = true
processes = 1
threads = 1
uid = %(username)
gid = nginx
socket = /var/uwsgi/%(project).sock
chmod-socket = 660
vacuum = true