Pyforest — The lazy import

Krishna Heroor
3 min readMar 16, 2020

Usually when we are working on the Data science projects, the first step we all do importing the required packages or libraries. This is the beginning step in every single project.

These are the things we actually do, not exactly. Here I listed some of the libraries…

List of some libraries

And the list goes on. Based on the complex projects the list will add on. Most of the libraries we are importing are pandas as pd, numpy as np, matplotlib.pyplot as plt and list goes on. In addition to this we have other modules like os, re..

So, let’s learn and explore a new project i,e Pyforest.

Table Of Contents:

  1. What is Pyforest?
  2. Installation
  3. Getting started with Pyforest
  4. Understanding with simple python code.

What is Pyforest? Pyforest is the lazy imports of all popular python Data Science libraries so that they are always in there in your work environment. When you need them, this is also known as lazy import in python. If you don’t use a library or any of it’s method or function, it won’t be imported . When you are done with your script, you can export the python code for the imported statements for the later use.

Installation:

You need python 3.6 or higher version to run this package

pip install pyforest

And you’re ready to go.

Please note, that this will also add pyforest to your IPython default startup settings. pyforest will be automatically added in your environment during startup.

Getting started with Pyforest

First step is ..

from pyforest import *

So if you using Jupyter or IPython IDE, you can skip this line because pyforest will be itself added to the autostart.

When you are done with your script, the next step is to export all the statements via this code:

lazy_imports()

All the libraries imported

You can see an overview of all available lazy imports in Python

Understanding with simple python code.

If you are missing an import, you can add it to the pyforest imports by following contribution guidelines.

Excited yet? pyforest currently includes pandas, NumPy, matplotlib, and many more data science libraries and it’s regularly managed by developers.

--

--