Skip to content

Latest commit

 

History

History
90 lines (87 loc) · 4.56 KB

tutorials.md

File metadata and controls

90 lines (87 loc) · 4.56 KB

Tutorials

This file contains examples of workflows I use to illustrate how to combine the various elements of my setup.

New python package

In this tutorial, we'll create a new python package called spaghetti and start working on it.

  1. Press <fk> <shift-c> spaghetti <enter> to create a new tmux session for the project.
  2. c src<enter>
  3. ccp<enter> and answer the questions to create a new cookiecutter project. Make sure to answer 1 to the Click question so we have a cli. Not always necessary, but we'll do it here. Read about Click; it's great.
  4. pyn spaghetti<enter> to create a pyenv for this project
  5. pys lf<space><enter> to activate the pyenv
  6. c spa<tab><enter> to switch to the spaghetti directory
  7. l<enter> to see a list of files
  8. git init .<enter> to initialize a git repo
  9. gn develop<enter> to create a develop branch
  10. fi<space><enter> and press enter a bunch of times to initialize git flow
  11. ga .<enter> to add everything to the git repo
  12. gc<space> Initial commit<enter> to commit the repo with the message "Initial commit".
  13. Link this repo with github by either following instructions on github or creating new repo using git create -d "Spaghetti"<enter>.
  14. gp -u origin develop<enter> to push and set up tracking
  15. pie<enter> to install current repo into pyenv.
  16. pi <package><enter> to install a dep
  17. ppv <package><enter> to see what version was installed. Select Keras==1.2.0 or whatever it is with mouse and press <cmd-c> to copy to clipboard. This is basically the only time I use the mouse. Probably could eliminate it but hasn't been pressing enough
  18. vim se<ctrl-j><enter><enter> to open setup.py
  19. /req<enter> to find the requirements section
  20. jjdd<v-j> to delete the TODO line and save
  21. <shift-o> to create a new line above the current
  22. <ctrl-[> to escape from insert mode
  23. <g-j> p to paste from system clipboard
  24. == to fix indentation
  25. ysi<shift-w>' to surround with quotes. Try to understand this by looking up vim-surround and thinking about motions to understand what this is doing. In particular, why <shift-w> instead of w?
  26. f= r> <v-j> to replace == with >= and save
  27. <shift-a> , <v-j> to add comma at the end then exit insert mode and save
  28. gsi] to sort dependencies. Note this won't do anything, as they're already sorted. But good practice to do whenever you add a dep.
  29. <v-j> to save
  30. <f-k> ' to create a new pane above the current. We'll use this one for git stuff and managing the directory.
  31. <f-k> z to zoom the pane
  32. j sp<enter><enter> to change to the spaghetti directory
  33. pys spa<tab><enter> to activate the spaghetti pyenv
  34. gca<space> Add deps<enter> to add changed files and commit
  35. gp<enter> to push changes to server
  36. <f-k> c to create a new window. We'll use this one for running the cli.
  37. j sp<enter><enter> to change to the spaghetti directory
  38. pys spa<tab><enter> to activate the spaghetti pyenv
  39. spa<tab><enter> to run the spaghetti program
  40. <f-k> ; to select the other window
  41. ffs improve-cli<enter> to start a new feature branch called improve-cli. At first, always read the output from git flow commands. These start with ff and expand to git flow ....
  42. <f-k> d to zoom the vim pane
  43. <g-j> k cli to search for spaghetti/cli.py.
  44. <ctrl-v> to open it in a vertical split
  45. }}}k<shift-v>kk to select the three lines of main.
  46. <shift-c>pass<v-j> to set the contents to pass and save
  47. <f-k> ; to switch to the other window
  48. <ctrl-p><enter> to run spaghetti again and see that there is no longer any output.
  49. <f-k> ;<f-k> d to switch to git terminal
  50. gs<enter> to see the status of the branch
  51. gd<enter> to see what exactly has changed. When this is long, it will let you navigate using vim-like shortcuts eg j and k
  52. gca Remove output.<enter> to commit change.
  53. ffp<enter> to publish branch
  54. pr<enter> to create a pull request
  55. <shift-q> to accept message and finish creating pull request. You could also edit it. It's vim. I don't often change this, but sometimes it's useful. You should follow the same guidelines here as for commit messages.
  56. Hold down <cmd> and click on the link. You can see your pull request. You can send this link to others so that they can see what you've done and comment on it.