Slide 1

Slide 1 text

PyOhio 2019 Find Your Feature Fit How to pick a text editor for Python programming Gregory M. Kapfhammer Madelyn M. Kapfhammer

Slide 2

Slide 2 text

@GregKapfhammer www.gregorykapfhammer.com Hi! Glad to be Back at PyOhio! GREGORY M. KAPFHAMMER

Slide 3

Slide 3 text

@MaddyKapfhammer www.madelynkapfhammer.com Hello! It's Great to Meet You! MADELYN M. KAPFHAMMER

Slide 4

Slide 4 text

Developer Productivity Programming Fun Effective Code Why Care About a Text Editor?

Slide 5

Slide 5 text

VS CODE VIM

Slide 6

Slide 6 text

A FAST PACED FIELD

Slide 7

Slide 7 text

Showcase noteworthy features Compare and contrast text editors Highlight less available information Share the thrill of customization Key Goals

Slide 8

Slide 8 text

Ease of ... Installation Use Customization Evaluation Metrics

Slide 9

Slide 9 text

Learn Key Editor Features Learn the basics before you copy confusing con gurations

Slide 10

Slide 10 text

Install Useful Text Editor Plugins Discover new plugins and update them on a regular basis

Slide 11

Slide 11 text

Visual Studio Code Open Command Palette: Ctrl+Shift+P IntelliSense: Uses Language Server Protocol Save con guration in the User Settings Remember to download the Python Extension The Basics

Slide 12

Slide 12 text

Enable Black Code Formatting

Slide 13

Slide 13 text

Enable Tab Completion

Slide 14

Slide 14 text

Enable Flake8 Code Linting

Slide 15

Slide 15 text

Vim or Neovim Vim or Neovim in a terminal with tmux Con gure editor through .vimrc or init.vim Install plugins with a plugin manager Add con guration options for plugins The Basics

Slide 16

Slide 16 text

Overview of Vim's Con guration File

Slide 17

Slide 17 text

Useful in both VS Code and Vim pyenv: Download and manage Python versions pipenv: Application deps and virtualenvs pytest: Run test cases and report their status coverage: Track statements and branches Development Tools

Slide 18

Slide 18 text

Con guration and Plugins BOTH SUPPORT PROJECTS AND OFFER MANY PLUGINS, BUT VS CODE IS EASIER TO CONFIGURE

Slide 19

Slide 19 text

Open-source tool to check the work of writers and programmers On GitHub at GatorEducator/gatorgrader pipenv shell: Enter a virtual environment pipenv run test: Run the test suite pipenv run cover: Check for full coverage GatorGrader

Slide 20

Slide 20 text

Install the Application Dependencies

Slide 21

Slide 21 text

Install Application Dependencies

Slide 22

Slide 22 text

Start Your Virtual Environment

Slide 23

Slide 23 text

Selecting a Virtual Environment

Slide 24

Slide 24 text

Start Project in a Virtual Environment

Slide 25

Slide 25 text

Virtual Environments and Package Installation BOTH EFFECTIVELY USE PIPENV TO MANAGE VIRTUALENVS AND APP DEPENDENCIES

Slide 26

Slide 26 text

Let's Start Programming in Python!

Slide 27

Slide 27 text

Calculate Test Suite Coverage Work on an existing code base

Slide 28

Slide 28 text

Terminal command: pipenv run cover

Slide 29

Slide 29 text

99% total coverage 98% coverage test_util.py

Slide 30

Slide 30 text

I thought coverage was 100%? "It is 100%! Wait, what?"

Slide 31

Slide 31 text

Fuzzy File Finding for the Test

Slide 32

Slide 32 text

What's the Problem?

Slide 33

Slide 33 text

Hardcoded Test Variable

Slide 34

Slide 34 text

Let's Fix the Test! Use Pytest's tmpdir test xture

Slide 35

Slide 35 text

Use Pytest's tmpdir xture

Slide 36

Slide 36 text

Wait, this x is still incomplete!

Slide 37

Slide 37 text

View and Act on Flake8 Warning

Slide 38

Slide 38 text

Automated Code Linting BOTH ALLOW MULTIPLE BACKGROUND LINTERS, WITH CUSTOMIZATION DIFFERENCES

Slide 39

Slide 39 text

Code Autocompletion BOTH EDITORS OFFER SUPPORT, WITH TRADE-OFFS IN RELEVANCE AND PERFORMANCE

Slide 40

Slide 40 text

Source Code Formatting

Slide 41

Slide 41 text

Code Formatting BOTH EDITORS CAN LEVERAGE BLACK, BUT VS CODE IS MUCH EASIER TO CONFIGURE

Slide 42

Slide 42 text

Run Test Suites Did we x the hard-coded test?

Slide 43

Slide 43 text

Python Test Explorer

Slide 44

Slide 44 text

Convert tmpdir to a String

Slide 45

Slide 45 text

Run Tests and Coverage

Slide 46

Slide 46 text

Check Test Suite Coverage

Slide 47

Slide 47 text

100% total coverage!

Slide 48

Slide 48 text

Automated Testing BOTH SUPPORT TESTING WELL, BUT OFFER A VERY DIFFERENT USER EXPERIENCE

Slide 49

Slide 49 text

Source Code Highlighting BOTH SUPPORT FAST SYNTAX HIGHLIGHTING, BUT VIM REQUIRES AN EXTRA PLUGIN

Slide 50

Slide 50 text

Text Snippets Save time by using a template for text Autocompletion trigger inserts text

Slide 51

Slide 51 text

Snippet Expansion BOTH EDITORS SUPPORT SNIPPETS, BUT VIM WORKS WELL IN MORE SCENARIOS

Slide 52

Slide 52 text

Try multiple editors! Which one did you like best? Why?

Slide 53

Slide 53 text

VS CODE VIM

Slide 54

Slide 54 text

VS CODE VIM

Slide 55

Slide 55 text

Editing Documentation in Markdown Integration with Git and GitHub Automated source code refactoring Adding and removing dependencies Releasing a Python application to PyPI Learning Opportunities

Slide 56

Slide 56 text

100 likes for a FREE blog post! On all things VS Code and Vim ... ... and what it's like to work as a "Father Daughter Duo"! @GregKapfhammer @MaddyKapfhammer WANT MORE?

Slide 57

Slide 57 text

come on, you can do it it's not that hard! Just 100 Likes

Slide 58

Slide 58 text

Two awesome text editors and a great learning experience! Remember ... 100 likes for a blog post! @GregKapfhammer @MaddyKapfhammer Key Points