hunterMakesPy


NamehunterMakesPy JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryEasy Python functions making making functional Python functions easier.
upload_time2025-07-15 05:33:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseCC-BY-NC-4.0
keywords attribute loading concurrency limit configuration defensive programming dictionary merging directory creation dynamic import error propagation file system utilities input validation integer parsing module loading nested data structures package settings parameter validation pytest string extraction test utilities
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # hunterMakesPy

A modular Python toolkit for defensive programming, parameter validation, file system utilities, and flexible data structure manipulation.

[![pip install hunterMakesPy](https://img.shields.io/badge/pip%20install-hunterMakesPy-gray.svg?colorB=3b434b)](https://pypi.org/project/hunterMakesPy/)

## Overview

hunterMakesPy provides utilities for safe error handling, flexible input validation, dynamic module and attribute importing, and merging or transforming complex data structures. The package emphasizes clear identifiers, robust type handling, and reusable components for building reliable Python applications.

## Installation

```bash
pip install hunterMakesPy
```

## Defensive Programming

Utilities for handling `None` values and defensive programming patterns.

```python
from hunterMakesPy import raiseIfNone

# Ensure a function result is not None
def findConfiguration(configName: str) -> dict[str, str] | None:
    # ... search logic ...
    return None

config = raiseIfNone(
    findConfiguration("database"),
    "Configuration 'database' is required but not found"
)
```

## Parameter Validation

Parameter validation, integer parsing, and concurrency handling.

```python
from hunterMakesPy import defineConcurrencyLimit, intInnit, oopsieKwargsie

# Smart concurrency limit calculation
cpuLimit = defineConcurrencyLimit(limit=0.75)  # Use 75% of available CPUs
cpuLimit = defineConcurrencyLimit(limit=True)  # Use exactly 1 CPU
cpuLimit = defineConcurrencyLimit(limit=4)     # Use exactly 4 CPUs

# Robust integer validation
validatedIntegers = intInnit([1, "2", 3.0, "4"], "port_numbers")

# String-to-boolean conversion for configuration
userInput = "True"
booleanValue = oopsieKwargsie(userInput)  # Returns True
```

## File System Utilities

Safe file operations and dynamic module importing.

```python
from hunterMakesPy import (
    importLogicalPath2Identifier,
    importPathFilename2Identifier,
    makeDirsSafely,
    writeStringToHere
)

# Dynamic imports
gcdFunction = importLogicalPath2Identifier("math", "gcd")
customFunction = importPathFilename2Identifier("path/to/module.py", "functionName")

# Safe file operations
pathFilename = Path("deep/nested/directory/file.txt")
writeStringToHere("content", pathFilename)  # Creates directories automatically
```

## Data Structure Manipulation

Utilities for string extraction, data flattening, and array compression.

```python
from hunterMakesPy import stringItUp, updateExtendPolishDictionaryLists, autoDecodingRLE
import numpy

# Extract all strings from nested data structures
nestedData = {"config": [1, "host", {"port": 8080}], "users": ["alice", "bob"]}
allStrings = stringItUp(nestedData)  # ['config', 'host', 'port', 'users', 'alice', 'bob']

# Merge dictionaries containing lists
dictionaryAlpha = {"servers": ["web1", "web2"], "databases": ["db1"]}
dictionaryBeta = {"servers": ["web3"], "databases": ["db2", "db3"]}
merged = updateExtendPolishDictionaryLists(dictionaryAlpha, dictionaryBeta, destroyDuplicates=True)

# Compress NumPy arrays with run-length encoding
arrayData = numpy.array([1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9])
compressed = autoDecodingRLE(arrayData)  # "[1,*range(2,6)]+[5]*2+[*range(6,10)]"
```

## Testing

The package includes comprehensive test suites that you can import and run:

```python
from hunterMakesPy.pytestForYourUse import (
    PytestFor_defineConcurrencyLimit,
    PytestFor_intInnit,
    PytestFor_oopsieKwargsie
)

# Run tests on the built-in functions
listOfTests = PytestFor_defineConcurrencyLimit()
for nameOfTest, callablePytest in listOfTests:
    callablePytest()

# Or test your own compatible functions
@pytest.mark.parametrize("nameOfTest,callablePytest",
                        PytestFor_intInnit(callableToTest=myFunction))
def test_myFunction(nameOfTest, callablePytest):
    callablePytest()
```

## My recovery

[![Static Badge](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)
[![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UC3Gx7kz61009NbhpRtPP7tw)](https://www.youtube.com/@HunterHogan)

## How to code

Coding One Step at a Time:

0. WRITE CODE.
1. Don't write stupid code that's hard to revise.
2. Write good code.
3. When revising, write better code.

[![CC-BY-NC-4.0](https://github.com/hunterhogan/hunterMakesPy/blob/main/CC-BY-NC-4.0.svg)](https://creativecommons.org/licenses/by-nc/4.0/)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "hunterMakesPy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "attribute loading, concurrency limit, configuration, defensive programming, dictionary merging, directory creation, dynamic import, error propagation, file system utilities, input validation, integer parsing, module loading, nested data structures, package settings, parameter validation, pytest, string extraction, test utilities",
    "author": null,
    "author_email": "Hunter Hogan <HunterHogan@pm.me>",
    "download_url": "https://files.pythonhosted.org/packages/9c/2b/19474fa449817e9922659d91c33b0b6b9c6090db657877896ae6c5e8f92b/huntermakespy-0.2.0.tar.gz",
    "platform": null,
    "description": "# hunterMakesPy\n\nA modular Python toolkit for defensive programming, parameter validation, file system utilities, and flexible data structure manipulation.\n\n[![pip install hunterMakesPy](https://img.shields.io/badge/pip%20install-hunterMakesPy-gray.svg?colorB=3b434b)](https://pypi.org/project/hunterMakesPy/)\n\n## Overview\n\nhunterMakesPy provides utilities for safe error handling, flexible input validation, dynamic module and attribute importing, and merging or transforming complex data structures. The package emphasizes clear identifiers, robust type handling, and reusable components for building reliable Python applications.\n\n## Installation\n\n```bash\npip install hunterMakesPy\n```\n\n## Defensive Programming\n\nUtilities for handling `None` values and defensive programming patterns.\n\n```python\nfrom hunterMakesPy import raiseIfNone\n\n# Ensure a function result is not None\ndef findConfiguration(configName: str) -> dict[str, str] | None:\n    # ... search logic ...\n    return None\n\nconfig = raiseIfNone(\n    findConfiguration(\"database\"),\n    \"Configuration 'database' is required but not found\"\n)\n```\n\n## Parameter Validation\n\nParameter validation, integer parsing, and concurrency handling.\n\n```python\nfrom hunterMakesPy import defineConcurrencyLimit, intInnit, oopsieKwargsie\n\n# Smart concurrency limit calculation\ncpuLimit = defineConcurrencyLimit(limit=0.75)  # Use 75% of available CPUs\ncpuLimit = defineConcurrencyLimit(limit=True)  # Use exactly 1 CPU\ncpuLimit = defineConcurrencyLimit(limit=4)     # Use exactly 4 CPUs\n\n# Robust integer validation\nvalidatedIntegers = intInnit([1, \"2\", 3.0, \"4\"], \"port_numbers\")\n\n# String-to-boolean conversion for configuration\nuserInput = \"True\"\nbooleanValue = oopsieKwargsie(userInput)  # Returns True\n```\n\n## File System Utilities\n\nSafe file operations and dynamic module importing.\n\n```python\nfrom hunterMakesPy import (\n    importLogicalPath2Identifier,\n    importPathFilename2Identifier,\n    makeDirsSafely,\n    writeStringToHere\n)\n\n# Dynamic imports\ngcdFunction = importLogicalPath2Identifier(\"math\", \"gcd\")\ncustomFunction = importPathFilename2Identifier(\"path/to/module.py\", \"functionName\")\n\n# Safe file operations\npathFilename = Path(\"deep/nested/directory/file.txt\")\nwriteStringToHere(\"content\", pathFilename)  # Creates directories automatically\n```\n\n## Data Structure Manipulation\n\nUtilities for string extraction, data flattening, and array compression.\n\n```python\nfrom hunterMakesPy import stringItUp, updateExtendPolishDictionaryLists, autoDecodingRLE\nimport numpy\n\n# Extract all strings from nested data structures\nnestedData = {\"config\": [1, \"host\", {\"port\": 8080}], \"users\": [\"alice\", \"bob\"]}\nallStrings = stringItUp(nestedData)  # ['config', 'host', 'port', 'users', 'alice', 'bob']\n\n# Merge dictionaries containing lists\ndictionaryAlpha = {\"servers\": [\"web1\", \"web2\"], \"databases\": [\"db1\"]}\ndictionaryBeta = {\"servers\": [\"web3\"], \"databases\": [\"db2\", \"db3\"]}\nmerged = updateExtendPolishDictionaryLists(dictionaryAlpha, dictionaryBeta, destroyDuplicates=True)\n\n# Compress NumPy arrays with run-length encoding\narrayData = numpy.array([1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9])\ncompressed = autoDecodingRLE(arrayData)  # \"[1,*range(2,6)]+[5]*2+[*range(6,10)]\"\n```\n\n## Testing\n\nThe package includes comprehensive test suites that you can import and run:\n\n```python\nfrom hunterMakesPy.pytestForYourUse import (\n    PytestFor_defineConcurrencyLimit,\n    PytestFor_intInnit,\n    PytestFor_oopsieKwargsie\n)\n\n# Run tests on the built-in functions\nlistOfTests = PytestFor_defineConcurrencyLimit()\nfor nameOfTest, callablePytest in listOfTests:\n    callablePytest()\n\n# Or test your own compatible functions\n@pytest.mark.parametrize(\"nameOfTest,callablePytest\",\n                        PytestFor_intInnit(callableToTest=myFunction))\ndef test_myFunction(nameOfTest, callablePytest):\n    callablePytest()\n```\n\n## My recovery\n\n[![Static Badge](https://img.shields.io/badge/2011_August-Homeless_since-blue?style=flat)](https://HunterThinks.com/support)\n[![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UC3Gx7kz61009NbhpRtPP7tw)](https://www.youtube.com/@HunterHogan)\n\n## How to code\n\nCoding One Step at a Time:\n\n0. WRITE CODE.\n1. Don't write stupid code that's hard to revise.\n2. Write good code.\n3. When revising, write better code.\n\n[![CC-BY-NC-4.0](https://github.com/hunterhogan/hunterMakesPy/blob/main/CC-BY-NC-4.0.svg)](https://creativecommons.org/licenses/by-nc/4.0/)\n",
    "bugtrack_url": null,
    "license": "CC-BY-NC-4.0",
    "summary": "Easy Python functions making making functional Python functions easier.",
    "version": "0.2.0",
    "project_urls": {
        "Donate": "https://www.patreon.com/integrated",
        "Homepage": "https://github.com/hunterhogan/",
        "Issues": "https://github.com/hunterhogan/",
        "Repository": "https://github.com/hunterhogan/"
    },
    "split_keywords": [
        "attribute loading",
        " concurrency limit",
        " configuration",
        " defensive programming",
        " dictionary merging",
        " directory creation",
        " dynamic import",
        " error propagation",
        " file system utilities",
        " input validation",
        " integer parsing",
        " module loading",
        " nested data structures",
        " package settings",
        " parameter validation",
        " pytest",
        " string extraction",
        " test utilities"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "48b28a3d00f6af5aed76e4ae94e6e81b17e8e44e9fa5e3bbaa8ea4780cef1c57",
                "md5": "d8003b729e92b620a2494475fabe5036",
                "sha256": "a404d1e76875b6eb1396c2921a0f54e4971b0e3507657c1747800675a66a0a3e"
            },
            "downloads": -1,
            "filename": "huntermakespy-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d8003b729e92b620a2494475fabe5036",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 36781,
            "upload_time": "2025-07-15T05:33:53",
            "upload_time_iso_8601": "2025-07-15T05:33:53.162356Z",
            "url": "https://files.pythonhosted.org/packages/48/b2/8a3d00f6af5aed76e4ae94e6e81b17e8e44e9fa5e3bbaa8ea4780cef1c57/huntermakespy-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9c2b19474fa449817e9922659d91c33b0b6b9c6090db657877896ae6c5e8f92b",
                "md5": "7226443544d13eafccbe4e1a7cf00079",
                "sha256": "420b1c08ad97b92f8c39b118f21dae12cf46da38cf714f1d3b1eb8983f924117"
            },
            "downloads": -1,
            "filename": "huntermakespy-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7226443544d13eafccbe4e1a7cf00079",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 34408,
            "upload_time": "2025-07-15T05:33:54",
            "upload_time_iso_8601": "2025-07-15T05:33:54.382826Z",
            "url": "https://files.pythonhosted.org/packages/9c/2b/19474fa449817e9922659d91c33b0b6b9c6090db657877896ae6c5e8f92b/huntermakespy-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-15 05:33:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "huntermakespy"
}
        
Elapsed time: 0.85790s