Yan Kalchevskiy
Software Engineer
$ pip install Package
$ pip install "Package>=1.0,<2.0"
$ pip install -U Package
$ pip install -r requirements.txt
$ pip uninstall Package
$ pip freeze
$ pip list
$ pip list -o # --outdated
$ pip show Package
$ pip search Package
$ pip completion --bash >> ~/.profile
$ pip completion --zsh >> ~/.zprofile
$ pip install --user Package # global, no sudo, no venv
$ # ~/.local/bin or $(python -m site --user-base)/bin
$ pip install --download=/home/user/.pip/cache Package
$ pip install --no-index --find-links=file:///home/user/.pip/cache Package
$ pip install wheel
$ pip wheel --wheel-dir=/home/user/.pip/wheels Package
$ pip install --find-links=file:///home/user/.pip/wheels Package
$ # wheels
$ pip wheel Package; pip install Package
$ cat ~/.pip/pip.conf
[global]
find-links = file:///home/user/.pip/wheels
wheel-dir = /home/user/.pip/wheels
$ # cache
$ pip install Package
$ cat ~/.pip/pip.conf
[global]
download-cache = /home/user/.pip/cache
find-links = file://home/user/.pip/cache
$ tree
.
├── mega_project
│ ├── __init__.py
...
├── README.rst
├── requirements
│ ├── base.txt
│ ├── development.txt
│ ├── production.txt
│ └── testing.txt
├── requirements.txt
├── setup.cfg
└── tests
├── __init__.py
$ tree
...
├── mega_project
│ ├── __init__.py
│ ├── settings
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── development.py
│ │ ├── production.py
│ │ └── testing.py
...
$ cat requirements.txt
-r requirements/production.txt
$ cat requirements/production.txt
-r base.txt
uWSGI==2.0.6
$ cat requirements/base.txt
# flask
Flask==0.10.1
# flask extensions
Flask-Admin==1.0.8
# deps
Jinja2==2.7.3
MarkupSafe==0.23
WTForms==2.0.1
Werkzeug==0.9.6
itsdangerous==0.24
def is_string(obj):
"""Check if 'obj' is a string."""
return isinstance(obj, basesring)
# grid
from third_party import (lib1, lib2, lib3,
lib4, lib5, ...)
# vertical
from third_party import (lib1,
lib2,
lib3
lib4,
lib5,
...)
# vertical hanging
from third_party import (
lib1,
lib2,
lib3,
lib4,
)
# hanging grid
from third_party import (
lib1, lib2, lib3, lib4,
lib5, ...)
# own line
from third_party import lib1
from third_party import lib2
from third_party import lib3
...
$ tree -a -L 3 cookiecutter-yad/
cookiecutter-yad/
├── cookiecutter.json
├── {{ cookiecutter.repo_name }}
│ ├── {{ cookiecutter.project_name }}
│ │ ├── apps
│ │ ├── {{ cookiecutter.project_name }}
│ │ └── manage.py
│ ├── .gitignore
│ ├── README.rst
│ ├── requirements
│ │ ├── base.txt
│ │ ├── dev.txt
│ │ ├── production.txt
│ │ └── testing.txt
│ └── requirements.txt
├── .gitignore
├── LICENSE
└── README.rst
$ cat cookiecutter-yad/cookiecutter.json
{
"repo_name": "RepoName",
"project_name": "project_name",
"app_name": "app_name",
"author_name": "Your Name",
"author_email": "your@email"
}
$ cookiecutter cookiecutter-yad/
repo_name (default is "RepoName")? awesome
project_name (default is "project_name")? awesome
app_name (default is "app_name")? users
author_name (default is "Your Name")? Yan
author_email (default is "your@email")?
$ tree -a -L 3 awesome/
awesome/
├── awesome
│ ├── apps
│ │ ├── common
│ │ ├── __init__.py
│ │ └── users
│ ├── awesome
│ │ ├── __init__.py
│ │ ├── settings
│ │ ├── urls.py
│ │ └── wsgi.py
│ └── manage.py
├── .gitignore
├── README.rst
├── requirements
│ ├── base.txt
│ ├── dev.txt
│ ├── production.txt
│ └── testing.txt
└── requirements.txt
$ cat ~/.ssh/config
Host infograph
User yan
Port 2222
HostName infograph.example.com
IdentityFile ~/.ssh/infograph_rsa
$ # the following lines do the same
$ ssh -i ~/.ssh/infograph_rsa -p 2222 yan@infograph.example.com
$ ssh infograph
By Yan Kalchevskiy
Tools that I use and how I use them