Skip to main content

Helper functions to increase efficiency.

Project description

Baloot

Small, focused Python helpers for experiments and day-to-day developer workflows. The package is pure Python, has no required runtime dependencies, and keeps the API flat so you can import most helpers directly from baloot.

Overview

  • Lightweight utilities for seeding, file helpers, settings, Torch ergonomics, plotting, and small modules.
  • Optional integrations: install the libraries you actually use (e.g., torch, numpy, matplotlib).
  • A simple, readable API surface intended for quick reuse in scripts and research code.

Installation

pip install baloot

API Reference

Constants

import baloot

print(baloot.pi)
# tensor(3.1416)

print(baloot.e)
# tensor(2.7183)

print(baloot.sqrt2)
# tensor(1.4142)

print(baloot.sqrt3)
# tensor(1.7321)

print(baloot.sqrt5)
# tensor(2.2361)

print(baloot.ln2)
# tensor(0.6931)

print(baloot.ln10)
# tensor(2.3026)

print(baloot.c)
# tensor(299792458)
assert baloot.c == baloot.light

print(baloot.golden)
# tensor(1.6180)

Reproducibility

import baloot

assert baloot.seed == baloot.seed_everything

baloot.seed(1234)

Alternatively, you can seed different libraries separately.

import baloot

baloot.seed_python(1)
baloot.seed_numpy(2)
baloot.seed_torch(3)
baloot.seed_cuda(4)

File Management

Saving data:

import baloot

data = {
    "name": "John Doe",
    "age": 222
}

baloot.funnel("data.json", data)

Later on you can load the data:

import baloot

data = baloot.funnel("data.json")

Triangular

A few exotic triangular functions have been added to Baloot to complete already rich triangular API of PyTorch.

import baloot

baloot.arccot(baloot.pi * 3 / 4)
baloot.arccoth(baloot.pi * 3 / 4)
baloot.cot(baloot.pi * 3 / 4)
baloot.coth(baloot.pi * 3 / 4)
baloot.hacoversin(baloot.pi * 3 / 4)
baloot.haversin(baloot.pi * 3 / 4)

assert baloot.hacoversine == baloot.hacoversin
assert baloot.haversine == baloot.haversin

Tensor Operations

Anti-diagonal:

import torch
import baloot

matrix = torch.randn(10, 10)
baloot.antidiagonal(matrix)

Batched trace operation:

import torch
import baloot

matrices = torch.randn(10, 5, 5)
traces = baloot.trace(matrices)
assert traces.shape == (10, 1)

Copyright

MIT License. Copyright (c) 2025 Taha Shieenavaz. See 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

baloot-1.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

baloot-1.0.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file baloot-1.0.0.tar.gz.

File metadata

  • Download URL: baloot-1.0.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for baloot-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f2d6e1b199318a2e06a2d2f9ff8296cb5fdfff148dfd3844a6dc7d556ca34e37
MD5 06215159d2f57d1e01e75c70afca5abb
BLAKE2b-256 9b3df3f9900c3d95851979d952ee9c66e834784915c43a90c3d50be400e45761

See more details on using hashes here.

Provenance

The following attestation bundles were made for baloot-1.0.0.tar.gz:

Publisher: publish.yaml on tahashieenavaz/baloot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file baloot-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: baloot-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for baloot-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c566048809b8d63c30e9c8e8ec52ae3d29ce6895dca621a22e2cfca0b98f858
MD5 0b3c4148b912bf0c5c9b5e08f33a8a4d
BLAKE2b-256 d5bdfffb962a41153c6560cdbd3fbb1cdfcbbd34d19ba5505ff26f53b5d3e0ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for baloot-1.0.0-py3-none-any.whl:

Publisher: publish.yaml on tahashieenavaz/baloot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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