A Python utility library for math, algebra, data structures, and everyday tools
Project description
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-dimensionalVectorwith 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 —
Varfor 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,stirling2gcd,lcm,isPrime,fibonacci,digitsSumeulerTotient,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 bufferPriorityQueue— 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 conversionrgbToHex/hexToRgb— RGB ↔ HEX conversion
Numerical Methods
bisect(f, a, b)— bisection root findingnewtonMethod(f, f', x0)— Newton's methodnumericalIntegral(f, a, b)— Simpson's rule integration
Utility & Decorators
Timer— simple stopwatch timerclamp,lerp,mapRange— numeric helpersflatten,chunk,deepGet,uniqueId— data helpers@retry,@memoize,@deprecated,@singleton— decoratorsprintTable— formatted console table outputgetPath— interactive file/directory pickerrepeatUntilSecond,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 helpersreadCsv,writeCsv— CSV file helpers
Encoding
base64Encode,base64Decode— Base64 encodingurlEncode,urlDecode— URL encoding
Math Extensions
factorial— factorialmatrixInverse— matrix inverse (Gauss-Jordan)interpolate— linear interpolation
Regex Utilities
extractEmails,extractURLs— extract from textreplaceMultiple— 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 JSONpostJson(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
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
eapytool-0.3.1.tar.gz
(30.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
eapytool-0.3.1-py3-none-any.whl
(26.6 kB
view details)
File details
Details for the file eapytool-0.3.1.tar.gz.
File metadata
- Download URL: eapytool-0.3.1.tar.gz
- Upload date:
- Size: 30.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6611be11ca16f916be584dbea70e6f7c124d5e5e22ba39353295c066e1b482c
|
|
| MD5 |
4d34f9002e4401e71acdcc5c87a70be9
|
|
| BLAKE2b-256 |
9d25b656e5f0460ac336664be7fd1d881a82f416430c457f7f54342c3d37d97b
|
File details
Details for the file eapytool-0.3.1-py3-none-any.whl.
File metadata
- Download URL: eapytool-0.3.1-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea30ad95cdb3c22db92f3180545a79bdfdbf1a8040b48c161b3c28e1a309e01b
|
|
| MD5 |
6b9e1a4280eac7fefdcbd10eaa342d21
|
|
| BLAKE2b-256 |
e1e092ac4026997560be986ef031ae9d04fed29b7ea0d27fa1ffb28e98a434b8
|