{"id":14139,"date":"2025-02-25T14:14:31","date_gmt":"2025-02-25T14:14:31","guid":{"rendered":"https:\/\/capitole-consulting.com\/?p=14139"},"modified":"2025-06-20T09:47:06","modified_gmt":"2025-06-20T09:47:06","slug":"code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package","status":"publish","type":"post","link":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/","title":{"rendered":"Code Development Tips: Unit tests, code formatters and stylers and structuring code as a package."},"content":{"rendered":"\n<p>In line with the previous article <a href=\"https:\/\/capitole-consulting.com\/structure-readability-and-efficiency-in-code-development\/\">\u201c<em>Structure, readability and efficiency in code development<\/em>\u201d<\/a>, I add some practical tips to improve Python development practices.<\/p>\n\n\n\n<p>As you know, in Capitole we have presence in many different industries. Many of us are in data processing projects, in Data Science \/ Development \/Devops positions and work both on physical servers and on cloud machines in AWS, Azure or other cloud services. For us it is very important to <strong>work efficiently and follow good practices in development<\/strong>, leaving a good image of our company wherever we go. This allows us to perform our job the best we can and makes things easier for the end customers of the developed product.<\/p>\n\n\n\n<p>In this article, we share some of the thoughts that we have acquired over time, that are meant to help as tips to organize the code. They are simple tricks that can save a lot of time and misunderstandings in the day-to-day work of the team of developers.<\/p>\n\n\n\n<p><strong>Inline Tests<\/strong><\/p>\n\n\n\n<p>I know you test your code; otherwise, how do you know it works? But here\u2019s the question: do you <strong>keep track of the tests<\/strong> you do? If not, how can others trust your code?<\/p>\n\n\n\n<p>Welcome to the amazing world of unit testing. This is one of those things that might not seem fun at the beginning, but once you\u2019ve experienced long hours wasted debugging code, and then hours saved thanks to testing your code, it magically becomes fun and a must.<\/p>\n\n\n\n<p>I would want to teach you about the <em>assert<\/em> statement, also known as <strong>\u201cinline tests\u201d<\/strong>. These tests are useful to <strong>check if the input and output of your functions are correct.<\/strong><\/p>\n\n\n\n<p>Let me show you an example where this comes in handy. Let\u2019s say you are working with a vector of probabilities, and you want to project to 0 or 1 depending on a threshold. This function is implementing this:<\/p>\n\n\n\n<p><strong>def <\/strong>project_to_zero_or_one(probabilities, threshold):<\/p>\n\n\n\n<p><em># define empty array<\/em><\/p>\n\n\n\n<p>projections = np.empty_like(probabilities)<\/p>\n\n\n\n<p><em># project<\/em><\/p>\n\n\n\n<p>projections[probabilities &lt; threshold] = 0<\/p>\n\n\n\n<p>projections[probabilities &gt;= threshold] = 1<\/p>\n\n\n\n<p><strong>return <\/strong>projections<\/p>\n\n\n\n<p>But what if there are nans in your input vector? What if one of the entries is &lt;0 or &gt;1? (remember probabilities are not defined outside the range [0,1]) What if the input is a matrix and not a vector?<\/p>\n\n\n\n<p>I would like the code to tell me if anything like that is happening, meaning there\u2019s something wrong somewhere else I need to fix before it\u2019s too late.<\/p>\n\n\n\n<p><strong>def <\/strong>project_to_zero_or_one(probabilities, threshold):<\/p>\n\n\n\n<p><em># check input<\/em><\/p>\n\n\n\n<p><strong>assert <\/strong>probabilities.ndim == 1, \u00ab\u00a0Input must be a vector!\u00a0\u00bb<\/p>\n\n\n\n<p><strong>assert <\/strong>np.isnan(probabilities).sum() == 0, \u00ab\u00a0Input contains NaN values!\u00a0\u00bb<\/p>\n\n\n\n<p><strong>assert <\/strong>np.sum(probabilities &gt; 1) == 0, f\u00a0\u00bbThere are probabilities &gt; 1!\u00a0\u00bb<\/p>\n\n\n\n<p><strong>assert <\/strong>np.sum(probabilities &lt; 0) == 0, f\u00a0\u00bbThere are probabilities &lt; 0!\u00a0\u00bb<\/p>\n\n\n\n<p><em># define empty array<\/em><\/p>\n\n\n\n<p>projections = np.empty_like(probabilities)<\/p>\n\n\n\n<p><em># project<\/em><\/p>\n\n\n\n<p>projections[probabilities &lt; threshold] = 0<\/p>\n\n\n\n<p>projections[probabilities &gt;= threshold] = 1<\/p>\n\n\n\n<p><strong>return <\/strong>projections<\/p>\n\n\n\n<p>One practice I like to follow is <strong>extracting all assert statements out of the main function<\/strong>. This is particularly useful when you have other functions that use the same argument, such as probabilities, allowing you to <strong>reuse the code.<\/strong><\/p>\n\n\n\n<p><strong>def <\/strong>_check_probabilities(probabilities):<\/p>\n\n\n\n<p><strong>assert <\/strong>probabilities.ndim == 1, &lsquo;Input must be a vector!&rsquo;<\/p>\n\n\n\n<p><strong>assert <\/strong>np.isnan(probabilities).sum() == 0, &lsquo;Input contains NaN values!&rsquo;<\/p>\n\n\n\n<p><strong>assert <\/strong>np.sum(probabilities &gt; 1) == 0, &lsquo;There are probabilities &gt; 1!&rsquo;<\/p>\n\n\n\n<p><strong>assert <\/strong>np.sum(probabilities &lt; 0) == 0, &lsquo;There are probabilities &lt; 0!&rsquo;<\/p>\n\n\n\n<p><strong>Code formatters and Stylers<\/strong><\/p>\n\n\n\n<p>You may not realize it yet, but you\u2019ll spend most of your career reading code instead of writing it. Whether you work in a team and review your colleagues\u2019 code, or when you are trying to solve a problem by looking for an answer on StackOverflow, or even when you come back to debug code you wrote months ago. In all those situations, you will be reading a lot of code.<\/p>\n\n\n\n<p>For that reason, it is important to <strong>write code in a consistent and uniform way.<\/strong> This includes decisions such as maximum line length, empty lines between function definitions, and syntax conventions like vector[:-1] or vector[: -1]. These may seem like small details, but they have a significant impact on code readability for humans. The big question is, can all these <strong>small decisions be automated<\/strong>? Yes, indeed.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A <strong>code formatter<\/strong> is a tool that automatically <strong>modifies the layout and style of source code<\/strong> to adhere to a specific set of formatting rules or guidelines. I highly recommend <a href=\"https:\/\/github.com\/psf\/black\">Black<\/a>.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>On the other hand, a <strong>code styler<\/strong> is a tool that assists developers in applying a specific coding style or set of guidelines to their code. While similar to code formatters, code stylers are more flexible <strong>and suggest changes to the code instead of modifying it directly<\/strong>. For example, they may suggest renaming variables or removing unused libraries. I highly recommend <a href=\"https:\/\/github.com\/pycqa\/flake8\">flake8<\/a>.<\/li>\n<\/ul>\n\n\n\n<p><strong>Structuring code as a package<\/strong><\/p>\n\n\n\n<p>Are you having trouble importing your own Python modules? Does the error ModuleNotFoundError: No module named &lsquo;my_python_file&rsquo; look familiar? Have you already experienced the insecurity of knowing if you have installed your modules, where they are located or if you are using the correct path? It might be time to <strong>improve your code structure<\/strong>.<\/p>\n\n\n\n<p>Whenever starting a new project, structure your code something like this:<\/p>\n\n\n\n<p><strong>my_project\/<\/strong><\/p>\n\n\n\n<p>\u251c\u2500\u2500 src\/<\/p>\n\n\n\n<p>\u2502 \u251c\u2500\u2500 __init__.py<\/p>\n\n\n\n<p>\u2502 \u251c\u2500\u2500 my_module.py<\/p>\n\n\n\n<p>\u2502 \u2514\u2500\u2500 my_folder\/<\/p>\n\n\n\n<p>\u2502 \u251c\u2500\u2500 __init__.py<\/p>\n\n\n\n<p>\u2502 \u2514\u2500\u2500 my_other_module.py<\/p>\n\n\n\n<p>\u251c\u2500\u2500 data\/<\/p>\n\n\n\n<p>\u2502 \u251c\u2500\u2500 raw\/<\/p>\n\n\n\n<p>\u251c\u2500\u2500 scripts\/<\/p>\n\n\n\n<p>\u2502 \u251c\u2500\u2500 my_script.py<\/p>\n\n\n\n<p>\u251c\u2500\u2500 setup.py<\/p>\n\n\n\n<p>\u2514\u2500\u2500 README.md<\/p>\n\n\n\n<p>A few things to note:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;When Python imports a package, it looks for the __init__.py file in the package directory and executes any code inside it.<\/li>\n\n\n\n<li>setup.py is a Python script that is used to define <strong>the metadata and dependencies<\/strong> of a Python package. The simplest it can be is:<\/li>\n<\/ul>\n\n\n\n<p>from setuptools import setup, find_packages<\/p>\n\n\n\n<p>setup(<\/p>\n\n\n\n<p>name=&rsquo;my_package&rsquo;,<\/p>\n\n\n\n<p>packages=find_packages(),<\/p>\n\n\n\n<p>)<\/p>\n\n\n\n<p>You can also specify dependencies, authors, versions, etc:<\/p>\n\n\n\n<p>from setuptools import setup, find_packages<\/p>\n\n\n\n<p>setup(<\/p>\n\n\n\n<p>name=&rsquo;my_package&rsquo;,<\/p>\n\n\n\n<p>version=&rsquo;0.1&prime;,<\/p>\n\n\n\n<p>author=&rsquo;John Doe&rsquo;,<\/p>\n\n\n\n<p>author_email=&rsquo;john.doe@example.com&rsquo;,<\/p>\n\n\n\n<p>description=&rsquo;A simple Python package&rsquo;,<\/p>\n\n\n\n<p>packages=find_packages(),<\/p>\n\n\n\n<p>install_requires=[<\/p>\n\n\n\n<p>&lsquo;numpy&gt;=1.16.0&rsquo;,<\/p>\n\n\n\n<p>&lsquo;pandas&gt;=0.23.4&rsquo;,<\/p>\n\n\n\n<p>],<\/p>\n\n\n\n<p>)<\/p>\n\n\n\n<p>Once your folders look like this (and you are in your virtual environment) type <strong>pip install -e path\/to\/my_project\/.<\/strong> This will install your package in <strong>editable mode<\/strong>. This means that as you change your code your installed package is <strong>automatically updated<\/strong>, and you won\u2019t need to reinstall anything.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>In summary, good coding structure and practices not only improve development efficiency, but also facilitate collaboration and long-term code maintenance.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The practice of <strong>testing<\/strong> (in an ordered and consistent manner) is essential to ensure in a reliable and controlled way that the code complies with the defined functionalities correctly.<\/li>\n\n\n\n<li>The use of code <strong>stylizers and formatters <\/strong>are essential habits to <strong>homogenize criteria<\/strong> in any <strong>development team<\/strong>. The key is to write code that is easily understandable, replicable, and adaptable, which will benefit both you and your teammates and customers.<\/li>\n\n\n\n<li>Structuring your own code as a <strong>package<\/strong> is a good practice that will make it easier to <strong>share and publish the code<\/strong> in the future and installing it in editable mode saves a lot of time, as it updates automatically.<\/li>\n<\/ul>\n\n\n\n<p><strong>Efficiency in code is ultimately efficiency in results.<\/strong><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In line with the previous article \u201cStructure, readability and efficiency in code development\u201d, I add some practical tips to improve Python development practices. As you know, in Capitole we have presence in many different industries. Many of us are in data processing projects, in Data Science \/ Development \/Devops positions and work both on physical &#8230; <a title=\"Code Development Tips: Unit tests, code formatters and stylers and structuring code as a package.\" class=\"read-more\" href=\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/\" aria-label=\"En savoir plus sur Code Development Tips: Unit tests, code formatters and stylers and structuring code as a package.\">Lire la suite<\/a><\/p>\n","protected":false},"author":1,"featured_media":14140,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[49],"tags":[123,100],"class_list":["post-14139","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-1-tag","tag-software"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Code Development Best Practices - Capitole<\/title>\n<meta name=\"description\" content=\"Best practices for your code development! Use unit tests, code formatters, and structured packaging to enhance efficiency and readability.\" \/>\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.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Code Development Best Practices - Capitole\" \/>\n<meta property=\"og:description\" content=\"Best practices for your code development! Use unit tests, code formatters, and structured packaging to enhance efficiency and readability.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/\" \/>\n<meta property=\"og:site_name\" content=\"Capitole\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.linkedin.com\/company\/capitole-consulting\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-25T14:14:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-20T09:47:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"843\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Profile\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@capitolecons\" \/>\n<meta name=\"twitter:site\" content=\"@capitolecons\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Profile\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/\"},\"author\":{\"name\":\"Profile\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/person\/d7b96829eef3e34397feb4016bbb82fb\"},\"headline\":\"Code Development Tips: Unit tests, code formatters and stylers and structuring code as a package.\",\"datePublished\":\"2025-02-25T14:14:31+00:00\",\"dateModified\":\"2025-06-20T09:47:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/\"},\"wordCount\":1223,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png\",\"keywords\":[\"1-tag\",\"Software\"],\"articleSection\":[\"Software\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/\",\"url\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/\",\"name\":\"Code Development Best Practices - Capitole\",\"isPartOf\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png\",\"datePublished\":\"2025-02-25T14:14:31+00:00\",\"dateModified\":\"2025-06-20T09:47:06+00:00\",\"description\":\"Best practices for your code development! Use unit tests, code formatters, and structured packaging to enhance efficiency and readability.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#primaryimage\",\"url\":\"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png\",\"contentUrl\":\"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png\",\"width\":1200,\"height\":843},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.capitole-consulting.com\/fr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Code Development Tips: Unit tests, code formatters and stylers and structuring code as a package.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#website\",\"url\":\"https:\/\/www.capitole-consulting.com\/fr\/\",\"name\":\"Capitole Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.capitole-consulting.com\/fr\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#organization\",\"name\":\"Capitole Consulting\",\"url\":\"https:\/\/www.capitole-consulting.com\/fr\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/01\/logo.png\",\"contentUrl\":\"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/01\/logo.png\",\"width\":800,\"height\":800,\"caption\":\"Capitole Consulting\"},\"image\":{\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/capitole-consulting\/\",\"https:\/\/x.com\/capitolecons\",\"https:\/\/www.youtube.com\/@capitoleconsulting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/person\/d7b96829eef3e34397feb4016bbb82fb\",\"name\":\"Profile\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4f57b47b5461dad1b3a9f593721c39da340405ad05d7ebee2deb2febd34e6990?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4f57b47b5461dad1b3a9f593721c39da340405ad05d7ebee2deb2febd34e6990?s=96&d=mm&r=g\",\"caption\":\"Profile\"},\"sameAs\":[\"https:\/\/capitole-web-app-service-hvcegmd5ejaagmd7.northeurope-01.azurewebsites.net\"],\"url\":\"https:\/\/www.capitole-consulting.com\/fr\/blog\/author\/operations-tech\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Code Development Best Practices - Capitole","description":"Best practices for your code development! Use unit tests, code formatters, and structured packaging to enhance efficiency and readability.","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.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/","og_locale":"fr_FR","og_type":"article","og_title":"Code Development Best Practices - Capitole","og_description":"Best practices for your code development! Use unit tests, code formatters, and structured packaging to enhance efficiency and readability.","og_url":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/","og_site_name":"Capitole","article_publisher":"https:\/\/www.linkedin.com\/company\/capitole-consulting\/","article_published_time":"2025-02-25T14:14:31+00:00","article_modified_time":"2025-06-20T09:47:06+00:00","og_image":[{"width":1200,"height":843,"url":"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png","type":"image\/png"}],"author":"Profile","twitter_card":"summary_large_image","twitter_creator":"@capitolecons","twitter_site":"@capitolecons","twitter_misc":{"\u00c9crit par":"Profile","Dur\u00e9e de lecture estim\u00e9e":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#article","isPartOf":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/"},"author":{"name":"Profile","@id":"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/person\/d7b96829eef3e34397feb4016bbb82fb"},"headline":"Code Development Tips: Unit tests, code formatters and stylers and structuring code as a package.","datePublished":"2025-02-25T14:14:31+00:00","dateModified":"2025-06-20T09:47:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/"},"wordCount":1223,"commentCount":0,"publisher":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/#organization"},"image":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#primaryimage"},"thumbnailUrl":"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png","keywords":["1-tag","Software"],"articleSection":["Software"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/","url":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/","name":"Code Development Best Practices - Capitole","isPartOf":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#primaryimage"},"image":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#primaryimage"},"thumbnailUrl":"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png","datePublished":"2025-02-25T14:14:31+00:00","dateModified":"2025-06-20T09:47:06+00:00","description":"Best practices for your code development! Use unit tests, code formatters, and structured packaging to enhance efficiency and readability.","breadcrumb":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#primaryimage","url":"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png","contentUrl":"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/02\/Code-development-tips_Ines-Olmos.png","width":1200,"height":843},{"@type":"BreadcrumbList","@id":"https:\/\/www.capitole-consulting.com\/fr\/blog\/code-development-tips-unit-tests-code-formatters-and-stylers-and-structuring-code-as-a-package\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.capitole-consulting.com\/fr\/"},{"@type":"ListItem","position":2,"name":"Code Development Tips: Unit tests, code formatters and stylers and structuring code as a package."}]},{"@type":"WebSite","@id":"https:\/\/www.capitole-consulting.com\/fr\/#website","url":"https:\/\/www.capitole-consulting.com\/fr\/","name":"Capitole Consulting","description":"","publisher":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.capitole-consulting.com\/fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/www.capitole-consulting.com\/fr\/#organization","name":"Capitole Consulting","url":"https:\/\/www.capitole-consulting.com\/fr\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/logo\/image\/","url":"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/01\/logo.png","contentUrl":"https:\/\/www.capitole-consulting.com\/wp-content\/uploads\/2025\/01\/logo.png","width":800,"height":800,"caption":"Capitole Consulting"},"image":{"@id":"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/company\/capitole-consulting\/","https:\/\/x.com\/capitolecons","https:\/\/www.youtube.com\/@capitoleconsulting"]},{"@type":"Person","@id":"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/person\/d7b96829eef3e34397feb4016bbb82fb","name":"Profile","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.capitole-consulting.com\/fr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4f57b47b5461dad1b3a9f593721c39da340405ad05d7ebee2deb2febd34e6990?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4f57b47b5461dad1b3a9f593721c39da340405ad05d7ebee2deb2febd34e6990?s=96&d=mm&r=g","caption":"Profile"},"sameAs":["https:\/\/capitole-web-app-service-hvcegmd5ejaagmd7.northeurope-01.azurewebsites.net"],"url":"https:\/\/www.capitole-consulting.com\/fr\/blog\/author\/operations-tech\/"}]}},"_links":{"self":[{"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/posts\/14139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/comments?post=14139"}],"version-history":[{"count":1,"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/posts\/14139\/revisions"}],"predecessor-version":[{"id":18734,"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/posts\/14139\/revisions\/18734"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/media\/14140"}],"wp:attachment":[{"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/media?parent=14139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/categories?post=14139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.capitole-consulting.com\/fr\/wp-json\/wp\/v2\/tags?post=14139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}