Pylint Tutorial - How to Write Clean Python

  Рет қаралды 156,840

Real Python

Real Python

7 жыл бұрын

dbader.org/python-tricks ► Get examples of clean and Pythonic code that passes any Pylint or PEP 8 run.
In this Pylint tutorial video you'll see how to install and set up the Pylint code linter for Python step by step. We'll go over why you should use a code linter like Pylint, Flake8, Pyflakes, or other static analysis tools-and how they can help you write cleaner and more Pythonic code.
Pylint is a well-known static analysis tool for Python 2 and 3. It has a number of useful features, like checking your code for compliance with the PEP 8 Python style guide. It makes sure that your code follows the code style guide and it can also automatically identify common bugs and errors in your Python code.
To set up Pylint you'll first need to install it with the `pip install` command and then you can run it on any Python file with the "pylint" command. Pylint inspects your code and then gives you feedback on it. Besides running Pylint from the command-line you can also integrate it into your editor to get live feedback on your Python code.
In this Pylint tutorial I'm going over the feedback produced by Pylint and I'm taking it to refactor and improve the quality of my code. You can get this setup up and running in a few minutes and it'll quickly help you write better and cleaner Python code.
FREE COURSE - "5 Thoughts on Mastering Python" dbader.org/python-mastery
SUBSCRIBE TO THIS CHANNEL: dbader.org/youtube
* * *
► Python swag: MUGS, SHIRTS & more: nerdlettering.com
FREE Python Tutorials & News:
» Python Tutorials: dbader.org
» Python News on Twitter: / @dbader_org
» Weekly Tips for Pythonistas: dbader.org/newsletter
» Subscribe to this channel: dbader.org/youtube

Пікірлер: 72
@drew4980
@drew4980 6 жыл бұрын
My new favorite python youtuber! Really love how you're bridging the gap between beginner and intermediate. Not many other people do that very well but you're nailing it.
@realpython
@realpython 6 жыл бұрын
Thank you for the kind words! :-)
@noinformationavailable4114
@noinformationavailable4114 5 жыл бұрын
I had so much trouble understanding python until i saw your videos! You turned my crappy unclean and duct taped code into something nice and presentable!!
@realpython
@realpython 5 жыл бұрын
That's great to hear! I'm glad the videos have been helpful to you. :-)
@sepehrnematollahi1151
@sepehrnematollahi1151 2 жыл бұрын
Thanks for putting a little content between all the ads!
@webapplicationguide3798
@webapplicationguide3798 7 жыл бұрын
Thanks Dan for all those tips.
@egimessito
@egimessito Жыл бұрын
read...actually studied your book. Finally going deep is now easy to understand how to go from cs or java to py. Well done and thank you
@JoshEnglish
@JoshEnglish 7 жыл бұрын
The score is based on the number of errors and the number of lines. 10 is "perfect" and there is no lower bound to the score.
@harshmishra8990
@harshmishra8990 4 жыл бұрын
Thanks for such amazing tutorials.
@RobinTheHoodedMan
@RobinTheHoodedMan 6 жыл бұрын
Great video. As a Python noobie I'm still finding out all the wrinkles, and finding out about helpful programming tools, and seeking the 'ultimate' IDE for Python (lol). Succint and to the point, nice one. Now I'm subscribed!!
@realpython
@realpython 6 жыл бұрын
Thanks! I hope I can continue to help you on your journey through Python!
@sergeydeluxe
@sergeydeluxe 4 жыл бұрын
Great tutorial! Thank you!
@tarekhesham5133
@tarekhesham5133 6 жыл бұрын
Thank you very much for these great tips.
@realpython
@realpython 6 жыл бұрын
You're welcome :-)
@shahrokhabbasirad2223
@shahrokhabbasirad2223 5 жыл бұрын
I really enjoyed. This video is AWESOME
@realpython
@realpython 5 жыл бұрын
Thanks for the kind words!
@iaroslavdavydiak6439
@iaroslavdavydiak6439 2 жыл бұрын
Awesome. Thank you!
@satoshinakamoto171
@satoshinakamoto171 5 жыл бұрын
thanks ur great. please keep making videos ...ur helping the community alot with ur helpful videos.
@realpython
@realpython 5 жыл бұрын
Thanks for the kind words!
@philtoa334
@philtoa334 Жыл бұрын
it was time for u to use that 🤣. Thanks really nice vid.
@Zinzin09
@Zinzin09 6 жыл бұрын
Wondering how you edited your terminal window removing the title bar??? Great video! Keep it up with the great content!
@realpython
@realpython 6 жыл бұрын
It's a setting in iTerm2 (remove border or something like that).
@maukaladka4100
@maukaladka4100 2 жыл бұрын
Nice one
@cybersphere
@cybersphere 3 жыл бұрын
If you use Visual Studio Code, Pylint is included by default. You just have to give installation permission. Style errors are then highlighted automagically.
@dineshsadhwani3717
@dineshsadhwani3717 Жыл бұрын
Automagically? You mean automatically?
@cybersphere
@cybersphere Жыл бұрын
@@dineshsadhwani3717 No, automagically. It combines the words automatic and magically and means automatically in a way that seems magical.
@ivanlaplante
@ivanlaplante 2 жыл бұрын
3:26 Could anyone tell me in which context he recommends using vEnv? To install any (surf?) Python tool/dependency?
@malharjajoo7393
@malharjajoo7393 5 жыл бұрын
Nice tutorial.
@realpython
@realpython 5 жыл бұрын
Thanks!
@angelluisgarciaguzman5598
@angelluisgarciaguzman5598 4 жыл бұрын
It just works!
@kennyPAGC
@kennyPAGC 6 жыл бұрын
pylint missed the triple whitespace between the keyword def and the function name crash
@MrVictorock
@MrVictorock 7 жыл бұрын
You should do videos about job interview in python too...for example: What a python developer must know before a job interview?
@youwouldbetterfuckme
@youwouldbetterfuckme 5 жыл бұрын
This question disqualifies a candidate IMHO.
@jamesuejio2787
@jamesuejio2787 4 жыл бұрын
realpython.com/python-coding-interview-tips/ :D We will have a related video walkthrough attached to the video in the next coming months.
@petrockspiracy3120
@petrockspiracy3120 3 жыл бұрын
Can anyone explain to me why I get a mixed-indentation error for using tabs only when I haven't used spaces? If I just use spaces it's okay but surely no one actually types out four spaces... I don't get it. Edit: okay I just did adjusted the option at the bottom right of the window to be spaces and it converts them for you
@sumitkumarsain5542
@sumitkumarsain5542 5 жыл бұрын
Hi Dan. Do u have a playlist for python tutorials!! Thanks, Sumit
@realpython
@realpython 5 жыл бұрын
I have a few playlists available, you can check them out here: kzbin.info/door/I0vQvr9aFn27yR6Ej6n5UAplaylists
@Danny-uq9zf
@Danny-uq9zf 4 жыл бұрын
What shell is that!? Please make a video on installing and customizing that terminal/shell!
@3ckortreat
@3ckortreat 3 жыл бұрын
how did you make your terminal frameless??
@ayushtripathi1125
@ayushtripathi1125 4 жыл бұрын
I know I'm three years late, but I'm new to python and I would appreciate some help. I successfully installed pylint, but when I do "pylint [full path of file name]" command prompt says pylint is not recognized as an internal or external command. Please help, thanks!
@compphysgeek
@compphysgeek 4 жыл бұрын
looks like pylint is not in your path, so you must either update your path variable with the location of pylint or call pylint also with its full path
@VenkateshwaraDoijode
@VenkateshwaraDoijode 3 жыл бұрын
How to save pylint example.py console output to text file ?
@dmytroohorodnik3562
@dmytroohorodnik3562 4 жыл бұрын
You can run "pylint pylint" :)
@malic_zarith
@malic_zarith 5 жыл бұрын
I have a question. A bunch of people say to work 6 hours a day if one wants to learn programming for a job. I only work four hours a day. This includes also working 4 hours on weekends. Is that enough, or should I start doing 6?
@realpython
@realpython 5 жыл бұрын
Yes, that is enough. Some people only manage about an hour a day, as long as you are consistent with it, you will find yourself progressing.
@malic_zarith
@malic_zarith 5 жыл бұрын
@@realpython Ok that's good
@banderilllero
@banderilllero 4 жыл бұрын
so is this equivalent to Misra checker?
@lumed2189
@lumed2189 4 жыл бұрын
Pylint👍👍😍
@vaneakatok
@vaneakatok 4 жыл бұрын
I can't find a way, I mean a video on generating UMLs Do you have are intend to do any?
@ArturdeSousaRocha
@ArturdeSousaRocha 4 жыл бұрын
Personally I prefer to leave pylint as it is and only disable specific messages to indicate that I had a good reason to do something and it's not an error. Interestingly, VS Code disables almost all pylint messages by default.
@elhamzeinodini4828
@elhamzeinodini4828 3 жыл бұрын
💥💥💥
@inftertainment
@inftertainment 5 жыл бұрын
Running ‘pip install pylint’ in terminal gets me nothing but ‘-bash: pip: command not found’
@KishoreKumar-is3qn
@KishoreKumar-is3qn 5 жыл бұрын
install pip
@AtlantaTerry
@AtlantaTerry 4 жыл бұрын
@@KishoreKumar-is3qn thanks, but noobs might not know how.
@EnglishRain
@EnglishRain 3 жыл бұрын
13:00 - didn't realize we had to uppercase base level variables.
@bfdhtfyjhjj
@bfdhtfyjhjj 3 жыл бұрын
Hes wrong. You need to use uppercase because its not variable, its a constat.
@EnglishRain
@EnglishRain 3 жыл бұрын
@@bfdhtfyjhjj Thanks for correcting me.
@amberlong1354
@amberlong1354 4 жыл бұрын
me too.
@atefehnasiran1294
@atefehnasiran1294 3 жыл бұрын
I wanted to pylint one of my files butvI had SyntaxError: invalid syntax what can I do?
@vighnesh153
@vighnesh153 5 жыл бұрын
Or use PyCharm
@vighnesh153
@vighnesh153 3 жыл бұрын
@Peter Mortensen it has builtin pep8 checks.
@swadhikarc7858
@swadhikarc7858 4 жыл бұрын
Line 14 has more spaces between def and function name, still a perfect code 😂
@budi0580
@budi0580 2 жыл бұрын
Is this tutorial still relevant today ?
@Albin_Evald
@Albin_Evald 4 жыл бұрын
after watching for 17 minutes, 17:07.... DOH
@jimgolab536
@jimgolab536 2 жыл бұрын
Lint = Lexical Interpreter.
@CryptoPi_314
@CryptoPi_314 4 жыл бұрын
If possible can you plz. make a video on 'Design Patterns with Python': en.wikipedia.org/wiki/Design_Patterns#Patterns_by_Type :)
@gshan994
@gshan994 Жыл бұрын
Arjan codes is a youtube channel to check for design patterns with python
@oxygenist
@oxygenist 3 жыл бұрын
.
@yuverris
@yuverris 3 жыл бұрын
nice pylint ruined my whole day
@jonathanmoore5619
@jonathanmoore5619 3 жыл бұрын
Concentrate on creating... Python... Literally the snake eating it's own tail...
@jonathanmoore5619
@jonathanmoore5619 3 жыл бұрын
@Peter Mortensen I rest my case... Some make, some check, some do nothing at all.
Powerful VSCode Tips And Tricks For Python Development And Design
15:50
Mastering Python Code Quality with Pylint
14:44
NeuralNine
Рет қаралды 24 М.
Is it Cake or Fake ? 🍰
00:53
A4
Рет қаралды 17 МЛН
UFC 302 : Махачев VS Порье
02:54
Setanta Sports UFC
Рет қаралды 1,4 МЛН
11 Tips And Tricks To Write Better Python Code
11:00
Patrick Loeber
Рет қаралды 601 М.
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,7 МЛН
Python Decorators in 15 Minutes
15:14
Kite
Рет қаралды 424 М.
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 259 М.
How To Write Unit Tests in Python • Pytest Tutorial
35:34
pixegami
Рет қаралды 128 М.
Python Lint and Formatters - Flake8
27:16
Very Academy
Рет қаралды 3,3 М.
How To Write Cleaner Code - A Practical Example
24:45
Tech With Tim
Рет қаралды 84 М.
Make Your Python Code More Professional
19:43
NeuralNine
Рет қаралды 58 М.
10 Python Tips and Tricks For Writing Better Code
39:21
Corey Schafer
Рет қаралды 1,3 МЛН
Is it Cake or Fake ? 🍰
00:53
A4
Рет қаралды 17 МЛН