{"id":21413,"date":"2022-03-25T13:39:45","date_gmt":"2022-03-25T08:09:45","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=21413"},"modified":"2024-01-01T14:34:36","modified_gmt":"2024-01-01T09:04:36","slug":"black-git","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/black-git\/","title":{"rendered":"Introduction to Black Formatter for Python | Git Integration"},"content":{"rendered":"\n<p>In the following article, you will learn about the importance of code formatting, Black formatter, the history of Black on git, its major contributors. You will also learn how to integrate Black to popular code editors and use Black in pre-commit hooks.<\/p>\n\n\n\n<p>Writing efficient and effective code is a required skill for any programmer\/developer. However, one&#8217;s task doesn&#8217;t end after ensuring that their code is running accordingly. Proper formatting of the code is equally necessary. <\/p>\n\n\n\n<p>Often, novice developers overlook <strong>formatting<\/strong> and, ultimately, <strong>readability<\/strong>. Readability is not a concern in small programs or projects where lines of code are few. In large projects, it will become a nightmare for the team members without proper formatting.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Pythons_PEP-8\" >Python&#8217;s PEP-8<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Introducing_Black_Git_Repository\" >Introducing Black Git Repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/black-git\/#History_of_Black_development_on_Git\" >History of Black development on Git<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Top_contributers_of_Black_on_Git\" >Top contributers of Black on Git<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Installation\" >Installation<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Installing_Black_using_pip\" >Installing Black using pip<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Installing_Black_from_Git\" >Installing Black from Git<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Using_Black_Python_formatter\" >Using Black Python formatter<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Formatting_a_single_py_file\" >Formatting a single .py file<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Formatting_multiple_py_files_stored_in_a_folder\" >Formatting multiple .py files stored in a folder<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Black_Git_Version_Control_Integration\" >Black Git Version Control Integration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Adding_Black_to_VSCode\" >Adding Black to VSCode<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Adding_Black_to_Jupyter_notebook\" >Adding Black to Jupyter notebook<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pythonpool.com\/black-git\/#FAQs_on_Black_Formatter_for_Python\" >FAQs on Black Formatter for Python<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.pythonpool.com\/black-git\/#Trending_Python_Articles\" >Trending Python Articles<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-python-s-pep-8\"><span class=\"ez-toc-section\" id=\"Pythons_PEP-8\"><\/span>Python&#8217;s PEP-8 <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong><a href=\"https:\/\/peps.python.org\/pep-0008\/\" target=\"_blank\" rel=\"noreferrer noopener\">PEP-8<\/a><\/strong>(Python Enhancement Proposal 8) is a list of guidelines and best practices for writing effective Python code. Written by Guido van Rossum, Barry Warsaw, and Nick Coghlan and aimed to make python codes consistent and readable. <\/p>\n\n\n\n<p>So you might ask, will following python&#8217;s pep-8 guide solve the problem? The answer would be yes and no. Let&#8217;s elaborate on this with an example.<\/p>\n\n\n\n<p>PEP-8 has guidelines for creating a list. Let&#8217;s look at them.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n# first way\nnaruto_characters = &#x5B;'sasuke', 'itachi', 'kakashi', 'hashirama', 'madara', 'orochimaru']\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n# another acceptable way\nnaruto_characters = &#x5B;\n  'sasuke', 'itachi',\n  'kakashi', 'hashirama',\n  'madara', 'orochimaru'\n]\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n# yet another acceptable way\nnaruto_characters = &#x5B;\n  'sasuke',\n  'itachi',\n  'kakashi',\n  'hashirama',\n  'madara',\n  'orochimaru'\n]\n<\/pre><\/div>\n\n\n<p>All the above ways are acceptable according to the PEP-8 guidelines. It is important to realize if you are in a team where each person uses a different style then there won&#8217;t be consistency in the codebase. Moreover, it might even lead to an argument trying to prove which method is the best or more pythonic than the other.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"519\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/headway-5QgIuuBxKwM-unsplash-1-1024x519.jpg\" alt=\"Python's PEP-8 \" class=\"wp-image-21423\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/headway-5QgIuuBxKwM-unsplash-1-1024x519.jpg 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/headway-5QgIuuBxKwM-unsplash-1-300x152.jpg 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/headway-5QgIuuBxKwM-unsplash-1-768x389.jpg 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/headway-5QgIuuBxKwM-unsplash-1-1536x778.jpg 1536w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/headway-5QgIuuBxKwM-unsplash-1-scaled.jpg 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Photo by&nbsp;<a href=\"https:\/\/unsplash.com\/@headwayio?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Headway<\/a>&nbsp;on&nbsp;<a href=\"https:\/\/unsplash.com\/s\/photos\/argument?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<p>The bottom line is that in large projects, there should be consistency in formatting, which in turn would lead to better readability. How can we ensure that each team member adheres to proper formatting? <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-introducing-black-git-repository\"><span class=\"ez-toc-section\" id=\"Introducing_Black_Git_Repository\"><\/span>Introducing Black Git Repository<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The answer is Black, a third-party formatter. <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>&#8220;Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting. You will save time and mental energy for more important matters.&#8221;<\/p>\n<cite>From documentation of Black<\/cite><\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"375\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/logo2-readme-1024x375.png\" alt=\"Black Git Logo\" class=\"wp-image-21426\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/logo2-readme-1024x375.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/logo2-readme-300x110.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/logo2-readme-768x282.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/logo2-readme.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">The black logo is heavily inspired by Ford.<\/figcaption><\/figure>\n\n\n\n<p>Black follows PEP-8 guidelines staunchly. In other words it doesn&#8217;t make any compromises. It does its job quickly and effectively, increasing readability and maintaining overall consistency in the code.<\/p>\n\n\n\n<p>Black is used by many popular open-source projects like &#8211; pytest, Pyramid, Django, SQLAlchemy, Poetry, PyPA applications (Warehouse, Bandersnatch, Pipenv, virtualenv), pandas, to name a few.<\/p>\n\n\n\n<p>The following organizations use&nbsp;<em>Black<\/em>: Facebook, Dropbox, KeepTruckin, Mozilla, Quora, Duolingo, QuantumBlack, Tesla.<\/p>\n\n\n\n<p><strong>Note:<\/strong> You can try out Black formatter at the <strong><a href=\"https:\/\/black.vercel.app\/\" target=\"_blank\" rel=\"noreferrer noopener\">black playground<\/a><\/strong> and also read about Black code style from <a href=\"https:\/\/black.readthedocs.io\/en\/stable\/the_black_code_style\/current_style.html\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>here<\/strong><\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-history-of-black-development-on-git\"><span class=\"ez-toc-section\" id=\"History_of_Black_development_on_Git\"><\/span>History of Black development on Git<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The development of Black formatter on git started in the year 2018, described as &#8220;The uncompromising Python code formatter&#8221;. The first version was in the alpha stage. In the alpha stage, the program is tested by the developer using white-box techniques.<\/p>\n\n\n\n<p>Here are some major changes in the Black formatter&#8217;s development on git.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"997\" height=\"231\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-50.png\" alt=\"First version 18.3a0\" class=\"wp-image-21488\" style=\"width:705px;height:163px\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-50.png 997w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-50-300x70.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-50-768x178.png 768w\" sizes=\"(max-width: 997px) 100vw, 997px\" \/><figcaption class=\"wp-element-caption\">The first alpha version 18.3a0<\/figcaption><\/figure>\n\n\n\n<p>Jupyter notebook support was added in version 21.12b0. This version fully supported <span style=\"text-decoration: underline;\"><strong><a href=\"http:\/\/www.pythonpool.com\/how-to-check-python-version\/\" target=\"_blank\" rel=\"noreferrer noopener\">python&#8217;s version<\/a><\/strong><\/span> 3.10.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"965\" height=\"315\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-51.png\" alt=\"This version introduced support for Jupyter notebook.\" class=\"wp-image-21494\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-51.png 965w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-51-300x98.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-51-768x251.png 768w\" sizes=\"(max-width: 965px) 100vw, 965px\" \/><figcaption class=\"wp-element-caption\">This version introduced support for the Jupyter notebook<\/figcaption><\/figure>\n\n\n\n<p>The first stable release of Black on git is 22.1.0. All the versions before this were either in alpha or beta stages. In version 22.1.0, support for python2 has been discontinued.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"320\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-33-1024x320.png\" alt=\"\" class=\"wp-image-21489\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-33-1024x320.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-33-300x94.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-33-768x240.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-33.png 1036w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">The first stable version of Black on git 22.1.0 <\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-top-contributers-of-black-on-git\"><span class=\"ez-toc-section\" id=\"Top_contributers_of_Black_on_Git\"><\/span>Top contributers of Black on Git<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The creator of Black is <strong><a href=\"https:\/\/github.com\/ambv\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">\u0141ukasz Langa<\/a>. He<\/strong> is a CPython Developer in Residence and Python 3.8, 3.9 release manager.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"460\" height=\"460\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/55281.jpeg\" alt=\"\u0141ukasz Langa, creater of Black\" class=\"wp-image-21495\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/55281.jpeg 460w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/55281-300x300.jpeg 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/55281-150x150.jpeg 150w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><figcaption class=\"wp-element-caption\">\u0141ukasz Langa, creater of Black<\/figcaption><\/figure><\/div>\n\n\n<p>At the time of publishing of this article, there are currently 302 developers working together to improve, update and add new features to Black formatter on git. Here are some top contributors.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/ambv\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">\u0141ukasz Langa<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/ichard26\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Richard Si<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/zsol\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Zsolt Dollenstein<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/JelleZijlstra\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Jelle Zijlstra<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/cooperlees\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Cooper Lees<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/hugovk\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Hugo van Kemenade<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/isidentical\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Batuhan Taskaya<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/MarcoGorelli\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Marco Edward Gorelli<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-installation\"><span class=\"ez-toc-section\" id=\"Installation\"><\/span>Installation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Installation of Black is pretty straightforward.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-installing-black-using-pip\"><span class=\"ez-toc-section\" id=\"Installing_Black_using_pip\"><\/span>Installing Black using pip<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install black<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-installing-black-from-git\"><span class=\"ez-toc-section\" id=\"Installing_Black_from_Git\"><\/span>Installing Black from Git<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you want to want the latest version of Black, then you can run the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install git+https:\/\/github.com\/psf\/black<\/code><\/pre>\n\n\n<div class=\"monsterinsights-inline-popular-posts monsterinsights-inline-popular-posts-lima monsterinsights-popular-posts-styled\" ><div class=\"monsterinsights-inline-popular-posts-image\"><a href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-cant-compare-datetime-datetime-to-datetime-date\/\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_.webp 1200w \" alt=\"[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date\" \/><\/a><\/div><div class=\"monsterinsights-inline-popular-posts-text\"><span class=\"monsterinsights-inline-popular-posts-label\" >Trending<\/span><div class=\"monsterinsights-inline-popular-posts-post\"><a class=\"monsterinsights-inline-popular-posts-title\"  href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-cant-compare-datetime-datetime-to-datetime-date\/\">[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date<\/a><\/div><\/div><\/div><p><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-using-black-python-formatter\"><span class=\"ez-toc-section\" id=\"Using_Black_Python_formatter\"><\/span>Using Black Python formatter <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Now that Black is installed in your system, let&#8217;s get familiar with its works.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-formatting-a-single-py-file\"><span class=\"ez-toc-section\" id=\"Formatting_a_single_py_file\"><\/span>Formatting a single .py file<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Syntax: black &lt;filename&gt;<\/strong><\/p>\n\n\n\n<p>We have created a py script named test.py and as you can see, it is badly formatted. Let&#8217;s format it using Black.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport random\nnaruto_characters = &#x5B;\n  'sasuke',\n   'itachi',\n  'kakashi', 'hashirama',\n  'madara', \n  'orochimaru'\n]\ndef character_selected(char_list:list):\n\tcharacter = random.choice(char_list)\n\tprint(f&quot;Hello, {character}&quot;)\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-code\"><code> black test.py<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"179\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-48-1024x179.png\" alt=\"1 file reformatted using Black git python formatter\" class=\"wp-image-21438\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-48-1024x179.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-48-300x52.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-48-768x134.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-48-1536x268.png 1536w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-48.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">1 file reformatted using Black python formatter<\/figcaption><\/figure>\n\n\n\n<p>Code below is the reformatted code by Black.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport random\n\nnaruto_characters = &#x5B;&quot;sasuke&quot;, &quot;itachi&quot;, &quot;kakashi&quot;, &quot;hashirama&quot;, &quot;madara&quot;, &quot;orochimaru&quot;]\n\n\ndef character_selected(char_list: list):\n    character = random.choice(char_list)\n    print(f&quot;Hello, {character}&quot;)\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-formatting-multiple-py-files-stored-in-a-folder\"><span class=\"ez-toc-section\" id=\"Formatting_multiple_py_files_stored_in_a_folder\"><\/span>Formatting multiple .py files stored in a folder<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Syntax: black &lt;foldername&gt;\\<\/strong><\/p>\n\n\n\n<p>Black python formatter can easily reformat multiple python files stored inside a folder. Let&#8217;s look at how we can do so.<\/p>\n\n\n\n<p>We have multiple python files stored in a folder named Sorting, which is needed to be reformatted.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"267\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/5-11-1024x267.png\" alt=\"Multiple python files to be reformatted\" class=\"wp-image-21442\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/5-11-1024x267.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/5-11-300x78.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/5-11-768x200.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/5-11-1536x400.png 1536w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/5-11-2048x534.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Multiple python files to be reformatted<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>black Sorting\\<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"288\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-31-1024x288.png\" alt=\"All the .py files reformatted by Black \" class=\"wp-image-21444\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-31-1024x288.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-31-300x84.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-31-768x216.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-31-1536x433.png 1536w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-31-2048x577.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">All the .py files reformatted by Black <\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-black-git-version-control-integration\"><span class=\"ez-toc-section\" id=\"Black_Git_Version_Control_Integration\"><\/span>Black Git Version Control Integration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Integrating Black to version control will save time and will remove all the hassle of remembering to reformat your code before committing it to a repository. Git hooks run before every commit. We can simply add Black to the pre-commit configuration, then Black will reformat our code before every commit. <\/p>\n\n\n\n<p>Let&#8217;s look at how we can achieve this before that install pre-commit using <code>pip install pre-commit<\/code>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n#unformatted code\nfrom collections import deque\ngraph = {&quot;a&quot;: &#x5B;&quot;c&quot;, &quot;b&quot;], \n&quot;b&quot;: &#x5B;&quot;d&quot;],\n &quot;c&quot;: &#x5B;&quot;e&quot;], &quot;d&quot;: &#x5B;&quot;f&quot;],\n  &quot;e&quot;: &#x5B;], &quot;f&quot;: &#x5B;]}\ndef bfs(graph, source):\n    queue = deque()\n    queue.append(source)\n    while len(queue) &gt; 0:\n        current = queue.popleft()\n        print(current)\n        for neighbour in graph&#x5B;current]:\n            queue.append(neighbour)\n\nbfs(graph, &quot;a&quot;)\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Firstly, create a folder named <strong>test_dir<\/strong> which contains unformatted <strong>test.py<\/strong>. <\/li>\n\n\n\n<li>Intialize it using <code>git init<\/code> command.<\/li>\n\n\n\n<li>Then create a file named <strong>.pre-commit-config.yaml<\/strong> and paste the following content inside it.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>repos:\n-   repo: https:\/\/github.com\/ambv\/black\n    rev: 21.9b0\n    hooks:\n    - id: black\n      language: python\n      types: &#91;python]<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After that run <code>pre-commit install<\/code> in the terminal.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"174\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-49-1024x174.png\" alt=\"Initializing and using pre-commit black git \" class=\"wp-image-21448\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-49-1024x174.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-49-300x51.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-49-768x131.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-49.png 1088w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Initializing and using pre-commit <\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This will create a pre-commit file in the .git hooks folder.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"280\" height=\"464\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-32.png\" alt=\"pre-commit file created on using pre-commit install black git\" class=\"wp-image-21450\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-32.png 280w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-32-181x300.png 181w\" sizes=\"(max-width: 280px) 100vw, 280px\" \/><figcaption class=\"wp-element-caption\">pre-commit file created on using pre-commit install<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Then add files for commiting and commit it using some message.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"303\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/7-3-1024x303.png\" alt=\"Black formatter formatting using git hooks\" class=\"wp-image-21453\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/7-3-1024x303.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/7-3-300x89.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/7-3-768x228.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/7-3.png 1080w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Black formatter formatting using git hooks<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Note:<\/strong> <em>Since black has made changes to the test.py file, you will have to add files again and commit.<\/em><\/li>\n\n\n\n<li>The last step is to push the files to github.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"168\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/9-1-1024x168.png\" alt=\"push the files to github\" class=\"wp-image-21454\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/9-1-1024x168.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/9-1-300x49.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/9-1-768x126.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/9-1.png 1199w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Formatted file pushed to GitHub<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"938\" height=\"495\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/10.png\" alt=\"Formatted test.py\" class=\"wp-image-21455\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/10.png 938w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/10-300x158.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/10-768x405.png 768w\" sizes=\"(max-width: 938px) 100vw, 938px\" \/><figcaption class=\"wp-element-caption\">Formatted test.py<\/figcaption><\/figure>\n\n\n<div class=\"monsterinsights-inline-popular-posts monsterinsights-inline-popular-posts-golf monsterinsights-popular-posts-styled\" ><div class=\"monsterinsights-inline-popular-posts-text\"><span class=\"monsterinsights-inline-popular-posts-label\" >Popular now<\/span><span class=\"monsterinsights-inline-popular-posts-border\" ><\/span><span class=\"monsterinsights-inline-popular-posts-border-2\" ><\/span><div class=\"monsterinsights-inline-popular-posts-post\"><a class=\"monsterinsights-inline-popular-posts-title\"  href=\"https:\/\/www.pythonpool.com\/fixed-nameerror-name-unicode-is-not-defined\/\">[Fixed] nameerror: name Unicode is not defined<\/a><\/div><\/div><\/div><p><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-adding-black-to-vscode\"><span class=\"ez-toc-section\" id=\"Adding_Black_to_VSCode\"><\/span>Adding Black to VSCode<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In order to add Black Python formatter to the vs code you will need to follow these steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Make sure you have Black installed on you system.<\/li>\n\n\n\n<li>Open vscode extensions and install python extension.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"225\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-47-1024x225.png\" alt=\"Python extension by Microsoft\" class=\"wp-image-21428\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-47-1024x225.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-47-300x66.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-47-768x169.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/1-47.png 1119w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Python extension by Microsoft<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Once done with that, open settings and then open settings.json file.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"259\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Untitled-design-1024x259.png\" alt=\"Opening settings.json\" class=\"wp-image-21429\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Untitled-design-1024x259.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Untitled-design-300x76.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Untitled-design-768x194.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Untitled-design.png 1056w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Opening settings.json<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add the lines below in the settings.json and then save it. <\/li>\n\n\n\n<li>Check path of Black using <code>which black<\/code> and paste against the <code>\"python.formatting.blackPath\"<\/code>.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\"python.formatting.provider\": \"black\",\n\"python.formatting.blackPath\": \"\/home\/&lt;user_name&gt;\/.local\/bin\/black\",\n\"editor.formatOnSave\": false,\n\"&#91;python]\": {\n    \"editor.formatOnSave\": true,\n},<\/code><\/pre>\n\n\n\n<p>Voila, you have successfully added Black to the vs code editor. On using <strong>Ctrl + S<\/strong>, Black will format your python script.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-adding-black-to-jupyter-notebook\"><span class=\"ez-toc-section\" id=\"Adding_Black_to_Jupyter_notebook\"><\/span>Adding Black to Jupyter notebook<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In order to add Black Python formatter to the jupyter notebook you will need to follow these steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Firstly run these commands, simply paste them in the terminal and hit enter.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>jupyter nbextension install https:\/\/github.com\/drillan\/jupyter-black\/archive\/master.zip --user\njupyter nbextension enable jupyter-black-master\/jupyter-black<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Now, when you will run any jupyter notebook you will see Black button in the header section.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"177\" src=\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-30-1024x177.png\" alt=\"\" class=\"wp-image-21434\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-30-1024x177.png 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-30-300x52.png 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-30-768x133.png 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/2-30.png 1029w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now with Black installed in your jupyter notebook you can easily format code. Simply click on the cell that is needed to be formatted and then click on the Black button.<\/p>\n\n\n<div class=\"monsterinsights-inline-popular-posts monsterinsights-inline-popular-posts-beta monsterinsights-popular-posts-styled\" ><div class=\"monsterinsights-inline-popular-posts-image\"><a href=\"https:\/\/www.pythonpool.com\/solved-runtimeerror-cuda-error-invalid-device-ordinal\/\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal.webp 1200w \" alt=\"[Solved] runtimeerror: cuda error: invalid device ordinal\" \/><\/a><\/div><div class=\"monsterinsights-inline-popular-posts-text\"><span class=\"monsterinsights-inline-popular-posts-label\" >Trending<\/span><div class=\"monsterinsights-inline-popular-posts-post\"><a class=\"monsterinsights-inline-popular-posts-title\"  href=\"https:\/\/www.pythonpool.com\/solved-runtimeerror-cuda-error-invalid-device-ordinal\/\">[Solved] runtimeerror: cuda error: invalid device ordinal<\/a><\/div><\/div><\/div><p><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-faqs-on-black-formatter-for-python\"><span class=\"ez-toc-section\" id=\"FAQs_on_Black_Formatter_for_Python\"><\/span>FAQs on Black Formatter for Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1648100294238\"><strong class=\"schema-faq-question\">Does Black formatter follow PEP-8 guidelines?<\/strong> <p class=\"schema-faq-answer\">Black follows PEP-8 guidelines staunchly in other words it doesn&#8217;t make any compromises. It does its job quickly and effectively hence, increasing readability and maintaining overall consistency in the code.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1648100977032\"><strong class=\"schema-faq-question\">Is Black better than Flake-8?<\/strong> <p class=\"schema-faq-answer\">Flake-8 only suggests changes that should be made to make our code PEP-8 compliant while Black is the uncompromising Python code formatter, does all the formatting automatically in accordance with PEP-8.<\/p> <\/div> <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Black Python formatter is a very useful library that not only saves us time but also makes our code consistent and readable. Moreover, we can also integrate Black with code editors and git version control.<\/p>\n\n\n\n<p>Mike Bayer, the author of SQLAlchemy describes it best &#8211; <em>&#8220;I can&#8217;t think of any single tool in my entire programming career that has given me a bigger productivity increase by its introduction. I can now do refactorings in about 1% of the keystrokes that it would have taken me previously when we had no way for code to format itself&#8221;<\/em>. <\/p>\n\n\n<div class=\"monsterinsights-widget-popular-posts monsterinsights-widget-popular-posts-delta monsterinsights-popular-posts-styled monsterinsights-widget-popular-posts-columns-2\"><h2 class=\"monsterinsights-widget-popular-posts-widget-title\"><span class=\"ez-toc-section\" id=\"Trending_Python_Articles\"><\/span>Trending Python Articles<span class=\"ez-toc-section-end\"><\/span><\/h2><ul class=\"monsterinsights-widget-popular-posts-list\"><li ><a href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-cant-compare-datetime-datetime-to-datetime-date\/\"><div class=\"monsterinsights-widget-popular-posts-image\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_.webp 1200w \" alt=\"[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date\" \/><\/div><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" >[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><span class=\"monsterinsights-widget-popular-posts-author\">by Namrata Gulati<\/span><span>&#9679;<\/span><span class=\"monsterinsights-widget-popular-posts-date\">January 11, 2024<\/span><\/div><\/div><\/a><\/li><li ><a href=\"https:\/\/www.pythonpool.com\/fixed-nameerror-name-unicode-is-not-defined\/\"><div class=\"monsterinsights-widget-popular-posts-image\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-nameerror-name-Unicode-is-not-defined.webp 1200w \" alt=\"[Fixed] nameerror: name Unicode is not defined\" \/><\/div><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" >[Fixed] nameerror: name Unicode is not defined<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><span class=\"monsterinsights-widget-popular-posts-author\">by Namrata Gulati<\/span><span>&#9679;<\/span><span class=\"monsterinsights-widget-popular-posts-date\">January 2, 2024<\/span><\/div><\/div><\/a><\/li><li ><a href=\"https:\/\/www.pythonpool.com\/solved-runtimeerror-cuda-error-invalid-device-ordinal\/\"><div class=\"monsterinsights-widget-popular-posts-image\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal.webp 1200w \" alt=\"[Solved] runtimeerror: cuda error: invalid device ordinal\" \/><\/div><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" >[Solved] runtimeerror: cuda error: invalid device ordinal<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><span class=\"monsterinsights-widget-popular-posts-author\">by Namrata Gulati<\/span><span>&#9679;<\/span><span class=\"monsterinsights-widget-popular-posts-date\">January 2, 2024<\/span><\/div><\/div><\/a><\/li><li ><a href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-type-numpy-ndarray-doesnt-define-__round__-method\/\"><div class=\"monsterinsights-widget-popular-posts-image\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Fixed-typeerror-type-numpy.ndarray-doesnt-define-__round__-method.webp 1200w \" alt=\"[Fixed] typeerror: type numpy.ndarray doesn&#8217;t define __round__ method\" \/><\/div><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" >[Fixed] typeerror: type numpy.ndarray doesn&#8217;t define __round__ method<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><span class=\"monsterinsights-widget-popular-posts-author\">by Namrata Gulati<\/span><span>&#9679;<\/span><span class=\"monsterinsights-widget-popular-posts-date\">January 2, 2024<\/span><\/div><\/div><\/a><\/li><\/ul><\/div><p><\/p>","protected":false},"excerpt":{"rendered":"<p>In the following article, you will learn about the importance of code formatting, Black formatter, the history of Black on git, its major contributors. You &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Introduction to Black Formatter for Python | Git Integration\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/black-git\/#more-21413\" aria-label=\"More on Introduction to Black Formatter for Python | Git Integration\">Read more<\/a><\/p>\n","protected":false},"author":29,"featured_media":21561,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15],"tags":[5049,5050,5045,5051,5046,5047,5048],"class_list":["post-21413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-black-python-formatter-vscode","tag-github-black-python-formatter","tag-python-black-formatter","tag-python-black-formatter-install-offline","tag-python-black-formatter-online","tag-python-black-formatter-vscode","tag-vscode-python-black-formatter","infinite-scroll-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v25.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Introduction to Black Formatter for Python | Git Integration - Python Pool<\/title>\n<meta name=\"description\" content=\"Learn about Black git, its development history, contributors. Learn how to use it on popular editors like vs code etc.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/black-git\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to Black Formatter for Python | Git Integration\" \/>\n<meta property=\"og:description\" content=\"In the following article, you will learn about the importance of code formatting, Black formatter, the history of Black on git, its major contributors.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/black-git\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-25T08:09:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-01T09:04:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Nikhil Omkar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nikhil Omkar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/\"},\"author\":{\"name\":\"Nikhil Omkar\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/6faa89103f0ea990a146386f20d1454f\"},\"headline\":\"Introduction to Black Formatter for Python | Git Integration\",\"datePublished\":\"2022-03-25T08:09:45+00:00\",\"dateModified\":\"2024-01-01T09:04:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/\"},\"wordCount\":1340,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp\",\"keywords\":[\"black python formatter vscode\",\"github black python formatter\",\"python black formatter\",\"python black formatter install offline\",\"python black formatter online\",\"python black formatter vscode\",\"vscode python black formatter\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/black-git\/#respond\"]}]},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/\",\"url\":\"https:\/\/www.pythonpool.com\/black-git\/\",\"name\":\"Introduction to Black Formatter for Python | Git Integration - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp\",\"datePublished\":\"2022-03-25T08:09:45+00:00\",\"dateModified\":\"2024-01-01T09:04:36+00:00\",\"description\":\"Learn about Black git, its development history, contributors. Learn how to use it on popular editors like vs code etc.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#breadcrumb\"},\"mainEntity\":[{\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100294238\"},{\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100977032\"}],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/black-git\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp\",\"width\":1200,\"height\":628,\"caption\":\"Black Git\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction to Black Formatter for Python | Git Integration\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/6faa89103f0ea990a146386f20d1454f\",\"name\":\"Nikhil Omkar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fe4e6cc08faea13ecb485e806625e9046dc70ffa984ada89243748e5353d3c13?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/fe4e6cc08faea13ecb485e806625e9046dc70ffa984ada89243748e5353d3c13?s=96&d=wavatar&r=g\",\"caption\":\"Nikhil Omkar\"}},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100294238\",\"position\":1,\"url\":\"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100294238\",\"name\":\"Does Black formatter follow PEP-8 guidelines?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Black follows PEP-8 guidelines staunchly in other words it doesn't make any compromises. It does its job quickly and effectively hence, increasing readability and maintaining overall consistency in the code.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Question\",\"@id\":\"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100977032\",\"position\":2,\"url\":\"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100977032\",\"name\":\"Is Black better than Flake-8?\",\"answerCount\":1,\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Flake-8 only suggests changes that should be made to make our code PEP-8 compliant while Black is the uncompromising Python code formatter, does all the formatting automatically in accordance with PEP-8.\",\"inLanguage\":\"en-US\"},\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Introduction to Black Formatter for Python | Git Integration - Python Pool","description":"Learn about Black git, its development history, contributors. Learn how to use it on popular editors like vs code etc.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pythonpool.com\/black-git\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to Black Formatter for Python | Git Integration","og_description":"In the following article, you will learn about the importance of code formatting, Black formatter, the history of Black on git, its major contributors.","og_url":"https:\/\/www.pythonpool.com\/black-git\/","og_site_name":"Python Pool","article_published_time":"2022-03-25T08:09:45+00:00","article_modified_time":"2024-01-01T09:04:36+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp","type":"image\/webp"}],"author":"Nikhil Omkar","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Nikhil Omkar","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonpool.com\/black-git\/#article","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/black-git\/"},"author":{"name":"Nikhil Omkar","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/6faa89103f0ea990a146386f20d1454f"},"headline":"Introduction to Black Formatter for Python | Git Integration","datePublished":"2022-03-25T08:09:45+00:00","dateModified":"2024-01-01T09:04:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/black-git\/"},"wordCount":1340,"commentCount":0,"publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/www.pythonpool.com\/black-git\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp","keywords":["black python formatter vscode","github black python formatter","python black formatter","python black formatter install offline","python black formatter online","python black formatter vscode","vscode python black formatter"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonpool.com\/black-git\/#respond"]}]},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/www.pythonpool.com\/black-git\/","url":"https:\/\/www.pythonpool.com\/black-git\/","name":"Introduction to Black Formatter for Python | Git Integration - Python Pool","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pythonpool.com\/black-git\/#primaryimage"},"image":{"@id":"https:\/\/www.pythonpool.com\/black-git\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp","datePublished":"2022-03-25T08:09:45+00:00","dateModified":"2024-01-01T09:04:36+00:00","description":"Learn about Black git, its development history, contributors. Learn how to use it on popular editors like vs code etc.","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/black-git\/#breadcrumb"},"mainEntity":[{"@id":"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100294238"},{"@id":"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100977032"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonpool.com\/black-git\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/black-git\/#primaryimage","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2022\/03\/Black-Git.webp","width":1200,"height":628,"caption":"Black Git"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonpool.com\/black-git\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Introduction to Black Formatter for Python | Git Integration"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonpool.com\/#website","url":"https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/pythonpool","https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/6faa89103f0ea990a146386f20d1454f","name":"Nikhil Omkar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/fe4e6cc08faea13ecb485e806625e9046dc70ffa984ada89243748e5353d3c13?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fe4e6cc08faea13ecb485e806625e9046dc70ffa984ada89243748e5353d3c13?s=96&d=wavatar&r=g","caption":"Nikhil Omkar"}},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100294238","position":1,"url":"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100294238","name":"Does Black formatter follow PEP-8 guidelines?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Black follows PEP-8 guidelines staunchly in other words it doesn't make any compromises. It does its job quickly and effectively hence, increasing readability and maintaining overall consistency in the code.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100977032","position":2,"url":"https:\/\/www.pythonpool.com\/black-git\/#faq-question-1648100977032","name":"Is Black better than Flake-8?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Flake-8 only suggests changes that should be made to make our code PEP-8 compliant while Black is the uncompromising Python code formatter, does all the formatting automatically in accordance with PEP-8.","inLanguage":"en-US"},"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/21413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=21413"}],"version-history":[{"count":51,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/21413\/revisions"}],"predecessor-version":[{"id":31529,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/21413\/revisions\/31529"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/21561"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=21413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=21413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=21413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}