<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alessandro Pischedda</title>
    <description>The latest articles on DEV Community by Alessandro Pischedda (@cereal84).</description>
    <link>https://dev.to/cereal84</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F46259%2Fed6c103b-4c5d-43b3-bcf4-1722d0544776.jpeg</url>
      <title>DEV Community: Alessandro Pischedda</title>
      <link>https://dev.to/cereal84</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cereal84"/>
    <language>en</language>
    <item>
      <title>Mustiolo: A Python library for creating CLI applications.</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Mon, 26 May 2025 19:44:15 +0000</pubDate>
      <link>https://dev.to/cereal84/mustiolo-a-python-library-for-creating-cli-applications-33og</link>
      <guid>https://dev.to/cereal84/mustiolo-a-python-library-for-creating-cli-applications-33og</guid>
      <description>&lt;p&gt;A couple of weeks ago, I started to wonder if it is possible to write a library in Python to create a CLI application that uses only standard packages as dependencies.&lt;/p&gt;

&lt;p&gt;The idea seems fun, so I've started to build it.&lt;br&gt;
The main features in my mind were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;command register via decorator,&lt;/li&gt;
&lt;li&gt;autocomplete,&lt;/li&gt;
&lt;li&gt;command history,&lt;/li&gt;
&lt;li&gt;help menu via docstring,&lt;/li&gt;
&lt;li&gt;Use of typing hints and annotations to retrieve:

&lt;ul&gt;
&lt;li&gt;mandatory/optional parameter&lt;/li&gt;
&lt;li&gt;parameter type (and check types).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Long road to accomplish something more complete, like sub-commands.&lt;/p&gt;
&lt;h2&gt;
  
  
  The meaning of the name
&lt;/h2&gt;

&lt;p&gt;The 'mustiolo' is the smallest mammal in the world, weighing about 1.2-2.5 grams as an adult. &lt;br&gt;
It is present in Sardinia, in the Italian, Balkan, Iberian peninsulas, and in North Africa.&lt;/p&gt;

&lt;p&gt;This library aims to be the smallest library for building CLI applications in Python just like a mustiolo is the smallest mammal.&lt;/p&gt;
&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;mustiolo.cli&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;CLI&lt;/span&gt;

&lt;span class="n"&gt;cli&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;CLI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nd"&gt;@cli.command&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Greet a user by name.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@cli.command&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Add two numbers and print the result.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The result is: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;cli&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This example allows to have&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ?
greet    Greet a user by name.
add      Add two numbers and print the result.
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ? add
Usage add Add two numbers and print the result.

add A B

Parameters:
        A   Type INTEGER &lt;span class="o"&gt;[&lt;/span&gt;required]
        B   Type INTEGER &lt;span class="o"&gt;[&lt;/span&gt;required]
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;exit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're interested please visit &lt;a href="https://github.com/Cereal84/mustiolo" rel="noopener noreferrer"&gt;Mustilo&lt;/a&gt; repository on GitHub.&lt;/p&gt;

</description>
      <category>python</category>
      <category>cli</category>
    </item>
    <item>
      <title>Hacktoberfest from a maintainer's point of view</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Thu, 10 Oct 2024 13:16:53 +0000</pubDate>
      <link>https://dev.to/cereal84/hacktoberfest-from-a-maintainers-point-of-view-285a</link>
      <guid>https://dev.to/cereal84/hacktoberfest-from-a-maintainers-point-of-view-285a</guid>
      <description>&lt;p&gt;This time I've decided to participate in Hacktoberfest as a project maintainer.&lt;/p&gt;

&lt;p&gt;The project is (AnadiCSV)[&lt;a href="https://github.com/Cereal84/AnadiCSV" rel="noopener noreferrer"&gt;https://github.com/Cereal84/AnadiCSV&lt;/a&gt;] a simple tool to query data from a CSV file via SQL query.&lt;/p&gt;

&lt;p&gt;AnadiCSV is written in Python and uses DuckDB and Textual, the project was submitted to the hacktoberfest in an embryonic state. The idea was to take advantage of the hacktoberfest for two reasons: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;learn to manage a project with 'external' contributors&lt;/li&gt;
&lt;li&gt;improve the code letting the people contribute.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now some lessons that I've learned until now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write detailed issues
&lt;/h2&gt;

&lt;p&gt;Even if the issue is crystal clear for you it does not mean that is the same for external contributors, especially if they are not experienced ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try to have a dialogue on the issue
&lt;/h2&gt;

&lt;p&gt;Details can be not enough, it is better to start a dialogue in order to be sure that everyone understands the work to do.&lt;/p&gt;

&lt;h2&gt;
  
  
  CONTRIBUTING file is important
&lt;/h2&gt;

&lt;p&gt;I've always ignored this file in my repositories instead if you want to help people contribute is quite important, you can write the way you expect they work, the rules to follow, and sometimes which is the logic behind some section (i.e. if you want to add a cli option which are all the files involved if it is not so clear in the code).&lt;/p&gt;

&lt;h2&gt;
  
  
  Doing a poor code review is not a good idea
&lt;/h2&gt;

&lt;p&gt;Sometimes you are in a hurry but you want to merge some PR as soon as possible; you read the PR quickly and it seems to be alright, skip some files because you forget about them or because you think that the changes will be so simple that surely they are correct.&lt;br&gt;
Obviously, they will break the repository :).&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Actions are good
&lt;/h2&gt;

&lt;p&gt;Adding some checks like code formatter, linter, etc is a good idea to avoid doing those things during the code review and let you focus on important things.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Until now I've learned a lot and I'm happy to have started this project and suggest to anyone to try to do the same.&lt;/p&gt;

&lt;p&gt;For anyone who is looking for issues on hacktoberfest please come and visit us :).&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>python</category>
      <category>csv</category>
    </item>
    <item>
      <title>Hacktoberfest: AnadiCSV project</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Tue, 24 Sep 2024 13:51:24 +0000</pubDate>
      <link>https://dev.to/cereal84/hacktoberfest-anadicsv-project-4afe</link>
      <guid>https://dev.to/cereal84/hacktoberfest-anadicsv-project-4afe</guid>
      <description>&lt;p&gt;Hi everyone,&lt;br&gt;
I wrote a tool called &lt;em&gt;&lt;a href="https://github.com/Cereal84/AnadiCSV" rel="noopener noreferrer"&gt;AnadiCSV&lt;/a&gt;&lt;/em&gt; which allows you to use SQL query on CSV files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4nrhs062ycri3y8s4m32.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4nrhs062ycri3y8s4m32.png" alt="Image description" width="800" height="436"&gt;&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;This tool is written in Python using Textual as UI library and DuckDB to handle CSV data, at the moment works on Docker container.&lt;br&gt;
I think this project can be a good start to partecipates in Hacktoberfest, it is already a couple of open &lt;a href="https://github.com/Cereal84/AnadiCSV/issues" rel="noopener noreferrer"&gt;issues&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;[UPDATE]&lt;br&gt;
After few days many issues are taken from different users, I'm happy to see people contributing ton the project :).&lt;/p&gt;

&lt;p&gt;Thank you everyone&lt;/p&gt;

</description>
      <category>python</category>
      <category>hacktoberfest</category>
    </item>
    <item>
      <title>LinkedIn Support Added to FastAPI-SSO!</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Wed, 14 Feb 2024 12:00:00 +0000</pubDate>
      <link>https://dev.to/cereal84/linkedin-support-added-to-fastapi-sso-3lih</link>
      <guid>https://dev.to/cereal84/linkedin-support-added-to-fastapi-sso-3lih</guid>
      <description>&lt;p&gt;Hi everybody,&lt;br&gt;
in my previous &lt;a href="https://dev.to/cereal84/build-a-personal-project-is-a-good-thing-hgk"&gt;post&lt;/a&gt; I talked about the importance of developing a side project and how this can help you to contribute to an open-source project.&lt;/p&gt;

&lt;p&gt;In that case, I added the support to GitLab into &lt;a href="https://github.com/tomasvotava/fastapi-sso"&gt;fastapi-sso&lt;/a&gt; library. In the comments, &lt;a class="mentioned-user" href="https://dev.to/fpischedda"&gt;@fpischedda&lt;/a&gt; suggested integrating LinkedIn SSO, guess what? I did it again, I've added the support to LinkedIn SSO into the fastapi-sso library and used it in my project &lt;a href="https://breves.it/"&gt;Breves&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this way I've accomplished 2 things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;another contribution to the open-source world&lt;/li&gt;
&lt;li&gt;let the user of Breves login and signup via LinkedIn.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I would ask the DEV.to community to suggest other features I can add.&lt;/p&gt;

&lt;p&gt;Thank you :)&lt;/p&gt;

&lt;p&gt;P.S. fastapi-sso is growing in importance by integrating more and more SSO providers both thanks to its creator and external contributions from other developers.&lt;br&gt;
The code is well written and the community that is springing up around it is very friendly.&lt;br&gt;
For these reasons, I suggest anyone who wants to approach the world of open-source try to make some contributions &lt;/p&gt;

</description>
      <category>breves</category>
      <category>fastapi</category>
      <category>fastapisso</category>
      <category>linkedin</category>
    </item>
    <item>
      <title>Let's meet Pylint: Python Linter</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Mon, 12 Feb 2024 11:00:00 +0000</pubDate>
      <link>https://dev.to/cereal84/lets-meet-pylint-python-linter-47gh</link>
      <guid>https://dev.to/cereal84/lets-meet-pylint-python-linter-47gh</guid>
      <description>&lt;p&gt;After the post about &lt;a href="https://dev.to/cereal84/lets-meet-black-python-code-formatting-2n6n?preview=8e6d3832c4ee962658e87545120d063e0dd9b7209b85efca44cfaa2c9f3dca71609a009ec342b33763b42628cd5610affaec2ac9ad5e2647490a5d18"&gt;Black&lt;/a&gt; (a formatter for Python) today we'll talk about another tool, Pylint (plus one you can find at the end before the "Conclusion" section).&lt;/p&gt;

&lt;p&gt;Pylint is a linter... ok, a step back, what is a linter?&lt;/p&gt;

&lt;p&gt;A linter is a static code analyzer used to find programming errors, bugs, stylistic errors, and suspicious constructs. This kind of tool can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;find syntax errors&lt;/li&gt;
&lt;li&gt;find unused variables and undeﬁned variables&lt;/li&gt;
&lt;li&gt;unused import&lt;/li&gt;
&lt;li&gt;enforce consistent coding practice&lt;/li&gt;
&lt;li&gt;etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find the full list of checks &lt;a href="https://pylint.readthedocs.io/en/latest/user_guide/checkers/features.html"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So helps to find some problems earlier contributing to higher-quality code.&lt;br&gt;
It is better to specify, that the real improvement in quality code happens only by the developer writes a code more readable, uses the right design patterns, etc.&lt;/p&gt;

&lt;p&gt;Usually, the linter builds a report about the code quality according to the guidelines used to configure it.&lt;/p&gt;

&lt;p&gt;Due Python is an interpreted language a linter is useful for finding some errors before running the code.&lt;/p&gt;
&lt;h2&gt;
  
  
  Basic
&lt;/h2&gt;

&lt;p&gt;As usual, the first step is to install it, you can do it in your system or in a virtual environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install pylint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The easiest way to run it is to run it file by file or in a directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pylint {source_file_or_directory}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code will be rated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;\-----------------------------------

Your code has been rated at 4.10/10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Options
&lt;/h2&gt;

&lt;p&gt;By default, all the checks are enabled.&lt;/p&gt;

&lt;h3&gt;
  
  
  --disable=all
&lt;/h3&gt;

&lt;p&gt;Disable all the checks.&lt;/p&gt;

&lt;h3&gt;
  
  
  --disable=id
&lt;/h3&gt;

&lt;p&gt;Disable a specific check.&lt;br&gt;
You can specify more checks by using commas&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     --disable=&amp;lt;id_1&amp;gt;,&amp;lt;id_2&amp;gt;,...,&amp;lt;id_N&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  --enable=id
&lt;/h3&gt;

&lt;p&gt;Works exactly like the disable option.&lt;/p&gt;

&lt;h3&gt;
  
  
  --ignore=
&lt;/h3&gt;

&lt;p&gt;Ignore one or more files.&lt;/p&gt;

&lt;p&gt;for a full list of options please use &lt;em&gt;--help&lt;/em&gt; option or check the &lt;a href="https://docs.pylint.org/run.html#command-line-options"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuration
&lt;/h2&gt;

&lt;p&gt;Pylint supports a configuration file with all the configuration you need. To use it you need to place a file called &lt;em&gt;.pylintrc&lt;/em&gt; or &lt;em&gt;pylintrc&lt;/em&gt; into your directory.&lt;/p&gt;

&lt;p&gt;Well, Pylint searches for this kind of file by looking in the following directory order and uses the first one it found:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;working directory&lt;/li&gt;
&lt;li&gt;The file named by environment variable PYLINTRC&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;.pylintrc&lt;/em&gt; in your home directory&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Plugin
&lt;/h2&gt;

&lt;p&gt;It is possible to extend the behavior of Pylint using or writing plugins.&lt;/p&gt;

&lt;p&gt;This topic is out of the scope of this post but you can find all the information and examples in the &lt;a href="https://docs.pylint.org/plugins.html"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  My 2 Cents
&lt;/h2&gt;

&lt;p&gt;Someone uses this rate as a quality gate, this means that if the code does not reach a threshold then is not possible to push the code into a branch, create PR, etc.&lt;/p&gt;

&lt;p&gt;In my opinion, if you want to use that as a quality gate do not use it as a threshold for a full score, or better do not use it as a quality gate :D. Remember that a full score does not mean that the code has high quality.&lt;/p&gt;

&lt;p&gt;It can be a useful tool if used together with pre-commit because it can prevent you from sending code with some errors/problems by easing the code review. And it can be very useful to the newly hired especially if they are junior position.&lt;/p&gt;

&lt;p&gt;Pylint likes the f-string instead of the use of &lt;em&gt;"".format()&lt;/em&gt;&lt;br&gt;
so I suggest to use &lt;a href="https://github.com/ikamensh/flynt"&gt;flynt&lt;/a&gt; before pylint. This tool replaces "%-formatted" and .format(...) strings into f-strings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Like every tool it can be helpful if used correctly or slow down the work if used wrongly.&lt;/p&gt;

&lt;p&gt;In any case, I recommend anyone to use this type of tool at least once; but don't do it on projects with a large codebase because it could be frustrating, in that case run it on one or a few files at a time.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tools</category>
      <category>pylint</category>
    </item>
    <item>
      <title>Let's meet Black: Python Code Formatting</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Wed, 07 Feb 2024 11:00:00 +0000</pubDate>
      <link>https://dev.to/cereal84/lets-meet-black-python-code-formatting-2n6n</link>
      <guid>https://dev.to/cereal84/lets-meet-black-python-code-formatting-2n6n</guid>
      <description>&lt;p&gt;While each developer may have different preferences for coding style, the importance of a unified style is very important for maintaining readable code.&lt;br&gt;
This has a bigger importance if you think of a project in which many developers are involved.&lt;/p&gt;

&lt;p&gt;In Python exists the 'Style Guide for Python Code' known as &lt;a href="https://peps.python.org/pep-0008/"&gt;PEP 8&lt;/a&gt;, which recommends specific code conventions to maintain a standardized code format.&lt;br&gt;
This style guide is about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;indentation&lt;/li&gt;
&lt;li&gt;imports&lt;/li&gt;
&lt;li&gt;max line length&lt;/li&gt;
&lt;li&gt;name conventions&lt;/li&gt;
&lt;li&gt;comments&lt;/li&gt;
&lt;li&gt;etc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the realm of Python development, there is a multitude of code formatters that adhere to PEP 8 guidelines. Today, we will briefly discuss how to install and utilize &lt;a href="https://black.readthedocs.io/en/stable/"&gt;black&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Basics
&lt;/h2&gt;

&lt;p&gt;Let's stop talking and get our hands dirty because it's a great way to learn.&lt;/p&gt;

&lt;p&gt;First of all, let's install it using pip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;black
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed, to use it, just execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;black &lt;span class="o"&gt;{&lt;/span&gt;source_file_or_directory&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will initiate black with the standard configuration and reformat all the Python files it finds.&lt;/p&gt;

&lt;h3&gt;
  
  
  Options
&lt;/h3&gt;

&lt;p&gt;As you can see running Black is quite simple but what if we want not to change the file/s but perform only a check ?&lt;br&gt;
We can use the options furnished by Black.&lt;/p&gt;
&lt;h4&gt;
  
  
  --check
&lt;/h4&gt;

&lt;p&gt;Do not change the file but return only the exit value:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;0, nothing to change&lt;/li&gt;
&lt;li&gt;1, some files would be reformatted&lt;/li&gt;
&lt;li&gt;123, an internal error occurred.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;black &lt;span class="nt"&gt;--check&lt;/span&gt; main.py 
would reformat main.py

Oh no! 💥 💔 💥
1 file would be reformatted.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  --diff
&lt;/h4&gt;

&lt;p&gt;Even this command does not reformat the files but prints the diff which indicates the changes.&lt;br&gt;
[Note]: use --color if you want colored diff.&lt;/p&gt;

&lt;p&gt;I suggest reading the &lt;a href="https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html"&gt;documentation&lt;/a&gt; for a complete list of options.&lt;br&gt;
In my opinion some of the most useful are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;--required-version&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;--exclude&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="p"&gt;black --diff --color main.py 
&lt;/span&gt;&lt;span class="gd"&gt;--- main.py 2023-09-08 21:03:49.860827+00:00
&lt;/span&gt;&lt;span class="gi"&gt;+++ main.py 2024-02-04 22:31:31.130282+00:00
&lt;/span&gt;&lt;span class="p"&gt;@@ -5,29 +5,31 @@&lt;/span&gt;
 from starlette.middleware.base import BaseHTTPMiddleware
&lt;span class="err"&gt;
&lt;/span&gt; from app.frontend import pages
&lt;span class="gd"&gt;-from app.core import config 
&lt;/span&gt;&lt;span class="gi"&gt;+from app.core import config
&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;span class="gd"&gt;-app.include_router(pages.router, prefix='')
&lt;/span&gt;&lt;span class="gi"&gt;+app.include_router(pages.router, prefix="")
&lt;/span&gt;&lt;span class="gd"&gt;-
-
-
-
-
&lt;/span&gt;&lt;span class="p"&gt;would reformat main.py
&lt;/span&gt;&lt;span class="err"&gt;
&lt;/span&gt;&lt;span class="p"&gt;All done! ✨ 🍰 ✨
1 file would be reformatted.
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configuration
&lt;/h2&gt;

&lt;p&gt;If you want to customize the configuration of Black you can remember the list of the options or configure it using a configuration file.&lt;/p&gt;

&lt;p&gt;Black uses by default the &lt;a href="https://github.com/toml-lang/toml"&gt;&lt;em&gt;pyproject.toml&lt;/em&gt;&lt;/a&gt; file.&lt;br&gt;
This file contains a section for each different tool we want to use. The use of a configuration file like pyproject.toml is quite a good choice and helps the contributors to use the same tools and configurations you're using.&lt;/p&gt;

&lt;p&gt;Black uses &lt;em&gt;[tool.black]&lt;/em&gt; section, the option names/keys are the same as the long names of options used in the command line. Below you can see an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[tool.black]&lt;/span&gt;
&lt;span class="py"&gt;line-length&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;
&lt;span class="py"&gt;target-version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'py37'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We've explored, briefly, the formatted called &lt;strong&gt;Black&lt;/strong&gt; talking about the aim of this tool, how to use and how to configure it using a configuration file.&lt;br&gt;
I hope this post can help you to improve your repository and code.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tools</category>
    </item>
    <item>
      <title>Build a personal project is a good thing</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Mon, 14 Aug 2023 14:12:08 +0000</pubDate>
      <link>https://dev.to/cereal84/build-a-personal-project-is-a-good-thing-hgk</link>
      <guid>https://dev.to/cereal84/build-a-personal-project-is-a-good-thing-hgk</guid>
      <description>&lt;p&gt;Hi everyone,&lt;br&gt;
I'm Alessandro, the developer behind &lt;a href="https://breves.it/"&gt;Breves&lt;/a&gt; a service for developers.You can find more details in this &lt;a href="https://dev.to/cereal84/brevesit-a-service-that-can-help-you-to-avoid-uninteresting-job-position-1ll3"&gt;post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A while back, I pondered the idea of modernizing the existing signup/login process by implementing Single Sign-On (SSO) capabilities. This shift aimed to streamline the login procedure and enhance user experience.&lt;/p&gt;

&lt;p&gt;The service is crafted using Python and &lt;a href="https://fastapi.tiangolo.com/"&gt;FastAPI&lt;/a&gt;, this led me to  SSO-supporting libraries. Given the developer-centric nature of the service, I set my sights on integrating GitHub SSO at the very least. &lt;/p&gt;

&lt;p&gt;After some searching, I stumbled upon &lt;a href="https://github.com/tomasvotava/fastapi-sso"&gt;fastapi-sso&lt;/a&gt; This library proved to be elegantly straightforward, with well-crafted examples. Encouraged by its capabilities, I decided to retire the previous signup/login mechanism in favor of GitHub SSO. The transition was seamless, and everything appeared to be sailing smoothly.&lt;/p&gt;

&lt;p&gt;Everything seems fine except....  Why didn't login via GitLab too?&lt;/p&gt;

&lt;p&gt;Regrettably, fastapi-sso lacked GitLab support, and I was hesitant to switch libraries. But every challenge brings an opportunity. This marked the perfect juncture to contribute to an open-source project :).&lt;/p&gt;

&lt;p&gt;The process of contributing turned out to be surprisingly straightforward, as showcased in the &lt;a href="https://github.com/tomasvotava/fastapi-sso/pull/43"&gt;PR&lt;/a&gt;.&lt;br&gt;
During the process I've learn something very usefull by following the guide lines in "CONTRIBUTING.md" file which I used in my job too.&lt;/p&gt;

&lt;p&gt;Embarking on personal projects has numerous advantages. Not only do they enable skill growth across various domains – from mastering new frameworks to becoming adept with different libraries – but they also open doors to contributing to previously unknown open-source ventures.&lt;/p&gt;

&lt;p&gt;My recommendation? Build something you're passionate about. Moreover, allow yourself the freedom to dive into contributing to diverse projects.&lt;/p&gt;

&lt;p&gt;Please let me know if you want other SSO providers in my service (or in fastapi-sso library), such as &lt;a href="https://bitbucket.org/"&gt;BitBucket&lt;/a&gt; or others.&lt;/p&gt;

&lt;p&gt;Best regards,&lt;br&gt;
Alessandro&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>learning</category>
      <category>showdev</category>
      <category>sideprojects</category>
    </item>
    <item>
      <title>map() - how processing iterable without a loop</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Mon, 16 Jan 2023 13:03:47 +0000</pubDate>
      <link>https://dev.to/cereal84/map-how-processing-iterable-without-a-loop-2o03</link>
      <guid>https://dev.to/cereal84/map-how-processing-iterable-without-a-loop-2o03</guid>
      <description>&lt;p&gt;It is common to have to work with list or iterable by manipulating the values of their elements. Usually, this is done by using a for loop or a list comprehension but&lt;br&gt;
Python allows the user to do that using a mapping technique via the built-in function &lt;em&gt;map()&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The syntax is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;function&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;iterable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function can be useful in a variety of situations, including&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;transforming data&lt;/li&gt;
&lt;li&gt;performing calculation&lt;/li&gt;
&lt;li&gt;combining multiple iterables.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Following we'll see some, very, simple examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Transforming data
&lt;/h2&gt;

&lt;p&gt;You can use it to uppercase a string or convert a list of integer in string format into int type.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example 1&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;upper_char&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;char&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;char&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upper&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;lower_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hello world&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;upper_char&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lower_str&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;span class="c1"&gt;# 'HELLO WORLD'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Example 2&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;input_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;4&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;input_int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;input_str&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input_int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# [1, 2, 3, 4]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last one can be usefull when you have to parse a numeric input read from a file or stdin (standard input). I.e. if you have tried to  solve &lt;a href="https://adventofcode.com/" rel="noopener noreferrer"&gt;AoC&lt;/a&gt;  (Adventure of Code) exercises you have to parse a file and convert data from string to int.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performing calculation
&lt;/h2&gt;

&lt;p&gt;Calculate the square value for each element of a list of int.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;square&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;square&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;span class="c1"&gt;# [1, 4, 9, 16]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Combining multiple iterables
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;map()&lt;/em&gt; can be used to apply a function to corresponding elements of multiple iterables. &lt;br&gt;
In fact the real syntax is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;function&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;iterable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;iterables&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see it can accept more than one iterable and in that case, it pass a single item for each iterator to the function in parallel.&lt;br&gt;
For example, you can use &lt;em&gt;map()&lt;/em&gt; to add corresponding elements of two lists together, or perform other types of operations on multiple iterables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_elements&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;

&lt;span class="n"&gt;list_1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;list_2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;add_elements&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;list_1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;list_2&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;span class="c1"&gt;# [3, 7, 11, 15]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If more iterables are passed to &lt;em&gt;map()&lt;/em&gt; it stops when the shortest iterable is exhausted.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In summary, the &lt;em&gt;map()&lt;/em&gt; function is a useful tool for manipulating data. By allowing you to apply a function to each element of an iterable, it enables you to make transformations, perform calculations, and combine multiple iterables in a concise and efficient manner. This versatility makes it a valuable tool.&lt;/p&gt;

</description>
      <category>python</category>
      <category>pylls</category>
    </item>
    <item>
      <title>Breves.it - a service that can help you to avoid uninteresting job position</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Fri, 13 May 2022 13:52:56 +0000</pubDate>
      <link>https://dev.to/cereal84/brevesit-a-service-that-can-help-you-to-avoid-uninteresting-job-position-1ll3</link>
      <guid>https://dev.to/cereal84/brevesit-a-service-that-can-help-you-to-avoid-uninteresting-job-position-1ll3</guid>
      <description>&lt;p&gt;Hi,&lt;br&gt;
after getting tired of numerous cognitive interviews for job positions that did not match my profile, I decided to build a service that helps me select potentially interesting job positions and those to avoid without having to do cognitive interviews.&lt;br&gt;
The service is very simple but very useful. It allows the user to write a questionnaire to share with a recruiter / headhunter, and based on the answers, decide whether or not to continue with the cognitive interview.&lt;/p&gt;

&lt;p&gt;The service is available &lt;a href="https://breves.it/?campaign=devto"&gt;here&lt;/a&gt; and it is completely free.&lt;/p&gt;

&lt;p&gt;feedbacks are appreciated :)&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>sideprojects</category>
    </item>
    <item>
      <title>SHOWDEV: data-bubbles</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Mon, 26 Apr 2021 09:29:42 +0000</pubDate>
      <link>https://dev.to/cereal84/showdev-data-bubbles-4924</link>
      <guid>https://dev.to/cereal84/showdev-data-bubbles-4924</guid>
      <description>&lt;p&gt;Hello everyone,&lt;br&gt;
I want to show you &lt;a href="https://data-bubbles.it"&gt;data-bubble.it&lt;/a&gt;, a service which I've built in my spare time in the last 3 weeks.&lt;br&gt;
The service allows a user to share text and images with others; the data is reachable by URL or API REST and it is available for 10 minutes or until a user retrieves it.&lt;/p&gt;

&lt;p&gt;At now only the free plan is available, I'm still working on the user registration to furnish the payment version too.&lt;/p&gt;

&lt;p&gt;I want to ask you what you think about the service and some feedback to improve it.&lt;/p&gt;

&lt;p&gt;Thank you.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>news</category>
      <category>help</category>
    </item>
    <item>
      <title>How to reduce compile time using Docker as dev environment on C++</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Sun, 21 Jun 2020 09:08:52 +0000</pubDate>
      <link>https://dev.to/cereal84/how-to-reduce-compile-time-using-docker-as-dev-environment-on-c-3kgm</link>
      <guid>https://dev.to/cereal84/how-to-reduce-compile-time-using-docker-as-dev-environment-on-c-3kgm</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hKzKqOVA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cerealtree.files.wordpress.com/2020/06/docker.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hKzKqOVA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cerealtree.files.wordpress.com/2020/06/docker.png" alt="hacktober" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h2&gt;Abstract&lt;/h2&gt;

&lt;p&gt;In this post I'll show how to avoid to wasting your time rebuilding a fresh new image every time you make a small change in your code. &lt;span&gt;&lt;span title=""&gt;The reference language is C ++&lt;/span&gt;&lt;/span&gt; but the proposed solution can be used for  every compiled languages and project which require time consuming building process.&lt;/p&gt;

&lt;h2&gt;Problem&lt;/h2&gt;

&lt;p&gt;Best practices suggest to use multi-stage Dockerfile copying all the source code in the builder stage, compile it and then copy the binary file on next stage. This approach makes sense in production instead while you're in dev mode and you're forced to use the container to compile and makes test has a great problem.
Every time you make a small change in the source code this means a fresh new Docker image; even if the rebuild uses previous layer and just recompile whole the project this can be a problem if it is time consuming requiring several minutes to recompile.&lt;/p&gt;

&lt;p&gt;If you're in dev mode waiting for several minutes every time you make a simple change can be annoying.&lt;/p&gt;

&lt;h2&gt;Idea&lt;/h2&gt;

&lt;p&gt;It will be great to recompile only the files with the changes just like when you're developing and compiling on your system. In order to do this the source code is stored inside the host's file system and mounted as volume by the container. This guarantee that all the object files are not looses and b reused on next compile processes.&lt;/p&gt;

&lt;p&gt;Hence the idea is to have a container with the following features:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;have all the necessary to compile&lt;/li&gt;
    &lt;li&gt;recompile only the changes on source code&lt;/li&gt;
    &lt;li&gt;generate the binary file on host's file system&lt;/li&gt;
    &lt;li&gt;there is no need to rebuild the image to generate the binary file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This container will be a "binary generator" and it's purpose  its to generate a new binary file without recompile whole the project. Then use new binary file to create the runtime docker image.&lt;/p&gt;

&lt;h2&gt;Solution&lt;/h2&gt;

&lt;p&gt;In order to better explain my solution I have created a simple "Hello world" project that you can find &lt;a href="https://github.com/Cereal84/cpp_docker_env_example"&gt;here&lt;/a&gt;. The tree of the project is the following:&lt;/p&gt;

&lt;pre&gt;    .
    ├── core.cpp
    ├── core.hpp
    ├── dev_env
    │   ├── builder
    │   │   ├── docker-compose.yml
    │   │   └── Dockerfile
    │   └── runtime
    │       ├── docker-compose.yml
    │       └── Dockerfile
    ├── docker-compose.yml
    ├── Dockerfile
    ├── main.cpp
    ├── Makefile
    └── README.md
&lt;/pre&gt;

&lt;p&gt;The Dockerfile and docker-compose.yml at the root level show a single stage build process that will show the original problem: changing one file will rebuild the the whole process, which is what we are trying to avoid.&lt;/p&gt;

&lt;p&gt;In the dev_env directory we can find the proposed solution:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;the builder directory contains the Dockerfile and docker-compose to generate the builder container (the one used to generate the binary file).&lt;/li&gt;
    &lt;li&gt; the runtime directory contains all the necessary to build test or runtime image.
Instead the runtime contains all the necessary to build &lt;em&gt;test&lt;/em&gt; or &lt;em&gt;runtime&lt;/em&gt; image.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Builder directory&lt;/h3&gt;

&lt;h4&gt;docker-compose.yml&lt;/h4&gt;

&lt;pre&gt;version: '2.3'

services:
   
    binary_builder:
        container_name: "binary_builder"
        image: binary_builder
        build:
            dockerfile: ./dev_env/builder/Dockerfile
            context: ../../
            args:
                src_path: /src
        volumes:
            - ../.././:/src:rw
&lt;/pre&gt;

&lt;p&gt;As you can see on the src directory, on container, is mounted the root of the project, source code included.&lt;/p&gt;

&lt;h4&gt;Dockerfile&lt;/h4&gt;

&lt;pre&gt;    FROM ubuntu:18.04
    ARG src_path=/src
            
    RUN apt-get update                          &amp;amp;&amp;amp; \ 
        apt-get install -y                         \
        g++ build-essential
     
     RUN mkdir -p $src_path
     WORKDIR $src_path
     CMD     make
&lt;/pre&gt;

&lt;p&gt;The Dockerfile is quite simple it takes the source code from &lt;em&gt;$src_path&lt;/em&gt; and the compile it (if necessary) every time it will be started. Another advantage is that it is not necessary to rebuild the builder container to generate a new binary.&lt;/p&gt;

&lt;h3&gt;Runtime directory&lt;/h3&gt;

&lt;p&gt;The Dockerfile is very simple, use the same base image used in builder level and copy the binary file from the host file system.&lt;/p&gt;

&lt;h4&gt;Dockerfile&lt;/h4&gt;

&lt;pre&gt;    FROM ubuntu:18.04 as run_time
    COPY  hello_world /hello_world
    WORKDIR /
    CMD ./hello_world
&lt;/pre&gt;

&lt;p&gt;The advantage is that to rebuild the runtime container you have to generate a new binary file and copy it on the new image saving time.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;I hope this article has helped you.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>cpp</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Repositories for Hacktoberfest2019</title>
      <dc:creator>Alessandro Pischedda</dc:creator>
      <pubDate>Fri, 11 Oct 2019 09:59:12 +0000</pubDate>
      <link>https://dev.to/cereal84/quick-repositories-for-hacktoberfest2019-36pa</link>
      <guid>https://dev.to/cereal84/quick-repositories-for-hacktoberfest2019-36pa</guid>
      <description>&lt;p&gt;Hi,&lt;br&gt;
in order to help people to find, quickly, some issues for the hacktoberfest I thought to create a post where all of you can post your projects. &lt;br&gt;
The format should be something like:&lt;/p&gt;

&lt;p&gt;LEVEL &lt;br&gt;
Link to the repo - [languages, mini description, tags]&lt;/p&gt;

&lt;p&gt;In example today I've add some issues on my old respository&lt;/p&gt;

&lt;p&gt;Beginner&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Cereal84/github_text_search_chrome_ext"&gt;github_text_search&lt;/a&gt; - [javascript, chrome extension].&lt;/p&gt;

&lt;p&gt;I hope this initiative can help some of you.&lt;/p&gt;

</description>
      <category>hacktoberfest2019</category>
    </item>
  </channel>
</rss>
