Find Your Feature Fit How to pick a text editor for Python - - PowerPoint PPT Presentation

find your feature fit
SMART_READER_LITE
LIVE PREVIEW

Find Your Feature Fit How to pick a text editor for Python - - PowerPoint PPT Presentation

Find Your Feature Fit How to pick a text editor for Python programming Gregory M. Kapfhammer Madelyn M. Kapfhammer PyOhio 2019 Hi! Glad to be Back at PyOhio! GREGORY M. KAPFHAMMER @GregKapfhammer www.gregorykapfhammer.com Hello! It's Great


slide-1
SLIDE 1

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

@GregKapfhammer www.gregorykapfhammer.com

Hi! Glad to be Back at PyOhio!

GREGORY M. KAPFHAMMER

slide-3
SLIDE 3

@MaddyKapfhammer www.madelynkapfhammer.com

Hello! It's Great to Meet You! MADELYN M. KAPFHAMMER

slide-4
SLIDE 4

Developer Productivity Programming Fun Effective Code

Why Care About a Text Editor?

slide-5
SLIDE 5

VS CODE VIM

slide-6
SLIDE 6

A FAST PACED FIELD

slide-7
SLIDE 7

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

Key Goals

slide-8
SLIDE 8

Ease of ... Installation Use Customization

Evaluation Metrics

slide-9
SLIDE 9

Learn Key Editor Features

Learn the basics before you copy confusing congurations

slide-10
SLIDE 10

Install Useful Text Editor Plugins

Discover new plugins and update them on a regular basis

slide-11
SLIDE 11

Visual Studio Code

Open Command Palette: Ctrl+Shift+P IntelliSense: Uses Language Server Protocol Save conguration in the User Settings Remember to download the Python Extension

The Basics

slide-12
SLIDE 12

Enable Black Code Formatting

slide-13
SLIDE 13

Enable Tab Completion

slide-14
SLIDE 14

Enable Flake8 Code Linting

slide-15
SLIDE 15

Vim or Neovim

Vim or Neovim in a terminal with tmux Congure editor through .vimrc or init.vim Install plugins with a plugin manager Add conguration options for plugins

The Basics

slide-16
SLIDE 16

Overview of Vim's Conguration File

slide-17
SLIDE 17

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

Conguration and Plugins

BOTH SUPPORT PROJECTS AND OFFER MANY PLUGINS, BUT VS CODE IS EASIER TO CONFIGURE

slide-19
SLIDE 19

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

Install the

Application Dependencies

slide-21
SLIDE 21

Install Application Dependencies

slide-22
SLIDE 22

Start Your

Virtual Environment

slide-23
SLIDE 23

Selecting a Virtual Environment

slide-24
SLIDE 24

Start Project in a Virtual Environment

slide-25
SLIDE 25

Virtual Environments and Package Installation

BOTH EFFECTIVELY USE PIPENV TO MANAGE VIRTUALENVS AND APP DEPENDENCIES

slide-26
SLIDE 26

Let's Start

Programming in Python!

slide-27
SLIDE 27

Calculate Test

Suite Coverage

Work on an existing code base

slide-28
SLIDE 28

Terminal command: pipenv run cover

slide-29
SLIDE 29

99% total coverage 98% coverage test_util.py

slide-30
SLIDE 30

I thought

coverage was 100%?

"It is 100%! Wait, what?"

slide-31
SLIDE 31

Fuzzy File Finding for the Test

slide-32
SLIDE 32

What's the Problem?

slide-33
SLIDE 33

Hardcoded Test Variable

slide-34
SLIDE 34

Let's Fix the Test!

Use Pytest's tmpdir test xture

slide-35
SLIDE 35

Use Pytest's tmpdir xture

slide-36
SLIDE 36

Wait, this x

is still incomplete!

slide-37
SLIDE 37

View and Act on Flake8 Warning

slide-38
SLIDE 38

Automated Code Linting

BOTH ALLOW MULTIPLE BACKGROUND LINTERS, WITH CUSTOMIZATION DIFFERENCES

slide-39
SLIDE 39

Code Autocompletion

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

slide-40
SLIDE 40

Source Code Formatting

slide-41
SLIDE 41

Code Formatting

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

slide-42
SLIDE 42

Run Test Suites

Did we x the hard-coded test?

slide-43
SLIDE 43

Python Test Explorer

slide-44
SLIDE 44

Convert tmpdir to a String

slide-45
SLIDE 45

Run Tests and Coverage

slide-46
SLIDE 46

Check Test Suite Coverage

slide-47
SLIDE 47

100% total coverage!

slide-48
SLIDE 48

Automated Testing

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

slide-49
SLIDE 49

Source Code Highlighting

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

slide-50
SLIDE 50

Text Snippets

Save time by using a template for text

Autocompletion trigger inserts text

slide-51
SLIDE 51

Snippet Expansion

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

slide-52
SLIDE 52

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

slide-53
SLIDE 53

VS CODE VIM

slide-54
SLIDE 54

VS CODE VIM

slide-55
SLIDE 55

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

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

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

Just 100 Likes

slide-58
SLIDE 58

Two awesome text editors and a great learning experience!

Remember ... 100 likes for a blog post!

@GregKapfhammer @MaddyKapfhammer

Key Points