{"id":1053981,"date":"2020-12-17T12:00:39","date_gmt":"2020-12-17T20:00:39","guid":{"rendered":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=1053981"},"modified":"2021-01-12T15:02:44","modified_gmt":"2021-01-12T23:02:44","slug":"improve-your-scripts-with-linting-and-automatic-code-formatting","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting","title":{"rendered":"Improve Your Scripts with Linting and Automatic Code Formatting"},"author":122991,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[37101],"tags":[42181,642031,757431,24341],"industry":[],"product":[36561],"class_list":["post-1053981","blog","type-blog","status-publish","format-standard","hentry","category-announcements","tag-arcgis-pro","tag-formatting","tag-linting","tag-python","product-arcgis-pro"],"acf":{"short_description":"Python linter flake8 and auto-formatter black are now in the default ArcGIS Pro Environment, learn how they can improve your code.","flexible_content":[{"acf_fc_layout":"content","content":"<p style=\"text-align: justify\"><strong>Have you ever\u00a0thought about\u00a0formatting and styling your Python code\u00a0consistently?\u00a0Are you\u00a0often\u00a0running your code\u00a0only\u00a0to find simple,\u00a0avoidable\u00a0errors?\u00a0Maybe you\u2019ve\u00a0even reached out for help from a\u00a0Python\u00a0linter or formatter<\/strong><strong>,\u00a0only to realize\u00a0it is missing from the default Python environment for\u00a0ArcGIS\u00a0Pro.\u00a0Well, whether you\u2019ve heard of linting\u00a0and autoformatting\u00a0or not, this\u00a0blog\u00a0is for you.<\/strong><strong>\u00a0<\/strong><\/p>\n<p style=\"text-align: justify\">If you answered yes to any of the above questions, you\u2019ve likely come to the realization that readability of code matters. A considerable part of any programming task is reading code, whether to remember what it does, to find errors, or to comprehend it for the first time. For one, switching between various projects and finding problems is less difficult when the code is formatted consistently. Even more important, consistent formatting makes it easier for you and others to read your code. Clean, consistent code also presents itself professionally.<\/p>\n<p style=\"text-align: justify\">Avoiding errors is one thing, but who decides how Python code should be styled? Well, Python creator and \u201cBenevolent Dictator for Life\u201d (until 2018) Guido van Rossum\u00a0also formulated the original Python Style Guide, which has since been expanded and morphed into <a href=\"https:\/\/www.python.org\/dev\/peps\/pep-0008\/\">PEP-8<\/a>. And luckily,\u00a0the community provides\u00a0tools that\u00a0help you find programming errors and simplify\u00a0implementing the PEP-8 coding convention\u00a0in the form of linters and formatters.<\/p>\n<p style=\"text-align: justify\">Linters and code formatters are a great tool for keeping your code clean and consistent with established coding conventions. A linter passively analyzes your code and alerts you to common programming and syntax errors. Many also provide rails for your formatting aberrations by identifying improper styling. On the other hand, a code formatter will actively restructure the appearance of your code to match style guidelines, but it won\u2019t analyze your code for errors.<\/p>\n<p style=\"text-align: justify\">What does any of this have to do with ArcGIS Pro?\u00a0If you\u2019re writing scripts\u00a0or large\u00a0Python\u00a0projects\u00a0for\u00a0ArcGIS Pro, you probably use the default Python environment,\u00a0arcgispro-py3,\u00a0as the interpreter for your preferred integrated development environment (IDE). Until now, the\u00a0default environment\u00a0did not contain a linter or\u00a0code\u00a0formatter.\u00a0It used to be that if you wanted to use\u00a0one,\u00a0you had to first clone the default environment, and then install the linter or\u00a0autoformatter. No more with\u00a0ArcGIS Pro\u00a02.7\u2014it now includes\u00a0open source\u00a0linter\u00a0<a href=\"https:\/\/gitlab.com\/pycqa\/flake8\">flake8<\/a>\u00a0and\u00a0code\u00a0formatter\u00a0<a href=\"https:\/\/github.com\/psf\/black\">black<\/a>.<\/p>\n<h2>How it works<\/h2>\n<p style=\"text-align: justify\">Both\u00a0flake8\u00a0and\u00a0black\u00a0help you format your code according to PEP-8.\u00a0Take the example script below\u00a0(if you want to follow along, save it to a local\u00a0Python\u00a0file like\u00a0my_script.py):<\/p>\n"},{"acf_fc_layout":"sidebar","content":"","image_reference":false,"layout":"code_snippet","image_reference_figure":"","snippet":"import os\r\nimport arcpy\r\nimport random\r\n\r\ndef random_line():\r\n    \"\"\"\u202fThis\u202ffunction\u202fgenerates\u202fa\u202frandom\u202fpolyline.\"\"\" \r\n\r\n    unused = \"unused\"\r\n    points = [arcpy.Point(random.randint(0, 10), random.randint(0, 10)) for i in range(2)]\r\n    return arcpy.Polyline(arcpy.Array(points))\r\n\r\nprint(random_line().length)","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<p style=\"text-align: justify\">The\u00a0quickest way to see\u00a0linting and autoformatting\u00a0in action is to open the Python Command Prompt and enter the following commands\u00a0(make sure that\u00a0arcgispro-py3\u00a0is\u00a0your active environment\u00a0and you have ArcGIS Pro 2.7 or later installed):<\/p>\n<p><code>flake8 C:\\Path\\To\\Your\\my_script.py <\/code><\/p>\n"},{"acf_fc_layout":"content","content":"<p style=\"text-align: justify\">Note that you\u2019ll\u00a0need\u00a0to\u00a0substitute\u00a0your own path.\u00a0You\u2019ll see that\u00a0programming and style errors\u00a0will be printed\u00a0below the\u00a0flake8\u00a0command along with details on their location in the script.\u00a0If you have the script open, you\u2019ll note that the code hasn\u2019t been changed.\u00a0Now try running\u00a0black:<\/p>\n<p><code>black C:\\Path\\To\\Your\\my_script.py <\/code><\/p>\n"},{"acf_fc_layout":"content","content":"<p style=\"text-align: justify\">You\u2019ll see that\u00a0after running\u00a0black,\u00a0your code has been reformatted\u00a0to correct\u00a0the styling.\u00a0Try running the\u00a0flake8\u00a0command again to see how many of the flagged formatting errors have been\u00a0taken care of.\u00a0Some of the remaining items are flags for\u00a0unconventional\u00a0programming\u00a0practices,\u00a0but some may still be formatting errors that black\u00a0thinks you should\u00a0fix yourself. Can you remove all of them?<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":1054231,"id":1054231,"title":"LintingAutoformattingCodeSnippet","filename":"LintingAutoformattingCodeSnippet.png","filesize":6292,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/11\/LintingAutoformattingCodeSnippet.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting\/lintingautoformattingcodesnippet","alt":"Formatted script","author":"122991","description":"","caption":"Hint: Your fixed code might look something like this.","name":"lintingautoformattingcodesnippet","status":"inherit","uploaded_to":1053981,"date":"2020-11-02 17:22:15","modified":"2020-11-18 22:27:43","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":458,"height":274,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/11\/LintingAutoformattingCodeSnippet-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/11\/LintingAutoformattingCodeSnippet.png","medium-width":436,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/11\/LintingAutoformattingCodeSnippet.png","medium_large-width":458,"medium_large-height":274,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/11\/LintingAutoformattingCodeSnippet.png","large-width":458,"large-height":274,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/11\/LintingAutoformattingCodeSnippet.png","1536x1536-width":458,"1536x1536-height":274,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/11\/LintingAutoformattingCodeSnippet.png","2048x2048-width":458,"2048x2048-height":274,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/11\/LintingAutoformattingCodeSnippet.png","card_image-width":458,"card_image-height":274,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/11\/LintingAutoformattingCodeSnippet.png","wide_image-width":458,"wide_image-height":274}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Take the next steps<\/h2>\n<p style=\"text-align: justify\">Of course,\u00a0switching back and forth between your code and the command prompt\u00a0to locate flagged\u00a0errors\u00a0is inconvenient.\u00a0That\u2019s why all but the simplest IDEs integrate linting and\u00a0code\u00a0formatting.\u00a0Good\u00a0IDEs will not only save you the steps of running the linter and autoformatter\u00a0commands, but they\u00a0will also\u00a0directly\u00a0highlight\u00a0programming and style errors\u00a0identified by your linter.\u00a0Unfortunately, there are too many\u00a0IDEs\u00a0to choose from to\u00a0get\u00a0into detail\u00a0here\u00a0on setting them up, but\u00a0most IDEs have excellent documentation on integrating linters and code formatters to help you get started.\u00a0With\u00a0flake8\u00a0and\u00a0black\u00a0now part of the default Python environment shipped with ArcGIS Pro 2.7, we\u2019ve taken the first step for you,\u00a0so make yourself a\u00a0coffee (or tea),\u00a0start up your preferred IDE, and get set up\u2014you\u2019ll\u00a0be glad you did!<\/p>\n"}],"authors":[{"ID":122991,"user_firstname":"Hannes","user_lastname":"Ziegler","nickname":"hziegler","user_nicename":"hziegler","display_name":"Hannes Ziegler","user_email":"hziegler@esri.com","user_url":"","user_registered":"2020-10-30 20:06:29","user_description":"Hannes is a product engineer on the Python team. He has five years of experience streamlining spatial data analysis workflows in the public and private sectors, and has been with Esri since 2019, where he focuses on the design, evaluation, and documentation of new and existing Python functionality.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/10\/HannesZiegler2-465x465.jpg' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"}],"related_articles":[{"ID":443452,"post_author":"8112","post_date":"2019-02-26 08:52:12","post_date_gmt":"2019-02-26 16:52:12","post_content":"","post_title":"Beginner's guide to Python in ArcGIS Pro, Part 1: Why?","post_excerpt":"","post_status":"publish","comment_status":"closed","ping_status":"closed","post_password":"","post_name":"beginners-guide-to-python-in-arcgis-pro-part-1-why","to_ping":"","pinged":"","post_modified":"2019-03-18 11:20:43","post_modified_gmt":"2019-03-18 18:20:43","post_content_filtered":"","post_parent":0,"guid":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=443452","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":447382,"post_author":"8112","post_date":"2019-02-27 09:16:32","post_date_gmt":"2019-02-27 17:16:32","post_content":"","post_title":"Beginner\u2019s guide to Python in ArcGIS Pro, Part 2: How?","post_excerpt":"","post_status":"publish","comment_status":"closed","ping_status":"closed","post_password":"","post_name":"beginners-guide-to-python-in-arcgis-pro-part-2-how","to_ping":"","pinged":"","post_modified":"2020-06-19 10:56:16","post_modified_gmt":"2020-06-19 17:56:16","post_content_filtered":"","post_parent":0,"guid":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=447382","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":450012,"post_author":"8112","post_date":"2019-03-18 11:13:51","post_date_gmt":"2019-03-18 18:13:51","post_content":"","post_title":"Beginner's guide to Python in ArcGIS Pro, Part 3: Tutorial","post_excerpt":"","post_status":"publish","comment_status":"closed","ping_status":"closed","post_password":"","post_name":"beginners-guide-to-python-in-arcgis-pro-part-3-tutorial","to_ping":"","pinged":"","post_modified":"2022-03-08 15:37:36","post_modified_gmt":"2022-03-08 23:37:36","post_content_filtered":"","post_parent":0,"guid":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=450012","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":453682,"post_author":"8112","post_date":"2019-03-26 09:46:43","post_date_gmt":"2019-03-26 16:46:43","post_content":"","post_title":"Beginner's guide to Python in ArcGIS Pro, Part 4: Tutorial cont.","post_excerpt":"","post_status":"publish","comment_status":"closed","ping_status":"closed","post_password":"","post_name":"beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont","to_ping":"","pinged":"","post_modified":"2019-07-31 16:30:16","post_modified_gmt":"2019-07-31 23:30:16","post_content_filtered":"","post_parent":0,"guid":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=453682","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"}],"card_image":false,"wide_image":false},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Improve Your Scripts with Linting and Automatic Code Formatting<\/title>\n<meta name=\"description\" content=\"Python linter flake8 and auto-formatter black are now in the default ArcGIS Pro Environment, learn how they can improve your code.\" \/>\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.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Improve Your Scripts with Linting and Automatic Code Formatting\" \/>\n<meta property=\"og:description\" content=\"Python linter flake8 and auto-formatter black are now in the default ArcGIS Pro Environment, learn how they can improve your code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-12T23:02:44+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting\"},\"author\":{\"name\":\"Hannes Ziegler\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/ea3735f79040105f9ee9a92313e0ff82\"},\"headline\":\"Improve Your Scripts with Linting and Automatic Code Formatting\",\"datePublished\":\"2020-12-17T20:00:39+00:00\",\"dateModified\":\"2021-01-12T23:02:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting\"},\"wordCount\":9,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"ArcGIS Pro\",\"formatting\",\"linting\",\"python\"],\"articleSection\":[\"Announcements\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting\",\"name\":\"Improve Your Scripts with Linting and Automatic Code Formatting\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2020-12-17T20:00:39+00:00\",\"dateModified\":\"2021-01-12T23:02:44+00:00\",\"description\":\"Python linter flake8 and auto-formatter black are now in the default ArcGIS Pro Environment, learn how they can improve your code.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Improve Your Scripts with Linting and Automatic Code Formatting\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/ea3735f79040105f9ee9a92313e0ff82\",\"name\":\"Hannes Ziegler\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/10\/HannesZiegler2-465x465.jpg\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/10\/HannesZiegler2-465x465.jpg\",\"caption\":\"Hannes Ziegler\"},\"description\":\"Hannes is a product engineer on the Python team. He has five years of experience streamlining spatial data analysis workflows in the public and private sectors, and has been with Esri since 2019, where he focuses on the design, evaluation, and documentation of new and existing Python functionality.\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/author\/hziegler\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Improve Your Scripts with Linting and Automatic Code Formatting","description":"Python linter flake8 and auto-formatter black are now in the default ArcGIS Pro Environment, learn how they can improve your code.","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.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting","og_locale":"en_US","og_type":"article","og_title":"Improve Your Scripts with Linting and Automatic Code Formatting","og_description":"Python linter flake8 and auto-formatter black are now in the default ArcGIS Pro Environment, learn how they can improve your code.","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2021-01-12T23:02:44+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting"},"author":{"name":"Hannes Ziegler","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/ea3735f79040105f9ee9a92313e0ff82"},"headline":"Improve Your Scripts with Linting and Automatic Code Formatting","datePublished":"2020-12-17T20:00:39+00:00","dateModified":"2021-01-12T23:02:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting"},"wordCount":9,"commentCount":0,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["ArcGIS Pro","formatting","linting","python"],"articleSection":["Announcements"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting","name":"Improve Your Scripts with Linting and Automatic Code Formatting","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2020-12-17T20:00:39+00:00","dateModified":"2021-01-12T23:02:44+00:00","description":"Python linter flake8 and auto-formatter black are now in the default ArcGIS Pro Environment, learn how they can improve your code.","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/announcements\/improve-your-scripts-with-linting-and-automatic-code-formatting#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"Improve Your Scripts with Linting and Automatic Code Formatting"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/ea3735f79040105f9ee9a92313e0ff82","name":"Hannes Ziegler","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/10\/HannesZiegler2-465x465.jpg","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/10\/HannesZiegler2-465x465.jpg","caption":"Hannes Ziegler"},"description":"Hannes is a product engineer on the Python team. He has five years of experience streamlining spatial data analysis workflows in the public and private sectors, and has been with Esri since 2019, where he focuses on the design, evaluation, and documentation of new and existing Python functionality.","url":"https:\/\/www.esri.com\/arcgis-blog\/author\/hziegler"}]}},"text_date":"December 17, 2020","author_name":"Hannes Ziegler","author_page":"https:\/\/www.esri.com\/arcgis-blog\/author\/hziegler","custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/08\/Newsroom-Keyart-Wide-1920-x-1080.jpg","primary_product":"ArcGIS Pro","tag_data":[{"term_id":42181,"name":"ArcGIS Pro","slug":"arcgis-pro","term_group":0,"term_taxonomy_id":42181,"taxonomy":"post_tag","description":"","parent":0,"count":323,"filter":"raw"},{"term_id":642031,"name":"formatting","slug":"formatting","term_group":0,"term_taxonomy_id":642031,"taxonomy":"post_tag","description":"","parent":0,"count":5,"filter":"raw"},{"term_id":757431,"name":"linting","slug":"linting","term_group":0,"term_taxonomy_id":757431,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":24341,"name":"python","slug":"python","term_group":0,"term_taxonomy_id":24341,"taxonomy":"post_tag","description":"","parent":0,"count":171,"filter":"raw"}],"category_data":[{"term_id":37101,"name":"Announcements","slug":"announcements","term_group":0,"term_taxonomy_id":37101,"taxonomy":"category","description":"","parent":0,"count":1962,"filter":"raw"}],"product_data":[{"term_id":36561,"name":"ArcGIS Pro","slug":"arcgis-pro","term_group":0,"term_taxonomy_id":36561,"taxonomy":"product","description":"","parent":0,"count":2036,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=arcgis-pro","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/1053981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/122991"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=1053981"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/1053981\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=1053981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=1053981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=1053981"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=1053981"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=1053981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}