Sitemap

Member-only story

Python: Standard Libraries you should use - Part 2

Gateway to Efficiency

3 min readJun 12, 2025

Hi, Welcome to the another installment of my exploration into Python’s vast library ecosystem! In this segment, I will continue uncovering some of the coolest Python libraries that I think can enhance your projects and simply your development process.

Upgrade your python projects with descriptive understanding of powerful python libraries.

Let’s dive in —

1. sourceFileLoader

use the built-in SourceFileLoader to import module name from non .py file.

example —

# my_module.py.txt
def greet():
return "Hello from non-.py file!"


# test.py
import importlib.util
from importlib.machinery import SourceFileLoader

# Load the module from the non-.py file
loader = SourceFileLoader(module_name, "my_module.py.txt")
spec = importlib.util.spec_from_loader("my_module", loader)
module = importlib.util.module_from_spec(spec)
loader.exec_module(module)

print(module.greet())
  • Works with any file extension as long as the content is valid Python.
  • Very useful when loading dynamically named or stored Python code (e.g., from data pipelines, rules engines, notebooks).

2. override decorator

--

--

Pravash
Pravash

Written by Pravash

I am a passionate Data Engineer and Technology Enthusiast. Here I am using this platform to share my knowledge and experience on tech stacks.

No responses yet