Skip to main content

Extended Python Standard Library

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stdl-0.7.0.tar.gz (94.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stdl-0.7.0-py3-none-any.whl (37.2 kB view details)

Uploaded Python 3

File details

Details for the file stdl-0.7.0.tar.gz.

File metadata

  • Download URL: stdl-0.7.0.tar.gz
  • Upload date:
  • Size: 94.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for stdl-0.7.0.tar.gz
Algorithm Hash digest
SHA256 681a4ce8d162748238cf2323645de6e339e942a87e5da04ecb69bf8d2699f0b2
MD5 a824a97bb754b1fea00abeef0f5c74b6
BLAKE2b-256 5760c4304da6c517881f0977565eb894d8b2fee7ed58321b2fd4df1aef6ddf22

See more details on using hashes here.

File details

Details for the file stdl-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: stdl-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 37.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for stdl-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45891fd7d581f3800206bf3f4031bdf7b323e40c366d2bd4118600c31830b2ed
MD5 0441f0ff23e31fe5a3d7d3c16f63e9b8
BLAKE2b-256 a2ed29895ec67f671324e632d8b76518609c5ecb19c96394f10ce9af1a34e9c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page