Metadata-Version: 2.4
Name: hunterMakesPy
Version: 0.3.1
Summary: Easy Python functions making making functional Python functions easier.
Author-email: Hunter Hogan <HunterHogan@pm.me>
License: CC-BY-NC-4.0
Project-URL: Donate, https://www.patreon.com/integrated
Project-URL: Homepage, https://github.com/hunterhogan/hunterMakesPy
Project-URL: Issues, https://github.com/hunterhogan/hunterMakesPy/issues
Project-URL: Repository, https://github.com/hunterhogan/hunterMakesPy
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
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Other Audience
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: autoflake
Requires-Dist: charset_normalizer
Requires-Dist: isort
Requires-Dist: more_itertools
Requires-Dist: numpy
Provides-Extra: development
Requires-Dist: setuptools-scm; extra == "development"
Provides-Extra: testing
Requires-Dist: pytest; extra == "testing"
Requires-Dist: pytest-cov; extra == "testing"
Requires-Dist: pytest-xdist; extra == "testing"
Dynamic: license-file

# 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"),
    "I could not find Configuration 'database', but I need it to continue."
)
```

## Parameter Validation

Parameter validation, integer parsing, and concurrency handling.

```python
import hunterMakesPy as humpy

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

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

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

## File System Utilities

Safe file operations and dynamic module importing.

```python
import hunterMakesPy as humpy

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

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

## Data Structure Manipulation

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

```python
import hunterMakesPy as humpy
import numpy

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

# Merge dictionaries containing lists
dictionaryAlpha = {"servers": ["chicago", "tokyo"], "databases": ["elm"]}
dictionaryBeta = {"servers": ["mumbai"], "databases": ["oak", "cedar"]}
merged = humpy.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 = humpy.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.tests.test_parseParameters 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)

[![CC-BY-NC-4.0](https://raw.githubusercontent.com/hunterhogan/hunterMakesPy/refs/heads/main/.github/CC-BY-NC-4.0.png)](https://creativecommons.org/licenses/by-nc/4.0/)
