PyFundamentals
A collection of fundamental Python utilities for common tasks such as string manipulation, date/time formatting, extended enumerations, threading with return values, bash-like operations, and exception handling.
Features
- Basic Functions: Utility functions for checking empty strings and generating formatted date/time strings.
- String Utilities: Comprehensive string manipulation including case conversion (CamelCase, snake_case), regex matching, Roman numeral conversion, random string generation, and text normalization.
- Extended Enums: Enhanced Enum and Flag classes with additional methods like
listandfrom_stringfor more flexible enumeration handling. - Overrides: Decorator-based method override checking for better code reliability in class hierarchies.
- Threading:
ReturningThreadclass that extends Python's Thread to allow capturing return values from threaded functions. - Bash Utilities: Functions to interact with system information like user details, hostname, IP addresses, and tool availability checks.
- Exceptions: Custom exception classes for handling errors in the library.
Installation
Install from PyPI:
pip install PyFundamentals
Or clone the repository and install locally:
git clone https://github.com/PyFundamentals.git
cd PyFundamentals
pip install .
Usage
Basic Functions
from fundamentals import is_empty_string, now_string
some_value = "test"
if not is_empty_string(some_value):
timestamp = now_string() # e.g., "20260309-11:46:00.123456"
String Utilities
from fundamentals import make_cpp_id, IdentifierStringCase
cpp_id = make_cpp_id("some mixed case", IdentifierStringCase.SNAKE) # "some_mixed_case"
Extended Enums
from enum import auto
from fundamentals import ExtendedEnum
class Color(ExtendedEnum):
RED = auto()
GREEN = auto()
BLUE = auto()
# List all values
colors = Color.list() # [<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 3>]
# Parse from string (case-insensitive)
color = Color.from_string("green") # Color.GREEN
Returning Thread
from fundamentals import ReturningThread
def worker(x, y):
return x + y
thread = ReturningThread(target=worker, args=(5, 10))
thread.start()
result = thread.join() # Returns 15
Exceptions
from fundamentals import StringUtilError
raise StringUtilError("An error occurred during string processing")
Testing
Run the test suite:
python -m unittest discover test/
For coverage (requires coverage.py):
coverage run --source=fundamentals -m unittest discover test/
coverage report
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass and code is linted
- Submit a pull request
License
This project is licensed under the GNU General Public License version 2 (GPLv2). See the LICENSE file for details.
Metadata
Release files for kingkybel-pyfundamentals 0.4.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kingkybel_pyfundamentals-0.4.6.tar.gz | 47.1 kB | Without provenance | Details for kingkybel_pyfundamentals-0.4.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kingkybel_pyfundamentals-0.4.6-py3-none-any.whl | Python 3 | none | any | Details for kingkybel_pyfundamentals-0.4.6-py3-none-any.whl |
Total release size: 79.2 kB
Release files / kingkybel_pyfundamentals-0.4.6.tar.gz
| Download URL | kingkybel_pyfundamentals-0.4.6.tar.gz |
|---|---|
| Size | 47.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcdb00260898739691d4800c7bc8d7a3a7e9a838f79be754a36feb25e6e5a33a
|
|
BLAKE2b-256 checksum How to use checksums |
d6e855e706e43d063fef9ed6bb2644fa32b5fe2c46bdab1bb789eae22312993f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / kingkybel_pyfundamentals-0.4.6-py3-none-any.whl
| Download URL | kingkybel_pyfundamentals-0.4.6-py3-none-any.whl |
|---|---|
| Size | 32.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d4cdb7f0954ae48c65a3a2686aa84af5be20c1c5cd023f1454af2f41a8fbe4b0
|
|
BLAKE2b-256 checksum How to use checksums |
e737259e511450b183ee4d030fddcfb6a0fba49946fe98b11a9e7737f3508b91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for kingkybel-pyfundamentals 0.4.6
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.