🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

stdl

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stdl

Extended Python Standard Library

pipPyPI
Version
0.6.2
Maintainers
1

stdl

Tests Documentation Status PyPI version Supported versions Downloads license

stdl is a collection of Python utilities that complement the standard library.

Features

  • File and directory operations
  • String manipulation
  • ANSI color support for terminal output
  • Date and time formatting
  • List utils
  • Lazy imports
  • Logging configuration for logging and loguru
  • See docs

Installation

Using pip

pip install stdl

Using uv

uv add stdl

From source

pip install git+https://github.com/zigai/stdl.git
# or
uv add git+https://github.com/zigai/stdl.git

Examples

Lazy imports

from typing import TYPE_CHECKING
from stdl.import_lazy import import_lazy

if TYPE_CHECKING:
    from os.path import abspath, join
    import numpy as np
    import torch
else:
    import_lazy("os.path", ["join", "abspath"], verbose=True)
    import_lazy("numpy", alias="np", verbose=True)
    import_lazy("torch", verbose=True)

print(np.zeros(4))
# importing "numpy" took 0.060s
# [0. 0. 0. 0.]
print(torch)
# <LazyImport: torch>
print(torch.randn(8))
# importing "torch" took 1.118s
# tensor([0., 0., 0., 0., 0., 0., 0., 0.])
print(torch)
# <module 'torch' from .../torch/__init__.py'

License

MIT License

Keywords

ANSI colors

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts