Last active
April 5, 2021 07:51
-
-
Save vduseev/a6da3369f75e05dbc9289f37b3a4e659 to your computer and use it in GitHub Desktop.
Usual pyenv, poetry, tmux commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ** Note: | |
| alt = option key on Mac | |
| PageUp/PageDown = fn+up/down on Mac | |
| # Pyenv | |
| ## Install pyenv | |
| brew install pyenv | |
| ## After installing pyenv don't forget to add pyenv init commands to your `.zshrc` or `.bashrc` file | |
| ## (look for info in pyenv repo on github). | |
| ## Upgrade pyenv (new versions of python supported by pyenv come with each upgrade) | |
| brew upgrade pyenv | |
| ## Show all python versions on the machine | |
| pyenv versions | |
| ## Find if certain version is supported | |
| pyenv install -l | grep 3.9.2 | |
| ## Install certain version | |
| pyenv install 3.9.2 | |
| ## Make pyenv auto-use specific version of python in current dir | |
| pyenv local 3.9.2 | |
| ## Spawn a shell with specific version of python anywhere | |
| pyenv shell 3.9.2 | |
| # Poetry | |
| ## Install poetry | |
| brew install poetry | |
| ## Make poetry use certain python version from pyenv | |
| poetry env use 3.9.2 | |
| ## Initialize new `pyproject.yaml` in the current directory interactively | |
| poetry init | |
| ## In existing poetry-based python project create a virtual environment and install dependencies | |
| poetry install | |
| ## Update all dependencies | |
| poetry update | |
| ## Add a new dependency | |
| poetry add requests | |
| ## Add new dev dependency | |
| poetry add --dev ipython | |
| ## Run a command inside virtual environment | |
| poetry run <my command> | |
| ### Examples: | |
| ### 1. Run a script using python from virtual evn (all dependencies are available) | |
| poetry run python myscript.py | |
| ### 2. Run a script declared as `poetry.tool.scripts` in `pyproject.toml` | |
| poetry run <script name> | |
| ## Spawn a shell in virutal environment | |
| poetry shell | |
| ## Display information about virtual environment | |
| poetry env info | |
| # Tmux | |
| ## Create new session (enter in the terminal without tmux) | |
| tmux new -s <session name> | |
| ## Attach to existing session (enter in the terminal without tmux) | |
| tmux a -t <session name> | |
| ## Kill existing session (enter in the terminal without tmux) | |
| tmux kill-ses -t <session name> | |
| ## Create new window/tab (when inside session) | |
| Ctrl+B -> c | |
| ## Close current window/tab (when inside) | |
| Ctrl+B -> x | |
| ## Quit/detach from current session (when inside) | |
| Ctrl+B -> d | |
| ## Rename current window/tab (when inside) | |
| Ctrl+B -> , | |
| ## Jump to next window/tab (when inside) | |
| Ctrl+B -> n | |
| ## Jump to previous window/tab (when inside) | |
| Ctrl+B -> p | |
| ## Jump to certain window/tab by index (when inside). Here we jump to window with index 1 | |
| Ctrl+B -> 1 | |
| ## Split current window vertically (will result in 2 subwindows on the left and on the right side) | |
| Ctrl+B -> % | |
| ## Split horizontally (one subwindow on the top and one on the bottom) | |
| Ctrl+B -> " | |
| ## Jump between splits | |
| Ctrl+B -> Left/Right/Top/Down arrows | |
| # Bash | |
| ## Jump one word forward | |
| Alt + f | |
| ## Jump one word back | |
| Alt + b | |
| ## Jump to the end of the line | |
| Ctrl + e | |
| ## Jump to the beggining | |
| Ctrl + a | |
| ## Delete one word backwards from current cursor position | |
| Ctrl + w | |
| ## Delete everything from current position to the beginning of the line | |
| Ctrl + u |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment