Python Journey Log #1



This content originally appeared on DEV Community and was authored by IO_Node

Opening:

Coming from a perl / wscript background, I’m currently focusing on learning and applying my previous application (RAII/SRP) to python.

Projects Resume:

  1. Music generator that generates visuals using shaders.
    Started well, most of the musical theory is fairly accessible through libraries like music21, numpy and midiutil. I can currently generate basic midi song loops. the threejs part for shader support isnt started yet. currently on pause as i need to learn more about python before i can combine other languages.

  2. Python tutorials, also doubles as a code snippet cheat sheet.
    Ongoing progress, currently have some pretty decent starting subjects:

* globals() manipulation and importance
* locals() manipulation and importance
* regex filtering (I hate this synthax, can't wait to do linux python and use grep)
* logical operators for variables and objects
* keywords and built-in functions
* IO and file manipulation
* assembly / source extraction
* classes and custom dunder (__init__, __str__, etc.)
* error handling and bubbling of raise
* multiprocessing and GIL
* matplotlib visuals and application

If you have any good subject suggestions, I’m all ears. As you saw, I’m not affraid do dig deep. The more I’m digging, the more I feel python needs my magic touch. Keep reading to see what I mean 🙂

  1. Python Code Checker! Hell yeah I’m going to try this. I can now successfully extract arguments fed into my script from the console, understand what type of argument they are, send them properly toward the right function while preventing any violation during input. I’m pretty happy with the efforts I’ve put in this one.
* uses AST to create a usable structure
* use logic and regex to identify multiple pieces of code (functions, classes, variables, arguments/parameters of functions, loops, conditions, errors, docstrings, dead values, and still adding more!)
* supports both user input and dynamic console arguments.
* produce a report once completed (currently broken and under maintenance)
* currently working on dynamic import detections and variable backtracking.
* plan of supporting automatic code fixes, code suggestion for issues found, support for linux and configuration editor (config edit almost done)

My favorite project so far as I’m learning a lot of stuff doing this, exploring the most system heavy libraries and how to safely travel through them, wouldnt want to recursively delete all my project XD

  1. Magic Pythong Package So here’s why I said python needs some magic. I currently have as an objective to focus on Langchain application in Python.
* The first thing I identified is the lack of actual constant values so my first "magic" is to use tuple type even with single values to protect anything that I consider a constant in my code. 
* The second thing I identified is class manipulation through logical operator is a cancer. It needs to be chirurgically removed, which leads to the next "magic": Multi-Locked, Universal and standardized classes. 
* While looking into memory manipulation, I started working on what I would consider my 3rd "magic" which is a 100% dynamic module import with an automatic cleaner (I would consider the auto clean the 4th "magic"). Everyone is using globals for import to simplify their usage but that's not tolerated for me. imports should be only used in localized scopes and immediately flushed afterward. You only strategize your imports scope after you are done with the complete structure. This is to plan for really memory intense workflows.

This is what I would call my MPythong, this is purely personal in nature and is something I would be interested in making publicly available for everyone to use if interest for it catches. It might already exist in some form in another library but I didn’t found it yet.

That gives a full round tour of all my current python projects, what I’m aiming them towards and some opening for collaborations for those interested.

The picture was generated using a special proprietary tool called synthopixel. I have full rights on all content I use.


This content originally appeared on DEV Community and was authored by IO_Node