The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code — not in reams of trivial code that bores the reader to death.

Guido van Rossum

Hi all first always i trust everyone is doing well and safe.

Second i had started writing another blog on some first principles design issues in machine learning but this morning while i was just browsing i came across a python library called Pyforest. Pyforest claims to have 99% of your import library woes solved.

At one of my previous companies, we created this flow from the time you walk in get your rig and sit down you have access to a superpack.tar.gz with all of the necessary python dependencies in fact even any bash scripts that you might need once you got your rig to start doing PRs the same day you started work.  This was pre-anaconda days so it worked well then most moved over to dependency management via anaconda.  However, this didn’t solve one of the main issues.  What when and how do you import?

i am sure if you are like me i keep the proverbial “untitled.ipynb” sitting around just for a notepad of sorts for the main imports (just don’t click and press X accidentally!).

Which is where pyforest comes into the reptilian purview.

The github is funny it says:

pyforest – feel the bliss of automated imports.”

Then it goes on to say:

“Writing the same imports over and over again is below your capacity. Let pyforest do the job for you.”

Being this isn’t supposed to be tl;dr blog (only a little nibble from a reptile) lets get started.

Installation:

You need to have python version 3.6 or above.  The github is once again funny (we like f-strings).  

So first make sure you are in your venv. 

 python3 --version
 pip install --upgrade pyforest
 python -m pyforest install_extensions 

Low and behold: 

Downloading pyforest-1.0.3.tar.gz

Needless to say i was skeptical.  

Questions – autocomplete? Stomping on variables?  Grinding to a halt because maybe import *?

Nope. Here is proof:

Ok nice parlor trick.

Lets try plotting something because i always space out and just type plt:

Ok now you have my attention.

i then tried a simple linear regression with sklearn

So this library definitely saves you time and the folks over at bamboolib have a great sense of humor which i really appreciate.

You can check to see a list of imported libraries dir(pyforest) kinda like a micro pip freeze.

Here is the github: pyforest github.

+1 for my recommendation.

until then,

#iwishyouwater

@tctjr

Muzak To Blog To: Cold Fact by Rodriguez 

Fwiw if you get a chance watch “Searching For Sugarman” which is a documentary about Rodriguez.  Astounding.

Leave a Reply

Your email address will not be published.