<?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: Mario Hernandez</title>
    <description>The latest articles on DEV Community by Mario Hernandez (@mariofix).</description>
    <link>https://dev.to/mariofix</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%2F445577%2Ff5b4fb25-45c9-4af1-9906-52b60cd24c53.jpg</url>
      <title>DEV Community: Mario Hernandez</title>
      <link>https://dev.to/mariofix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mariofix"/>
    <language>en</language>
    <item>
      <title>Python Typing, between 3.6 and 3.7</title>
      <dc:creator>Mario Hernandez</dc:creator>
      <pubDate>Sat, 19 Sep 2020 02:21:52 +0000</pubDate>
      <link>https://dev.to/mariofix/python-typing-between-3-6-and-3-7-4374</link>
      <guid>https://dev.to/mariofix/python-typing-between-3-6-and-3-7-4374</guid>
      <description>&lt;p&gt;I recently discovered that Python has Typing for classes and functions, so yeeeiii  &lt;/p&gt;

&lt;p&gt;but I have a little problem with backwards compatibility&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;.utils&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;StdReturn&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;simpleFunc&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="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;StdReturn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;""" My Awesome Function """&lt;/span&gt;
  &lt;span class="n"&gt;ret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;StdReturn&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;ret&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This example works fine in Python 3.7 and 3.8 (with an extra import)   &lt;/p&gt;

&lt;p&gt;And the Python 3.6 way is like this (with no extra imports)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;.utils&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;StdReturn&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;simpleFunc&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="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="s"&gt;"StdReturn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="s"&gt;""" My Awesome Function """&lt;/span&gt;
  &lt;span class="n"&gt;ret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;StdReturn&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;ret&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I'm OK with using one way or the other, but if I want to have Support from 3.6 and up, how should i do it? All my searches take me to configure virtualenv and install different versions of python in the system and not fragmentation within my python package.  &lt;/p&gt;

&lt;p&gt;I'm leaning to use files for 3.6 and another source for 3.7, but it's very hard to maintain different versions within the code. Do you know if there is a python way to do this?  &lt;/p&gt;

&lt;p&gt;PS: The example code is not copy paste, they are just as an example&lt;/p&gt;

</description>
      <category>python</category>
      <category>help</category>
    </item>
    <item>
      <title>Open Source Project: from idea to package</title>
      <dc:creator>Mario Hernandez</dc:creator>
      <pubDate>Sat, 15 Aug 2020 03:29:30 +0000</pubDate>
      <link>https://dev.to/mariofix/open-source-project-from-idea-to-package-pl1</link>
      <guid>https://dev.to/mariofix/open-source-project-from-idea-to-package-pl1</guid>
      <description>&lt;p&gt;So, it's time you -yes, you, the one writing this- should give something back to the opensource community that you like and never contributed.&lt;/p&gt;

&lt;p&gt;Let's begin then, what would you like to do? Oh, you don't know? It's too simple? There are tons of options? OK OK, relax, dial back, didn't you said you needed to code that api client because there wasn't on PyPi? Why don't you code that? Cool!&lt;/p&gt;

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

&lt;p&gt;First you need to set up virtualenv for that, and i think you'll need &lt;strong&gt;requests&lt;/strong&gt; for th... poetry? &lt;a href="https://dev.to/t/poetry"&gt;&lt;strong&gt;what's that?&lt;/strong&gt;&lt;/a&gt;, oh nice!&lt;/p&gt;

&lt;p&gt;After you install poetry, create the project with &lt;em&gt;poetry new project-name&lt;/em&gt;. This API Client it' supposed to connect to flow.cl a payment broker? and &lt;strong&gt;PyFlow&lt;/strong&gt; it's the best name you could think of? Let's better name it &lt;strong&gt;PyFlowCL&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;poetry new pyflowcl
Created package pyflowcl &lt;span class="k"&gt;in &lt;/span&gt;pyflowcl
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You should have a folder called &lt;strong&gt;pyflowcl&lt;/strong&gt; with everything you need to start, now we need to make the GIT Repo.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;pyflowcl
&lt;span class="nv"&gt;$ &lt;/span&gt;git init
Initialized empty Git repository &lt;span class="k"&gt;in&lt;/span&gt; /home/mariofix/pyflowcl/.git/
&lt;span class="nv"&gt;$ &lt;/span&gt;git remote add github git@github.com:mariofix/pyflowcl.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And that's it really, start coding and we'll pick up down the road.&lt;/p&gt;
&lt;h2&gt;
  
  
  A few considerations
&lt;/h2&gt;

&lt;p&gt;Since this is not a private project, you should consider reading about PEPs (or PSR as you know in PHP), which are proposals for Python, among the most interesting -for me- are &lt;a href="https://www.python.org/dev/peps/pep-0008/"&gt;PEP-8&lt;/a&gt;, &lt;a href="https://www.python.org/dev/peps/pep-0257/"&gt;PEP-257&lt;/a&gt;, &lt;a href="https://www.python.org/dev/peps/pep-0020/"&gt;PEP-20&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Don't be afraid to look up other projects, you don't know everything and you might get inspired, you can even take someone else's code and start from there (you can fork &lt;strong&gt;PyKhipu&lt;/strong&gt; and modify it to make it usable with Flow) whatever you choose to do, remember to honor the licenses because you'll need to pick one for the project, and for that you have &lt;a href="https://choosealicense.com"&gt;https://choosealicense.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gitignore.io"&gt;https://gitignore.io&lt;/a&gt; is also a cool tool to create your &lt;strong&gt;.gitignore&lt;/strong&gt; file&lt;/p&gt;
&lt;h2&gt;
  
  
  First Version
&lt;/h2&gt;

&lt;p&gt;First release already? wow, that was fast. Publish it then, remember to create the pull request to the main branch in your repository.&lt;/p&gt;

&lt;p&gt;You will need to update your pyproject.toml file, to add the info necessary for PyPi, my recomendations are: &lt;strong&gt;name, version, description, authors, license, readme, repository, classifiers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First you need to build it, easy with Poetry&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;poetry build
Building pyflowcl &lt;span class="o"&gt;(&lt;/span&gt;0.1.1&lt;span class="o"&gt;)&lt;/span&gt;
 - Building sdist
 - Built pyflowcl-0.1.1.tar.gz

 - Building wheel
 - Built pyflowcl-0.1.1-py3-none-any.whl
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;There are more options to the build process, you can find them in the documentation.&lt;/p&gt;

&lt;p&gt;If you don't have a PyPi account, it's time to create one, once you have it, just publish it&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;poetry publish

Publishing pyflowcl &lt;span class="o"&gt;(&lt;/span&gt;0.1.1&lt;span class="o"&gt;)&lt;/span&gt; to PyPI
Username: mariofix
Password: 
 - Uploading pyflowcl-0.1.1-py3-none-any.whl 100%
 - Uploading pyflowcl-0.1.1.tar.gz 100%
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;There, it wasn't as hard as you thought it'll be, now you are responsible to make the updates, fix bugs and all that.&lt;br&gt;
Remember, &lt;a href="https://pypi.org/project/pyflowcl"&gt;this is the first of many&lt;/a&gt;.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/mariofix"&gt;
        mariofix
      &lt;/a&gt; / &lt;a href="https://github.com/mariofix/pyflowcl"&gt;
        pyflowcl
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Cliente para comunicacion con API de flow.cl
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>python</category>
      <category>showdev</category>
      <category>githunt</category>
    </item>
    <item>
      <title>Should I drop PHP?</title>
      <dc:creator>Mario Hernandez</dc:creator>
      <pubDate>Mon, 03 Aug 2020 01:41:39 +0000</pubDate>
      <link>https://dev.to/mariofix/should-i-drop-php-4j3m</link>
      <guid>https://dev.to/mariofix/should-i-drop-php-4j3m</guid>
      <description>&lt;p&gt;TL;RD I'm unsure.&lt;/p&gt;

&lt;p&gt;I started programming in ColdFusion, when it was owned by Macromedia (remember "Shockwave"?), since then I've learned more than a few languages, both compiled and scripted, and I've always believed that every language has its time and place. C/C++ has been with us since always (maybe the "more experienced" devs can say "I remember when C was just a letter") and is still here because of it's speed?, reliability?, documentation?, Java for its portability, even Cobol had an specific orientation (given by the technology available).&lt;/p&gt;

&lt;p&gt;Around 2002 I decided that I'd drop ColdFusion (no matter how much I love it) and make the switch to PHP, both Web oriented languages. But I'm also a sysadmin (maybe I'm a sysadmin first), I need to be able to quickly write a script for something, or a daemon for whatever reason, Bash and Perl were the selected languages for my sysadmin stuff. &lt;/p&gt;

&lt;p&gt;I was very happy with that combo for quite a few years, I also added some ADA and Pascal at university, Java/C++ when I started my Mobile Development phase, then I met Python and replaced Perl completely. I don't really remember how many programs and systems I've made with PHP for web development and Python for server stuff.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enter Rust
&lt;/h3&gt;

&lt;p&gt;I'm more of an old-school-sysadmin, I prefer stability and reliability for my servers, that's why I use Debian and don't particularly like Ubuntu for servers. Same goes for languages, I saw from a distance how Ruby dethroned Java/C/C++ as language of the year in 2006, then I saw it fall (It went from 11th to 15th according to TIOBE a the time of writing this post). Something similar happened when I learned about Go (I don't believe it's going to stick with us, no matter how much Google would like that) but I'm currently unsure. &lt;br&gt;
Have you seen Rust's performance? I mean: wow.&lt;br&gt;
Take a look at Rust. If you're interested on software to work and not get carried away by other secondary things, I believe you'll like it.&lt;/p&gt;

&lt;p&gt;Anyways... my thought process at this time is this: I relly like PHP (I understand why you might not like it, but remember "a time and a place"), it gave the speed Web Development needed to develop the way it did, and not sacrificing too much in the process. Python is Python: pretty, fast, simple, and easy to read. I've been moving from server stuff to web (I love Flask, I hate Django) and it has proven for me a better alternative than PHP/CodeIgniter, so... now I'm faced with the question: Should I drop PHP/CodeIgniter, replace it with Python/Flask and learn Rust for the server stuff? I don't know.&lt;/p&gt;

&lt;p&gt;I'm about to start a huge project, I know how I'm going to use CodeIgniter 4, the modules, the design, every thing is in my head, but I'm not sure to start with it, a gut feeling.&lt;br&gt;
I'm not sure how I'm going to design the system in Flask, too many unknowns, but for some reason I believe it's better to make the switch...&lt;/p&gt;

</description>
      <category>php</category>
      <category>codeigniter</category>
      <category>flask</category>
      <category>python</category>
    </item>
    <item>
      <title>New Stuff - Learning again</title>
      <dc:creator>Mario Hernandez</dc:creator>
      <pubDate>Sun, 02 Aug 2020 19:36:47 +0000</pubDate>
      <link>https://dev.to/mariofix/new-stuff-learning-again-49a9</link>
      <guid>https://dev.to/mariofix/new-stuff-learning-again-49a9</guid>
      <description>&lt;p&gt;I’ve been working with computers for more than 30 years (my first computer was a 80286 =D), but something I never liked was cables and welding and all that stuff (I managed to graduate college without making a single RJ45 cable), so… in times of COVID-19 and Quarantines and being more insightful with one-self… I decided to escape my comfort zone and pick up on the microcontroller stufff… Should be interesting.  &lt;/p&gt;

&lt;p&gt;I have a very basic understanding on how they work (the electrical stuff was NEVER my strong suit), at least theoretically. So i think my best approach here is to go basic, and start with circuit boards and pins and all that…  &lt;/p&gt;

&lt;p&gt;I’m new here so, if by any chance someone is reading this, I’ll appreciate any input.&lt;/p&gt;

</description>
      <category>microcontroller</category>
      <category>electronics</category>
      <category>dyi</category>
    </item>
  </channel>
</rss>
