{"id":40605632,"url":"https://github.com/danielnachumdev/danielutils","last_synced_at":"2026-01-21T04:43:21.399Z","repository":{"id":65348154,"uuid":"538926368","full_name":"danielnachumdev/danielutils","owner":"danielnachumdev","description":"A comprehensive Python utilities library providing type-safe collections, async programming tools, database abstractions, retry executors, data structures, and developer productivity enhancements to streamline Python development workflows","archived":false,"fork":false,"pushed_at":"2026-01-19T20:34:20.000Z","size":1258,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-20T02:21:36.394Z","etag":null,"topics":["decorators","decorators-python","facade-pattern","interface","liabrary","metaclass","mypy","oop","oop-in-python","package","pylint","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielnachumdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-09-20T10:16:38.000Z","updated_at":"2026-01-19T20:34:25.000Z","dependencies_parsed_at":"2023-02-10T23:30:55.027Z","dependency_job_id":"46ca9d7a-9f24-4b0b-adda-fe0f6943b2db","html_url":"https://github.com/danielnachumdev/danielutils","commit_stats":{"total_commits":56,"total_committers":1,"mean_commits":56.0,"dds":0.0,"last_synced_commit":"c40a9d9879f850a319532ce6b494934705c4f49f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danielnachumdev/danielutils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fdanielutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fdanielutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fdanielutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fdanielutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielnachumdev","download_url":"https://codeload.github.com/danielnachumdev/danielutils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnachumdev%2Fdanielutils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28626967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T02:47:06.670Z","status":"ssl_error","status_checked_at":"2026-01-21T02:45:44.886Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decorators","decorators-python","facade-pattern","interface","liabrary","metaclass","mypy","oop","oop-in-python","package","pylint","python","python3"],"created_at":"2026-01-21T04:43:21.304Z","updated_at":"2026-01-21T04:43:21.377Z","avatar_url":"https://github.com/danielnachumdev.png","language":"Python","readme":"[![Python package](https://github.com/danielnachumdev/danielutils/actions/workflows/python-package.yml/badge.svg)](https://github.com/danielnachumdev/danielutils/actions/workflows/python-package.yml)\n[![Pylint](https://github.com/danielnachumdev/danielutils/actions/workflows/pylint.yml/badge.svg)](https://github.com/danielnachumdev/danielutils/actions/workflows/pylint.yml)\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![gitleaks](https://github.com/danielnachumdev/danielutils/actions/workflows/gitleaks.yml/badge.svg)](https://github.com/danielnachumdev/danielutils/actions/workflows/gitleaks.yml)\n[![CodeQL](https://github.com/danielnachumdev/danielutils/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/danielnachumdev/danielutils/actions/workflows/github-code-scanning/codeql)\n\n# danielutils v1.1.21\n\nA comprehensive Python utilities library designed to enhance your development workflow with powerful tools for type safety, async programming, database operations, and much more.\n\n**Features:**\n- 🎯 **Type Safety**: Advanced type checking, validation, and typed collections\n- ⚡ **Async Support**: Comprehensive async utilities and worker pools\n- 🗄️ **Database Abstractions**: Multi-backend database support (SQLite, Redis, In-Memory)\n- 🔄 **Retry Logic**: Configurable retry executors with multiple backoff strategies\n- 📊 **Data Structures**: Enhanced collections, graphs, heaps, and algorithms\n- 🎨 **Developer Experience**: Progress bars, logging, reflection, and debugging tools\n- 🧮 **Academic Tools**: Probability theory and statistical functions\n\n**Tested Python versions**: `3.8.0+`, `3.9.0`, `3.10.13`\n\n\u003e **Note**: This package is actively developed and subject to change. Use at your own risk!\n\n## 🚀 Quick Start\n\n```python\nfrom danielutils import isoftype, validate, tlist\nfrom danielutils.abstractions.db import DatabaseFactory\nfrom danielutils.abstractions.db.database_definitions import TableSchema, TableColumn, ColumnType\n\n# Type-safe list with runtime validation\nnumbers = tlist[int]([1, 2, 3, 4, 5])\n\n# Function validation\n@validate\ndef greet(name: str, age: int) -\u003e str:\n    return f\"Hello {name}, you are {age} years old\"\n\n# Database operations\ndb = DatabaseFactory.get_database(\"memory\")  # In-memory database\nwith db:\n    # Create a table\n    schema = TableSchema(\n        name=\"users\",\n        columns=[\n            TableColumn(name=\"id\", type=ColumnType.AUTOINCREMENT, primary_key=True),\n            TableColumn(name=\"name\", type=ColumnType.TEXT, nullable=False),\n            TableColumn(name=\"age\", type=ColumnType.INTEGER)\n        ]\n    )\n    db.create_table(schema)\n    \n    # Insert data\n    user_id = db.insert(\"users\", {\"name\": \"Alice\", \"age\": 30})\n\n# Advanced type checking\nif isoftype(numbers, list[int]):\n    print(\"Numbers is a list of integers!\")\n```\n\n## 📚 Documentation\n\nIn the [`./READMES/`](./READMES/) folder you can find detailed documentation for key features:\n\n### Core Features\n\n#### [`isoftype`](./READMES/isoftype.md)\n**Advanced Type Checking System**\n- Runtime type validation with support for complex types\n- Parametrized generics and union types\n- Protocol and interface checking\n- Enhanced type safety for your applications\n\n#### [`@overload`](./READMES/overload.md)\n**Function Overloading Made Easy**\n- Manage multiple function signatures\n- Type-safe function overloading\n- Simplified API design with clear type hints\n\n#### [`@validate`](./READMES/validate.md)\n**Runtime Type Validation**\n- Protect your functions with automatic argument validation\n- Catch type-related errors early\n- Enhanced debugging and error messages\n\n#### [`tlist`](./READMES/tlist.md)\n**Type-Safe Collections**\n- Runtime type validation for lists\n- Enhanced list operations with type safety\n- Seamless integration with existing code\n\n#### [`Interface`](./READMES/Interface.md)\n**Python Interface Implementation**\n- Create interface-like behavior using metaclasses\n- Abstract class patterns\n- Enhanced object-oriented programming\n\n## 🛠️ Major Features\n\n### Database Abstractions (`@/db`)\n```python\nfrom danielutils.abstractions.db import DatabaseFactory\nfrom danielutils.abstractions.db.database_definitions import (\n    TableSchema, TableColumn, ColumnType, SelectQuery, WhereClause, Condition, Operator\n)\n\n# Get different database backends\nsqlite_db = DatabaseFactory.get_database(\"sqlite\", db_kwargs={\"db_path\": \"test.db\"})\nmemory_db = DatabaseFactory.get_database(\"memory\")\n\n# Create table schema\nschema = TableSchema(\n    name=\"products\",\n    columns=[\n        TableColumn(name=\"id\", type=ColumnType.AUTOINCREMENT, primary_key=True),\n        TableColumn(name=\"name\", type=ColumnType.TEXT, nullable=False),\n        TableColumn(name=\"price\", type=ColumnType.FLOAT),\n        TableColumn(name=\"category\", type=ColumnType.TEXT)\n    ]\n)\n\n# Use database with context manager\nwith memory_db:\n    memory_db.create_table(schema)\n    \n    # Insert data\n    product_id = memory_db.insert(\"products\", {\n        \"name\": \"Laptop\",\n        \"price\": 999.99,\n        \"category\": \"Electronics\"\n    })\n    \n    # Query data\n    query = SelectQuery(\n        table=\"products\",\n        where=WhereClause(\n            conditions=[\n                Condition(column=\"category\", operator=Operator.EQ, value=\"Electronics\")\n            ]\n        )\n    )\n    results = memory_db.get(query)\n```\n\n### Async Programming\n```python\nimport asyncio\nfrom danielutils.async_ import AsyncWorkerPool, AsyncLayeredCommand\n\nasync def process_item(item: str) -\u003e None:\n    \"\"\"Async function to process items\"\"\"\n    await asyncio.sleep(0.1)  # Simulate work\n    print(f\"Processed: {item}\")\n\nasync def main():\n    # Async worker pool\n    pool = AsyncWorkerPool(\"data_processor\", num_workers=3, show_pbar=True)\n    await pool.start()\n    \n    # Submit tasks\n    items = [\"item1\", \"item2\", \"item3\", \"item4\", \"item5\"]\n    for item in items:\n        await pool.submit(process_item, args=(item,), name=f\"process_{item}\")\n    \n    # Wait for completion\n    await pool.join()\n    \n    # Async command execution\n    async with AsyncLayeredCommand(\"echo\") as cmd:\n        result = await cmd.execute(\"Hello from async command\")\n        print(f\"Command output: {result}\")\n\n# Run the async example\nasyncio.run(main())\n```\n\n### Retry Executors\n```python\nfrom danielutils.retry_executor import RetryExecutor\nfrom danielutils.retry_executor.backoff_strategies import ExponentialBackOffStrategy\n\ndef unreliable_function() -\u003e str:\n    \"\"\"Function that might fail\"\"\"\n    import random\n    if random.random() \u003c 0.7:  # 70% chance of failure\n        raise ValueError(\"Random failure\")\n    return \"Success!\"\n\n# Create retry executor with exponential backoff\nbackoff = ExponentialBackOffStrategy(initial=1000)  # 1 second initial delay\nexecutor = RetryExecutor(backoff_strategy=backoff)\n\n# Execute with retry logic\nresult = executor.execute(unreliable_function, max_retries=3)\nif result:\n    print(f\"Function succeeded: {result}\")\nelse:\n    print(\"Function failed after all retries\")\n```\n\n### Data Structures\n```python\nfrom danielutils.data_structures import Graph, MinHeap, PriorityQueue\nfrom danielutils.better_builtins import tlist, tdict\nfrom typing import Any\nfrom danielutils.data_structures.graph import MultiNode\n\n# Type-safe collections\nusers = tlist[str]([\"alice\", \"bob\", \"charlie\"])\nconfig = tdict[str, Any]({\"debug\": True, \"port\": 8080})\n\n# Advanced data structures\ngraph = Graph()\nnode_a = MultiNode(\"A\")\nnode_b = MultiNode(\"B\")\nnode_a.add_child(node_b)\ngraph.add_node(node_a)\n\n# Priority queue with custom objects\nclass Task:\n    def __init__(self, name: str, priority: int):\n        self.name = name\n        self.priority = priority\n    \n    def __lt__(self, other):\n        return self.priority \u003c other.priority\n\nqueue = PriorityQueue[Task]()\nqueue.push(Task(\"high_priority\", 1))\nqueue.push(Task(\"low_priority\", 3))\nqueue.push(Task(\"medium_priority\", 2))\n\n# Min heap\nheap = MinHeap[int]()\nheap.push(5)\nheap.push(2)\nheap.push(8)\nheap.push(1)\n\nprint(f\"Min value: {heap.peek()}\")  # 1\n```\n\n### Progress Tracking\n```python\nfrom danielutils.progress_bar import ProgressBarPool, AsciiProgressBar\n\n# Single progress bar\nwith AsciiProgressBar(range(100), position=0, desc=\"Processing\") as pbar:\n    for i in pbar:\n        # Do some work\n        import time\n        time.sleep(0.01)\n\n# Multiple progress bars\nwith ProgressBarPool(AsciiProgressBar, num_of_bars=2) as pool:\n    # Configure individual bars\n    pool[0].update(50)  # Update first bar\n    pool[1].update(25)  # Update second bar\n    \n    # Write messages\n    pool.write(\"Processing complete!\")\n```\n\n### Reflection \u0026 Debugging\n```python\nfrom danielutils.reflection import FunctionInfo, ClassInfo\nfrom danielutils.reflection.interpreter import is_debugging\n\ndef example_function(name: str, age: int = 25) -\u003e str:\n    \"\"\"Example function for reflection\"\"\"\n    return f\"Hello {name}, age {age}\"\n\n# Function introspection\ninfo = FunctionInfo(example_function, type)\nprint(f\"Function name: {info.name}\")\nprint(f\"Parameters: {info.arguments}\")\nprint(f\"Return type: {info.return_type}\")\n\n# Class introspection\nclass ExampleClass:\n    def __init__(self, value: int):\n        self.value = value\n    \n    def get_value(self) -\u003e int:\n        return self.value\n\nclass_info = ClassInfo(ExampleClass)\nprint(f\"Class methods: {[f.name for f in class_info.instance_methods]}\")\n\n# Runtime debugging detection\nif is_debugging():\n    print(\"Running in debug mode\")\n```\n\n## 🎓 Academic \u0026 Research Tools\n\n### Probability Theory\n```python\nfrom danielutils.university.probability import Distribution\nfrom danielutils.university.probability.funcs import expected_value\nfrom danielutils.university.probability.operator import Operator\n\n# Create probability distributions\nbernoulli = Distribution.Discrete.Ber(p=0.5)  # Bernoulli with p=0.5\nbinomial = Distribution.Discrete.Bin(n=10, p=0.3)  # Binomial with n=10, p=0.3\n\n# Calculate probabilities\nprob_1 = bernoulli.evaluate(1, Operator.EQ)  # P(X=1)\nprob_0 = bernoulli.evaluate(0, Operator.EQ)  # P(X=0)\n\n# Calculate expected values\nexpected_bernoulli = expected_value(bernoulli)\nexpected_binomial = expected_value(binomial)\n\nprint(f\"Bernoulli P(X=1): {prob_1}\")\nprint(f\"Bernoulli E[X]: {expected_bernoulli}\")\n```\n\n## 🔧 Installation\n\n```bash\npip install danielutils\n```\n\n## 📈 Project Status\n\nThis library has evolved significantly since its initial release in September 2022:\n\n- **2022**: Basic utilities and foundational features (v0.5.x - v0.7.x)\n- **2023**: Major development with typed builtins and code quality (v0.8.x - v0.9.x)\n- **2024**: Mature library with async support and advanced features (v0.9.x - v1.0.x)\n- **2025**: Production-ready with database abstractions and enterprise features (v1.0.x+)\n\n## 🤝 Contributing\n\nFeel free to use, contribute, and improve this code! The project welcomes:\n\n- Bug reports and feature requests\n- Code contributions and improvements\n- Documentation enhancements\n- Test coverage improvements\n\n## 📄 License\n\nThis project is licensed under the terms specified in the [LICENSE](./LICENSE) file.\n\n---\n\n**Built with ❤️ for the Python community**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielnachumdev%2Fdanielutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielnachumdev%2Fdanielutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielnachumdev%2Fdanielutils/lists"}