{"id":5795,"library":"pockets","title":"pockets","description":"The Pockets library is a collection of Python helper functions that streamline common development tasks. It provides utilities for logging, collections, datetime manipulation, object inspection, string operations, and iterators. The current version is 0.9.1, last updated in November 2019, suggesting a maintenance or slow release cadence.","status":"maintenance","version":"0.9.1","language":"en","source_language":"en","source_url":"https://github.com/RobRuana/pockets/","tags":["utilities","helpers","collections","logging","datetime","strings","iterators","reflection"],"install":[{"cmd":"pip install pockets","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for Python 2/3 compatibility features in older versions; listed as a runtime dependency.","package":"six"}],"imports":[{"symbol":"log","correct":"from pockets.autolog import log"},{"note":"Functions are often hoisted to the top-level 'pockets' package for convenience, making direct submodule imports less common but still correct.","wrong":"from pockets.string import camel","symbol":"camel","correct":"from pockets import camel"},{"note":"Functions are often hoisted to the top-level 'pockets' package for convenience, making direct submodule imports less common but still correct.","wrong":"from pockets.string import uncamel","symbol":"uncamel","correct":"from pockets import uncamel"},{"note":"Functions are often hoisted to the top-level 'pockets' package for convenience, making direct submodule imports less common but still correct.","wrong":"from pockets.inspect import resolve","symbol":"resolve","correct":"from pockets import resolve"},{"note":"Functions are often hoisted to the top-level 'pockets' package for convenience, making direct submodule imports less common but still correct.","wrong":"from pockets.iterators import iterpeek","symbol":"iterpeek","correct":"from pockets import iterpeek"},{"symbol":"groupify","correct":"from pockets.collections import groupify"}],"quickstart":{"code":"from pockets import camel, uncamel, resolve, iterpeek\n\n# String utilities\ncamel_case_str = camel(\"xml_http_request\", upper_segments=[1])\nprint(f\"Camel case: {camel_case_str}\")\n\nunderscore_str = uncamel(\"XmlHTTPRequest\")\nprint(f\"Underscore case: {underscore_str}\")\n\n# Object resolution\nlist_class = resolve(\"builtins.list\")\nprint(f\"Resolved object: {list_class}\")\n\n# Iterator peeking\np = iterpeek([\"a\", \"b\", \"c\", \"d\", \"e\"])\nprint(f\"Peek next: {p.peek()}\")\nprint(f\"Next item: {next(p)}\")\nprint(f\"Peek 3 items: {p.peek(3)}\")","lang":"python","description":"This quickstart demonstrates common string manipulation utilities like `camel` and `uncamel`, object resolution using `resolve`, and advanced iterator functionality with `iterpeek`."},"warnings":[{"fix":"Thoroughly test `pockets` in your target Python environment. Consider migrating to more actively maintained, purpose-built libraries for specific utilities if compatibility issues arise or if modern Python features are desired.","message":"The library's last update was in November 2019. While it aims for Python 2/3 compatibility, this old version may have compatibility issues or lack features with newer Python 3.x releases (e.g., Python 3.10+).","severity":"breaking","affected_versions":"<=0.9.1"},{"fix":"Always restrict the search path by explicitly specifying the `modules` parameter when using `resolve` with user-provided input. E.g., `resolve('my_module.MyClass', modules=['my_module'])`.","message":"The `resolve` function, which converts a string name into a Python object, can be a security risk if the input string is from an untrusted source. Malicious input could lead to arbitrary code execution.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use the new names (`itermod`, `iterpeek`) for clarity and future compatibility.","message":"Some classes in `pockets.iterators` were renamed in version 0.9 (e.g., `modify_iter` to `itermod`, `peek_iter` to `iterpeek`). While original names are still exported for backwards compatibility, relying on them might lead to issues in future versions if they are eventually removed.","severity":"deprecated","affected_versions":">=0.9"},{"fix":"Be aware of potential performance or style implications. For new Python 3 projects, evaluate if a more modern, Python 3-native utility library or built-in functions would be more appropriate.","message":"The library's reliance on `six` and notes about Python 2.6 specific behaviors (e.g., `groupify` returning regular dicts instead of OrderedDicts) suggest it was developed with older Python versions in mind. Using it in a modern Python 3-only project might introduce unnecessary overhead or less Pythonic patterns.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}