Sublime Text Settings for Writing PEP 8 Python
Key Takeaways
Configures Sublime Text for writing PEP 8 compliant Python code
Full Transcript
hey there it's Daniel with another Sublime Text tip for python developers uh today I want to show you a setting that is really helpful if you're writing uh pep 8 compliant code let's say if you're contributing to a code base uh for an open source project that follows the pep8 recommendations um then this is going to be really handy for you so uh pep8 makes some recommendations on the maximum line length for your code uh namely they uh they recommend that for Doc string you should limit yourself to 72 characters and for any other line of code regular line of code it's okay to go up to 79 characters and um there's actually a really helpful feature in Sublime Text which is called the ruler feature you can uh enable and it will place these uh vertical lines here um at the line length that you've specified in in the user preferences so that you will instantly know when you're approaching that limit so I have that first ruler here for my dock strings so I will instantly know okay you know I'm approaching the line length uh better insert a line break here and then for regular lines of code I also have the the second ruler which is going to tell me hey you're going to you're getting close to the 79 uh character limit um careful or you know you want to restructure that a bit um so I find those really helpful and another setting that I've enabled here isbl L Tex word wrap feature so what that does is if you get a line uh of code that is actually longer than the word rap limit which I set to 80 which is um one more than the maximum allowed line length so I don't you know I don't want to wrap lines that are shorter than 80 characters so what happens if I approach that limit is that sube text is going to wrap the line which means that it appears like there are actually several lines here now but you can tell that on the left there are only there's only one line number for for this line which means it's it's uh in actuality it's actually it's one giant super long line and it's not like four different lines so I find this very handy because um that way I can have multiple editor windows open at the same time and I can be sure that as long as my width for that window is longer than 80 characters or at least 80 characters I'm going to be able to see all of the code uh at once without having to scroll horizontally because that just drives me nuts uh I really like to see everything at a glance I want to know what I'm working with so I find these settings um very helpful if you're working with pep8 you know if you're using a modification of Pep 8 let's say if you're if you're bumping up the uh the line length limit in your team then of course feel free to tweak that I've worked on some teams where we used 99 or 109 as the maximum length and and that was that was okay too but if you really want to follow pep8 then these are the settings that you want [Music] um and then you'll end up with a setup like the one I'm showing you cool so give this a shot I think it makes uh life a little bit easier and I hope that was helpful to you okay bye now
Original Description
► Optimize your Python + Sublime Text Setup: https://SublimeTextPython.com
How to configure Sublime Text to help you write PEP 8 compliant Python code. In this video we'll take a quick look at the "rulers" feature in combination with word wrapping.
► Weekly Tips for Python Developers: https://dbader.org/newsletter
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Real Python · Real Python · 11 of 60
1
2
3
4
5
6
7
8
9
10
▶
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
A better Python REPL – bpython vs python interpreter
Real Python
Introducing large-type.com – A Utility Website
Real Python
Reading Hacker News Without Wasting Tons of Time
Real Python
Forward References and Python 3 Type Hints
Real Python
Using Sublime Text as your Git Editor
Real Python
Python Code Linting and Auto-Complete for Sublime Text
Real Python
Make your Python Code More Readable with Custom Exceptions
Real Python
Write Better Tests with Sublime Text's Split Layout Feature
Real Python
How to Use Sublime Text from the Command Line
Real Python
Rename Variables with Multiple Selection in Sublime Text
Real Python
Sublime Text Settings for Writing PEP 8 Python
Real Python
Write Cleaner Python with Sublime Text's Indent Guides
Real Python
Sublime Text Whitespace Settings for Python Development
Real Python
Function Argument Unpacking in Python
Real Python
Python Code Review: Debugging and Refactoring "Conway's Game of Life" + Automated Tests
Real Python
Using "get()" to Return a Default Value from a Python Dict
Real Python
A Python Shorthand for Swapping Two Variables
Real Python
Python Code Review: Refactoring a Web Scraper, PEP 8 Style Guide Compliance, requirements.txt
Real Python
Click & Jump to Test Failures from the Command Line (iTerm2)
Real Python
Setting up Sublime Text for Python Developers
Real Python
Sublime Text + Python Guide Overview
Real Python
Python Code Review: Adding Pytest Tests to an Existing Python Web Scraper
Real Python
Type-Checking Python Programs With Type Hints and mypy
Real Python
A Shorthand for Merging Dictionaries in Python 3.5+
Real Python
Python Code Review Flask Web Security Tutorial + Virtualenvs, requirements.txt
Real Python
My Python Code Looks Ugly and Confusing – Help!
Real Python
Setting Up a Programmer Portfolio/Developer Blog – How To Get Started
Real Python
Do I Need a GitHub/GitLab/Bitbucket Profile as a Developer?
Real Python
Programmer Portfolio – Example and Walkthrough
Real Python
How to Get Your 1st Speaking Gig at a Tech Conference
Real Python
How to Build Your Public Speaking Skills as a Developer
Real Python
The Object-oriented Version of "Spaghetti Code" is "Lasagna Code" ?!
Real Python
Setting up Sublime Text for Python Developers – Lesson #1
Real Python
Cool New Features in Python 3.6
Real Python
"is" vs "==" in Python – What's the Difference? (And When to Use Each)
Real Python
Emulating switch/case Statements in Python with Dictionaries
Real Python
Python Function Argument Unpacking Tutorial (* and ** Operators)
Real Python
What Code Should I Put On My GitHub/GitLab/BitBucket Profile?
Real Python
A Crazy Python Dictionary Expression ?!
Real Python
String Conversion in Python: When to Use __repr__ vs __str__
Real Python
Method Types in Python OOP: @classmethod, @staticmethod, and Instance Methods
Real Python
Optional Arguments in Python With *args and **kwargs
Real Python
Python Context Managers and the "with" Statement (__enter__ & __exit__)
Real Python
Installing Python Packages with pip and virtualenv / venv
Real Python
"For Each" Loops in Python with enumerate() and range()
Real Python
Python Code Review: LibreOffice Automation and the Python Standard Library
Real Python
Managing Python Dependencies With Pip and Virtual Environments – Lesson #1
Real Python
Python Tutorial: List Comprehensions Step-By-Step
Real Python
Leveraging Python's Implicit "return None" Statements
Real Python
What's the meaning of underscores (_ & __) in Python variable names?
Real Python
Python Data Structures: Sets, Frozensets, and Multisets (Bags)
Real Python
Writing automated tests for Python command-line apps and scripts
Real Python
How to find great Python packages on PyPI, the Python Package Repository
Real Python
Immutable vs Mutable Objects in Python
Real Python
PyPI vs Warehouse, the Next-Generation Python Package Repository
Real Python
pep8.org — The Prettiest Way to View the PEP 8 Python Style Guide
Real Python
My Experience at PyCon 2017 in Portland
Real Python
Pylint Tutorial – How to Write Clean Python
Real Python
"Reverse a List in Python" Tutorial: Three Methods & How-to Demos
Real Python
Python Refactoring: "while True" Infinite Loops & The "input" Function
Real Python
More on: Python for Data
View skill →
🎓
Tutor Explanation
DeepCamp AI