Skip to main content

eapy

A Python utility library that extends the standard library with math, algebra, data structures, and everyday tools.

Features

Math & Algebra

  • Vector — Vector2D, Vector3D, and N-dimensional Vector with arithmetic, dot product, magnitude, coordinate conversions
  • Matrix — 2D matrix operations (add, subtract, multiply, divide, power) with N×N determinant
  • Tensor — 3D tensor with arithmetic, slicing, transpose
  • Polynomial — polynomial arithmetic, evaluation (Horner's method), derivative, integral
  • Complex — complex number arithmetic, conjugate, phase, polar conversion
  • Symbolic Algebra — Var for building symbolic expressions with simplify & evaluate
  • InfiniteSet / Interval — set operations on numeric intervals

Trigonometry

  • Full set: sin, cos, tan, sec, csc, cot
  • Inverse: asin, acos, atan, atan2, asec, acsc, acot
  • Hyperbolic: sinh, cosh, tanh, asinh, acosh, atanh
  • Versed: versine, vercosine, coversine, covercosine

Combinatorics & Number Theory

  • permutation, combination, catalan, stirling2
  • gcd, lcm, isPrime, fibonacci, digitsSum
  • eulerTotient, primeFactors, modPow

Statistics

  • mean, median, variance, std, mode

String Utilities

  • Name conversion: toCamelCase, toSnakeCase, toPascalCase
  • levenshtein — edit distance between two strings

Functional Programming

  • pipe(value, f, g, h) — pipeline: h(g(f(value)))
  • compose(f, g, h)(x) — composition: f(g(h(x)))
  • curry(func)(a)(b)(c) — currying

Data Structures

  • Stack — LIFO stack (push/pop/peek)
  • Queue — FIFO queue (enqueue/dequeue)
  • Trie — prefix tree (insert/search/words_with_prefix)
  • LinkedList — singly linked list (append/prepend/remove/find)
  • CircularBuffer — fixed-size circular buffer
  • PriorityQueue — min-heap priority queue

Base Conversion

  • baseConvert(n, from_base, to_base) — arbitrary base conversion (2-36)
  • toBinary, toOctal, toHex — quick conversions

Color Utilities

  • rgbToHsl / hslToRgb — RGB ↔ HSL conversion
  • rgbToHex / hexToRgb — RGB ↔ HEX conversion

Numerical Methods

  • bisect(f, a, b) — bisection root finding
  • newtonMethod(f, f', x0) — Newton's method
  • numericalIntegral(f, a, b) — Simpson's rule integration

Utility & Decorators

  • Timer — simple stopwatch timer
  • clamp, lerp, mapRange — numeric helpers
  • flatten, chunk, deepGet, uniqueId — data helpers
  • @retry, @memoize, @deprecated, @singleton — decorators
  • printTable — formatted console table output
  • getPath — interactive file/directory picker
  • repeatUntilSecond, repeatUntilSecondOrBool, repeatUntilValueChange — loop helpers

Broadcast / Messaging

  • whenGetMessage, broadcast, broadcastWithData — simple event system

Threads

  • newThread, startThreads, deleteThread — simple thread management

Validation

  • isEmail, isURL, isIP — common format validators

Date Utilities

  • daysBetween, isLeapYear, weekday — date helpers

Progress Bar

  • ProgressBar — simple terminal progress bar

Hash Utilities

  • md5, sha256, hashFile — quick hashing

Random Utilities

  • randomChoice, shuffle, randomString, randomInt, randomFloat — enhanced random helpers

File I/O

  • readJson, writeJson — JSON file helpers
  • readCsv, writeCsv — CSV file helpers

Encoding

  • base64Encode, base64Decode — Base64 encoding
  • urlEncode, urlDecode — URL encoding

Math Extensions

  • factorial — factorial
  • matrixInverse — matrix inverse (Gauss-Jordan)
  • interpolate — linear interpolation

Regex Utilities

  • extractEmails, extractURLs — extract from text
  • replaceMultiple — multi-pattern replacement

Cache & Performance

  • @lruCache(maxsize) — LRU cache decorator
  • @timeit — execution time decorator

Progress Iterator

  • tqdm(iterable) — progress bar iterator

Type Checks

  • isNumber, isString, isList, isDict, isCallable — type check helpers

Network Utilities

  • getJson(url) — GET request returning JSON
  • postJson(url, data) — POST request with JSON body

Math Extensions (Vector)

  • dotProduct, crossProduct, normalize — vector operations

Local Storage

  • Storage — persistent key-value store with subpath support

Colored Text

  • Color — ANSI color codes (foreground, background, styles)
  • colorText(text, color, style, bg) — return colored text string
  • printColor(text, color, style, bg) — print colored text

Logging

  • Logger — simple logger (console + file)
  • @logTime — log function calls with timing

Config Management

  • Config — JSON-based config with dot notation support

Validation (Extended)

  • isPhoneNumber — Chinese phone number validation
  • isDate — date format validation
  • isHexColor — hex color validation

File Utilities

  • listFiles(dir, ext) — list files by extension
  • fileSize(path) — human-readable file size
  • ensureDir(path) — create directory if not exists

CLI Interaction

  • confirm(prompt) — yes/no confirmation
  • askInput(prompt, default) — input with default
  • selectOption(prompt, options) — selection menu

Encryption

  • encrypt(text, key) / decrypt(text, key) — simple XOR encryption

Time Utilities

  • formatDuration(seconds) — human-readable duration
  • timestamp() — current Unix timestamp
  • parseDate(str, fmt) — parse date string

Text Processing

  • slugify(text) — URL-friendly slug generation
  • wordCount(text) — character/word/line/sentence counting
  • truncate(text, length) — text truncation with ellipsis

Pagination

  • Paginate(items, page, per_page) — pagination helper

System Utilities

  • clipboard(text) — copy to clipboard (Windows)
  • systemInfo() — system information

Cache (Extended)

  • @ttlCache(seconds) — cache with time-to-live expiration

Math (Advanced)

  • rk4(func, y0, t, dt, steps) — 4th-order Runge-Kutta ODE solver
  • fft(signal) — Fast Fourier Transform (radix-2)
  • matrixEigenvalues(m) — eigenvalue approximation (QR algorithm)

Data Structures (Extended)

  • Deque — double-ended queue

Template Engine

  • render(template, variables) — simple {{key}} variable substitution

Rate Limiting

  • @rateLimit(max_calls, period) — call frequency limiter

Data Structures (Extended)

  • BloomFilter — probabilistic set membership testing

Decorators (Extended)

  • @exponentialBackoff — retry with exponential backoff
  • @validateTypes — runtime argument type validation

CLI (Extended)

  • Spinner — terminal loading spinner
  • clearScreen() — clear terminal screen

Math (Extended)

  • sieveOfEratosthenes(n) — prime sieve
  • binomialCoeff(n, k) — binomial coefficient
  • matrixTranspose(m) — matrix transpose
  • matrixDet(m) — matrix determinant

Graph

  • Graph — graph with BFS, DFS, Dijkstra shortest path

Math (Extended 3)

  • matrixMultiply(a, b) — matrix multiplication
  • solveLinearSystem(A, b) — solve Ax = b
  • matrixRank(m) — matrix rank

Data Structures (Extended 4)

  • SkipList — skip list with O(log n) operations
  • NamedStack — stack with a name

Utility (Extended)

  • uuid() — generate UUID4
  • humanize(n) — human-readable numbers (1000 → "1K")
  • unitConvert(value, from, to) — unit conversion

Statistics (Extended)

  • normalDistribution(x, mu, sigma) — normal distribution PDF
  • randomNormal(mu, sigma) — normal distribution random
  • correlation(x, y) — Pearson correlation

Scheduler

  • Scheduler — simple task scheduler (periodic execution)

Tree Visualization

  • printTree(data) — print tree structure from nested dicts

Installation

pip install eapyTool

Quick Start

from eapy.core import Var, Polynomial, Vector3D, mean

# Symbolic algebra
x = Var('x')
expr = (x + 2) * (x + 3)
print(expr.evaluate(x=5))  # 56.0

# Polynomial
p = Polynomial([1, -3, 2])  # 1 - 3x + 2x^2
print(p.derivative())        # -3 + 4*x
print(p(10))                 # 171.0

# Vector
v = Vector3D(1, 2, 3)
print(v.abs())               # 3.7416...

# Statistics
print(mean([4, 8, 15, 16, 23, 42]))  # 18.0

Development

# install with dev dependencies
pip install -e ".[dev]"

# run tests
pytest

# lint
ruff check src tests
ruff format --check src tests

License

MPL-2.0

Metadata

Release files for eapyTool 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eapyTool 0.3.7
File Size Uploaded Provenance
eapytool-0.3.7.tar.gz 46.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for eapyTool 0.3.7
File Interpreter ABI Platform
eapytool-0.3.7-py3-none-any.whl Python 3 none any Details

Total release size: 84.3 kB

Release files / eapytool-0.3.7.tar.gz

Download URL eapytool-0.3.7.tar.gz
Size 46.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f05e5e2c49851f3a8ced6bd65d3abc71761117e87f1dad81befeb9090d12db9e
BLAKE2b-256 checksum
How to use checksums
967f433c32d97fa42858392720d8ea2ea4ac52c17bb6792680635e31e7e0b722
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

Release files / eapytool-0.3.7-py3-none-any.whl

Download URL eapytool-0.3.7-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d9c197aa1504baabe0273d3de25482bb1973da25448c2b4b57757b61cabf948
BLAKE2b-256 checksum
How to use checksums
5231904442916fe91734c3220ff8ed1a936ea39adf1029161e6350234555f84d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.8

Security for eapyTool 0.3.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page