{"id":20954,"date":"2018-02-21T12:15:34","date_gmt":"2018-02-21T10:15:34","guid":{"rendered":"https:\/\/www.webcodegeeks.com\/?p=20954"},"modified":"2018-02-21T11:58:54","modified_gmt":"2018-02-21T09:58:54","slug":"cook-pre-hook","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/","title":{"rendered":"\u201cCook\u201d it and \u201cPre Hook\u201d it"},"content":{"rendered":"<p>\u201cCook\u201d it and \u201cHook\u201d it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it\u2019s been a long while I have set hands on my site writing again.<\/p>\n<p>Well, I was having a group training session in my organization where my fellow colleague <a href=\"https:\/\/bonyroopchandani.com\/\" target=\"_blank\" rel=\"noopener\">Bony Roopchandani<\/a>\u00a0who explained us the concepts of \u201c<strong>Hook<\/strong>\u201d and the use of \u201c<strong>Pre-commit<\/strong>\u201d hook before actually committing any code. So, today\u2019s topic of discussion for me would be the <strong>PRE-COMMIT<\/strong> hook.<\/p>\n<p><em><strong>\u201cCook\u201d it and \u201cPre Hook\u201d it<\/strong><\/em> \u2013 Cook your application code and use the capabilities of \u201c<strong>pre-commit<\/strong>\u201d \u201c<strong>linters<\/strong>\u201d\u00a0to do a baseline check before you commit your code and push it to the repository. So, I assume my readers would have the following three questions<\/p>\n<ul>\n<li><strong><em>What is a \u201chook\u201d?<\/em><\/strong><\/li>\n<li><strong><em>What is \u201cPre-commit\u201d?<\/em><\/strong><\/li>\n<li><em><strong>What is the problem statement that pre-commit resolves?<\/strong><\/em><\/li>\n<li><strong><em>What are \u201cPre-commit hooks\u201d?<\/em><\/strong><\/li>\n<li><strong><em>What is a \u201clinter\u201d?<\/em><\/strong><\/li>\n<\/ul>\n<h2>What is a \u201cHook\u201d?<\/h2>\n<p>In programming, a hook is an application, a set of customized program code that helps to perform other functionality. This simplifies interoperability between two applications or platforms. In technical term, it is a callback for an event or set of events triggered by certain actions, which might be \u201c<em><strong>clicking a button<\/strong><\/em>\u201d to \u201c<em><strong>running certain specific scripts<\/strong><\/em>\u201c.<\/p>\n<h2>What is \u201cPre-commit\u201d?<\/h2>\n<p>Pre-commit is a framework for managing and maintaining multi-language pre-commit hooks.<\/p>\n<h2>What is the problem statement that pre-commit resolves?<\/h2>\n<p>Git hook scripts are very useful for identifying simple issues before submission to code review. We run these hooks on every commit to automatically point out issues in the code such as missing semicolons, trailing whitespace, and debug statements. By pointing out these issues out before code reviewing, allows a code reviewer to focus more on the architecture of the application rather than petty issues.<\/p>\n<p>As we keep on creating more libraries and projects it becomes complicated to share pre-commit hooks across projects. It is recommended that we should always use the best industry standard linters.<\/p>\n<h2>What are \u201cPre-commit hooks\u201d?<\/h2>\n<p>The pre-commit platform solves the hook issues. It is a multi-language package manager for pre-commit hooks. We specify a list of hooks we want and pre-commit manages the installation and execution of any hook written in any language before every commit. Pre-commit is specifically designed to not require root access. Pre-commit automatically handles downloading and building from packages without root.<\/p>\n<h2>What is a \u201clinter\u201d?<\/h2>\n<p>A \u201clinter\u201d or \u201clint\u201d is a tool or certain program\/programs that analyze the source code to flag programming errors, bugs, style based errors and suspicious constructs. The term is originated from a UNIX utility that examined C language source code.<\/p>\n<h2>Installation<\/h2>\n<p>Installing pre-commit can be done in two ways:<\/p>\n<h3><strong>Using pip<\/strong><\/h3>\n<pre class=\"brush:py\">pip install pre-commit<\/pre>\n<h3><strong>Using Home-Brew for MacOS<\/strong><\/h3>\n<pre class=\"brush:py\">brew install pre-commit<\/pre>\n<h3>For system level installation<\/h3>\n<pre class=\"brush:py\">curl https:\/\/bootstrap.pypa.io\/get-pip.py | sudo python - pre-commit<\/pre>\n<h3>In a python based project<\/h3>\n<p>In a python based project, you can add the dependency to the <code>requirements.txt<\/code><\/p>\n<pre class=\"brush:py\">Add 'pre-commit' to the requirements.txt\r\nRun pip install -r requirements.txt<\/pre>\n<h2>\u00a0Adding pre-commit plugins to your project<\/h2>\n<p>Once you have pre-commit installed, adding pre-commit plugins to your project is done with the\u00a0<code>.pre-commit-config.yaml<\/code>\u00a0configuration file.<\/p>\n<p>Add a file called\u00a0<code>.pre-commit-config.yaml<\/code>\u00a0to the root of your project. The pre-commit config file describes what repositories and hooks are installed.<\/p>\n<p>A typical .pre-commit-config.yaml would look something like this:<\/p>\n<pre class=\"brush:py\">repos:\r\n- repo: git:\/\/github.com\/pre-commit\/mirrors-yapf\r\n  sha: v0.20.2\r\n  hooks:\r\n  - id: yapf\r\n  - repo: https:\/\/github.com\/pre-commit\/pre-commit-hooks\r\n    sha: v1.2.0\r\n  hooks:\r\n  - id: trailing-whitespace\r\n  - id: check-merge-conflict<\/pre>\n<p>In the above example, I have included plugins for python linter which is \u201c<strong>yapf<\/strong>\u201c, \u201c<strong>trailing-whitespace<\/strong>\u201d to remove trailing whitespace and \u201c<strong>check-merge-conflict<\/strong>\u201d to check for merge conflicts in the file.<\/p>\n<p>You would also have to add a \u201c<strong>.style.yapf<\/strong>\u201d file which would have the style standards defined within. The \u201c.style.yapf\u201d file would look something like this:<\/p>\n<pre class=\"brush:py\">[style]\r\nbased_on_style = pep8\r\nCOLUMN_LIMIT = 120\r\nDEDENT_CLOSING_BRACKETS = true<\/pre>\n<h2>Updating hooks automatically<\/h2>\n<p>You can update your hooks to the latest version automatically by running\u00a0<code>pre-commit autoupdate<\/code>. This will bring the hooks to the latest sha on the master branch.<\/p>\n<h2>Usage<\/h2>\n<p>You have to run\u00a0<code>pre-commit install<\/code>\u00a0to install pre-commit into your git hooks. pre-commit will now run on every commit. Every time you clone a project using pre-commit running\u00a0<code>pre-commit install --install-hooks<\/code>\u00a0should always be the first thing you do. Check the screenshot for more reference.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-24-22-pm.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-20956\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-24-22-pm.png\" alt=\"\" width=\"676\" height=\"143\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-24-22-pm.png 676w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-24-22-pm-300x63.png 300w\" sizes=\"(max-width: 676px) 100vw, 676px\" \/><\/a><\/p>\n<p>If you want to manually run all pre-commit hooks on a repository, run\u00a0<code>pre-commit run --all-files<\/code>. To run individual hooks use\u00a0<code>pre-commit run <\/code>.<\/p>\n<p>The first time pre-commit runs on a file it will automatically download, install, and run the hook. Note that running a hook for the first time may be slow. For example: If the machine does not have node installed, pre-commit will download and build a copy of node.<\/p>\n<p>To get started with the pre-commit checks just commit your code to see whether your codebase follows industry standards or not. Check the screenshot for more reference.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-33-35-pm.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-20957\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-33-35-pm.png\" alt=\"\" width=\"676\" height=\"616\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-33-35-pm.png 676w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-33-35-pm-300x273.png 300w\" sizes=\"(max-width: 676px) 100vw, 676px\" \/><\/a><\/p>\n<h2>Updating hooks automatically<\/h2>\n<p>You can update your hooks to the latest version automatically by running\u00a0<code>pre-commit autoupdate<\/code>. This will bring the hooks to the latest sha on the master branch. Check the screenshot for more reference.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-36-48-pm.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-20958\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-36-48-pm.png\" alt=\"\" width=\"676\" height=\"121\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-36-48-pm.png 676w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/02\/screen-shot-2018-02-19-at-4-36-48-pm-300x54.png 300w\" sizes=\"(max-width: 676px) 100vw, 676px\" \/><\/a><\/p>\n<p>Please post your feedback. Your feedback are valuable in terms of improving my blog contents and technical aspects as well. Thank you &amp;#55357;&amp;#56898; Have a nice day !!<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Web Code Geeks with permission by Soumyajit Basu, partner at our <a href=\"http:\/\/www.webcodegeeks.com\/join-us\/wcg\/\" target=\"_blank\" rel=\"noopener\">WCG program<\/a>. See the original article here: <a href=\"https:\/\/soumyajit2016.wordpress.com\/2018\/02\/19\/cook-it-and-pre-hook-it\/\" target=\"_blank\" rel=\"noopener\">\u201cCook\u201d it and \u201cPre Hook\u201d it<\/a><\/p>\n<p>Opinions expressed by Web Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u201cCook\u201d it and \u201cHook\u201d it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it\u2019s been a long while I have set hands on my site writing again. Well, I was having a group training session in my organization where my fellow colleague Bony Roopchandani\u00a0who explained us the &hellip;<\/p>\n","protected":false},"author":1029,"featured_media":1651,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[],"class_list":["post-20954","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u201cCook\u201d it and \u201cPre Hook\u201d it - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"\u201cCook\u201d it and \u201cHook\u201d it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it\u2019s been a long while I have set hands on my\" \/>\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.webcodegeeks.com\/python\/cook-pre-hook\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u201cCook\u201d it and \u201cPre Hook\u201d it - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"\u201cCook\u201d it and \u201cHook\u201d it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it\u2019s been a long while I have set hands on my\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/soumyajit.basu\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-21T10:15:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Soumyajit Basu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SoumyajitBasu19\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Soumyajit Basu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/\"},\"author\":{\"name\":\"Soumyajit Basu\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c2aa0b158203f117998917927a96c276\"},\"headline\":\"\u201cCook\u201d it and \u201cPre Hook\u201d it\",\"datePublished\":\"2018-02-21T10:15:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/\"},\"wordCount\":848,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/\",\"name\":\"\u201cCook\u201d it and \u201cPre Hook\u201d it - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"datePublished\":\"2018-02-21T10:15:34+00:00\",\"description\":\"\u201cCook\u201d it and \u201cHook\u201d it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it\u2019s been a long while I have set hands on my\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"\u201cCook\u201d it and \u201cPre Hook\u201d it\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c2aa0b158203f117998917927a96c276\",\"name\":\"Soumyajit Basu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ca834774616f992a60dd418c3424f7d678f645d0974d880abe735f481c8b1407?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ca834774616f992a60dd418c3424f7d678f645d0974d880abe735f481c8b1407?s=96&d=mm&r=g\",\"caption\":\"Soumyajit Basu\"},\"description\":\"Soumyajit is a QA\/DevOps engineer by profession and a technology enthusiast by passion. He loves communicating about technology and is an author at his own blog platform as well as in Dzone and Web Code Geeks.\",\"sameAs\":[\"https:\/\/soumyajit2016.wordpress.com\/\",\"https:\/\/www.facebook.com\/soumyajit.basu\",\"https:\/\/www.linkedin.com\/in\/soumyajit-basu-5a783886\/\",\"https:\/\/x.com\/SoumyajitBasu19\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/soumyajit-basu\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u201cCook\u201d it and \u201cPre Hook\u201d it - Web Code Geeks - 2026","description":"\u201cCook\u201d it and \u201cHook\u201d it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it\u2019s been a long while I have set hands on my","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.webcodegeeks.com\/python\/cook-pre-hook\/","og_locale":"en_US","og_type":"article","og_title":"\u201cCook\u201d it and \u201cPre Hook\u201d it - Web Code Geeks - 2026","og_description":"\u201cCook\u201d it and \u201cHook\u201d it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it\u2019s been a long while I have set hands on my","og_url":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_author":"https:\/\/www.facebook.com\/soumyajit.basu","article_published_time":"2018-02-21T10:15:34+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","type":"image\/jpeg"}],"author":"Soumyajit Basu","twitter_card":"summary_large_image","twitter_creator":"@SoumyajitBasu19","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Soumyajit Basu","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/"},"author":{"name":"Soumyajit Basu","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c2aa0b158203f117998917927a96c276"},"headline":"\u201cCook\u201d it and \u201cPre Hook\u201d it","datePublished":"2018-02-21T10:15:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/"},"wordCount":848,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/","url":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/","name":"\u201cCook\u201d it and \u201cPre Hook\u201d it - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","datePublished":"2018-02-21T10:15:34+00:00","description":"\u201cCook\u201d it and \u201cHook\u201d it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it\u2019s been a long while I have set hands on my","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/11\/python-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/python\/cook-pre-hook\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/www.webcodegeeks.com\/category\/python\/"},{"@type":"ListItem","position":3,"name":"\u201cCook\u201d it and \u201cPre Hook\u201d it"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/c2aa0b158203f117998917927a96c276","name":"Soumyajit Basu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ca834774616f992a60dd418c3424f7d678f645d0974d880abe735f481c8b1407?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ca834774616f992a60dd418c3424f7d678f645d0974d880abe735f481c8b1407?s=96&d=mm&r=g","caption":"Soumyajit Basu"},"description":"Soumyajit is a QA\/DevOps engineer by profession and a technology enthusiast by passion. He loves communicating about technology and is an author at his own blog platform as well as in Dzone and Web Code Geeks.","sameAs":["https:\/\/soumyajit2016.wordpress.com\/","https:\/\/www.facebook.com\/soumyajit.basu","https:\/\/www.linkedin.com\/in\/soumyajit-basu-5a783886\/","https:\/\/x.com\/SoumyajitBasu19"],"url":"https:\/\/www.webcodegeeks.com\/author\/soumyajit-basu\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/20954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/1029"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=20954"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/20954\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/1651"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=20954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=20954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=20954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}