# 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 `list` and `from_string` for more flexible enumeration handling.
- **Overrides**: Decorator-based method override checking for better code reliability in class hierarchies.
- **Threading**: `ReturningThread` class 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:
```bash
pip install PyFundamentals
```
Or clone the repository and install locally:
```bash
git clone https://github.com/PyFundamentals.git
cd PyFundamentals
pip install .
```
## Usage
### Basic Functions
```python
from fundamentals import is_empty_string, now_string
some_value = "test"
if not is_empty_string(some_value):
timestamp = now_string() # e.g., "20241027-16:22:33.123456"
```
### String Utilities
```python
from fundamentals import make_cpp_id, IdentifierStringCase
cpp_id = make_cpp_id("some mixed case", IdentifierStringCase.SNAKE) # "some_mixed_case"
```
### Extended Enums
```python
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
```python
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
```python
from fundamentals import StringUtilError
raise StringUtilError("An error occurred during string processing")
```
## Testing
Run the test suite:
```bash
python -m unittest discover test/
```
For coverage (requires `coverage.py`):
```bash
coverage run --source=fundamentals -m unittest discover test/
coverage report
```
## Contributing
Contributions are welcome! Please follow these steps:
1. Fork the repository
2. Create a feature branch
3. Add tests for new functionality
4. Ensure all tests pass and code is linted
5. Submit a pull request
## License
This project is licensed under the GNU General Public License version 2 (GPLv2). See the `LICENSE` file for details.
## Author
Dieter J Kybelksties
Raw data
{
"_id": null,
"home_page": null,
"name": "kingkybel-pyfundamentals",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, utilities, fundamentals, enums, string-manipulation, threading",
"author": null,
"author_email": "Dieter J Kybelksties <github@kybelksties.com>",
"download_url": "https://files.pythonhosted.org/packages/c3/0d/424cd60cba0382db781596860c47e1faf685dcff09fdd64980b395e9cadd/kingkybel_pyfundamentals-0.1.2.tar.gz",
"platform": null,
"description": "# PyFundamentals\n\nA 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.\n\n## Features\n\n- **Basic Functions**: Utility functions for checking empty strings and generating formatted date/time strings.\n- **String Utilities**: Comprehensive string manipulation including case conversion (CamelCase, snake_case), regex matching, Roman numeral conversion, random string generation, and text normalization.\n- **Extended Enums**: Enhanced Enum and Flag classes with additional methods like `list` and `from_string` for more flexible enumeration handling.\n- **Overrides**: Decorator-based method override checking for better code reliability in class hierarchies.\n- **Threading**: `ReturningThread` class that extends Python's Thread to allow capturing return values from threaded functions.\n- **Bash Utilities**: Functions to interact with system information like user details, hostname, IP addresses, and tool availability checks.\n- **Exceptions**: Custom exception classes for handling errors in the library.\n\n## Installation\n\nInstall from PyPI:\n\n```bash\npip install PyFundamentals\n```\n\nOr clone the repository and install locally:\n\n```bash\ngit clone https://github.com/PyFundamentals.git\ncd PyFundamentals\npip install .\n```\n\n## Usage\n\n### Basic Functions\n\n```python\nfrom fundamentals import is_empty_string, now_string\n\nsome_value = \"test\"\nif not is_empty_string(some_value):\n timestamp = now_string() # e.g., \"20241027-16:22:33.123456\"\n```\n\n### String Utilities\n\n```python\nfrom fundamentals import make_cpp_id, IdentifierStringCase\n\ncpp_id = make_cpp_id(\"some mixed case\", IdentifierStringCase.SNAKE) # \"some_mixed_case\"\n```\n\n### Extended Enums\n\n```python\nfrom enum import auto\nfrom fundamentals import ExtendedEnum\n\nclass Color(ExtendedEnum):\n RED = auto()\n GREEN = auto()\n BLUE = auto()\n\n# List all values\ncolors = Color.list() # [<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 3>]\n\n# Parse from string (case-insensitive)\ncolor = Color.from_string(\"green\") # Color.GREEN\n```\n\n### Returning Thread\n\n```python\nfrom fundamentals import ReturningThread\n\ndef worker(x, y):\n return x + y\n\nthread = ReturningThread(target=worker, args=(5, 10))\nthread.start()\nresult = thread.join() # Returns 15\n```\n\n### Exceptions\n\n```python\nfrom fundamentals import StringUtilError\n\nraise StringUtilError(\"An error occurred during string processing\")\n```\n\n## Testing\n\nRun the test suite:\n\n```bash\npython -m unittest discover test/\n```\n\nFor coverage (requires `coverage.py`):\n\n```bash\ncoverage run --source=fundamentals -m unittest discover test/\ncoverage report\n```\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork the repository\n2. Create a feature branch\n3. Add tests for new functionality\n4. Ensure all tests pass and code is linted\n5. Submit a pull request\n\n## License\n\nThis project is licensed under the GNU General Public License version 2 (GPLv2). See the `LICENSE` file for details.\n\n## Author\n\nDieter J Kybelksties\n",
"bugtrack_url": null,
"license": null,
"summary": "A collection of fundamental Python utilities for common tasks",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/kingkybel/PyFundamentals"
},
"split_keywords": [
"python",
" utilities",
" fundamentals",
" enums",
" string-manipulation",
" threading"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "df69fed1512c422ea5a182623824ef332b3090bf900b7012014056e9bd7da541",
"md5": "6c4c28633ed7e0c36c0cfc1ee9b02a9a",
"sha256": "d1ea14e8030d550cd0869fa59a841b5d9abf1a6dc2a757d808514456fee8c824"
},
"downloads": -1,
"filename": "kingkybel_pyfundamentals-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6c4c28633ed7e0c36c0cfc1ee9b02a9a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 29583,
"upload_time": "2025-10-30T08:17:29",
"upload_time_iso_8601": "2025-10-30T08:17:29.965778Z",
"url": "https://files.pythonhosted.org/packages/df/69/fed1512c422ea5a182623824ef332b3090bf900b7012014056e9bd7da541/kingkybel_pyfundamentals-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c30d424cd60cba0382db781596860c47e1faf685dcff09fdd64980b395e9cadd",
"md5": "b51743446cd7e9cfed1ca87352a44f4d",
"sha256": "052b42382fbeee98f9587493389a81f1ebf8c74e1044928baef2e496d6e23a6b"
},
"downloads": -1,
"filename": "kingkybel_pyfundamentals-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "b51743446cd7e9cfed1ca87352a44f4d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 29485,
"upload_time": "2025-10-30T08:17:31",
"upload_time_iso_8601": "2025-10-30T08:17:31.299534Z",
"url": "https://files.pythonhosted.org/packages/c3/0d/424cd60cba0382db781596860c47e1faf685dcff09fdd64980b395e9cadd/kingkybel_pyfundamentals-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-30 08:17:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kingkybel",
"github_project": "PyFundamentals",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "kingkybel-pyfundamentals"
}