Skip to main content

Yet another python utilities library for collecting useful bicycles and crutches in one place.

Project description

pure-utils

PyPI Version Development Status PyPI - Python Version Downloads PyPI - License

Yet another python utilities library for collecting useful bicycles and crutches in one place.

Main principles:

  1. No third party dependencies (standart library only).
  2. Mostly pure functions without side effects.
  3. Interfaces with type annotations.
  4. Comprehensive documentation with examples of use.
  5. Full test coverage.

For detail information read the doc.

Available utilities

  • common - The common purpose utilities.
    • Singleton - A metaclass, implements the singleton pattern for inheritors.
  • containers - Utilities for working with data containers (lists, dicts, tuples, sets, etc.).
    • bisect(collection, /) - Bisect the list into two parts/halves based on the number of elements.
    • first(collection, /) - Get the value of the first element from a homogeneous collection.
    • flatten(collection, /) - Make the iterated collection a flat (single nesting level).
    • get_or_else(collection, index[, default]) - Get value of element, and if it is missing, return the default value.
    • omit(container, keys, /) - Omit key-value pairs from the source dictionary, by keys sequence.
    • paginate(collection, /, *, size) - Split the collection into page(s) according to the specified limit.
    • pick(container, keys, /) - Pick key-value pairs from the source dictionary, by keys sequence.
    • symmdiff(collection1, collection2, /) - Obtain the symmetric difference of two sequences.
    • unpack(container, attributes, /) - Unpack the values of container object into separate variables.
  • debug - Utilities for debugging and development.
    • around(*[, before, after]) - Add additional behavior before and after execution of decorated function.
    • caller(*[, at_frame]) - Get the name of calling function/method (from current function/method context).
    • deltatime(*[, logger]) - Measure execution time of decorated function and print it to log.
    • profileit(*[, logger, stack_size]) - Profile decorated function being with 'cProfile'.
  • profiler - Helper classes for working with the cProfile.
    • Profiler - A class provides a simple interface for profiling code.
  • repeaters - Utilities for repeatedly execute custom logic.
    • Repeater - Base Repeater, implements a main logic, such as constructor and execute method.
    • ExceptionBasedRepeater - Repeater based on catching targeted exceptions.
    • PredicateBasedRepeater - Repeater based on predicate function.
    • repeat(repeater) - Repeat wrapped function by repeater logic.
  • strings - Utilities for working with strings.
    • genstr([length, is_uppercase]) - Generate ASCII-string with random letters.
    • gunzip(compressed_string, /) - Compress string (or bytes string) with gzip compression level.
    • gzip(string, /, *[, level]) - Decompress bytes (earlier compressed with gzip) to string.
  • system - The system purpose utilities.
    • execute(args, *[, input, timeout]) - Execute command into external process.
  • times - Utilities for working with datetime objects.
    • apply_tz(dt[, tz]) - Apply timezone context to datetime object.
    • iso2format(isostr, fmt, /) - Convert ISO-8601 datetime string into a string of specified format.
    • iso2dmy(isostr, /) - Convert ISO-8601 datetime string into a string of DMY (DD.MM.YYYY) format.
    • iso2ymd(isostr, /) - Convert ISO-8601 datetime string into a string of YMD (YYYY-MM-DD) format.
    • round_by(dt, /, *, boundary) - Round datetime, discarding excessive precision.
  • types - Helper module with common types.

License

MIT License.

Copyright (c) 2024 Peter Bro <p3t3rbr0@gmail.com || peter@peterbro.su>

See LICENSE file for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pure_utils-0.9.2.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pure_utils-0.9.2-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pure_utils-0.9.2.tar.gz.

File metadata

  • Download URL: pure_utils-0.9.2.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for pure_utils-0.9.2.tar.gz
Algorithm Hash digest
SHA256 d163da658f0809ff4fab8fd7511b8a2449166f2b72ba257ead055e75436a128d
MD5 6e212ef60af72609a1270b9054992ce2
BLAKE2b-256 1a636cfa5ea6772c0bb8e758b03928bf9475dbc6f37b0e6e4f666182bf3b340d

See more details on using hashes here.

File details

Details for the file pure_utils-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: pure_utils-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for pure_utils-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 437f0d4a2cc403dc6b606264f94577e0de16e176b555431e9ae908d83712cc90
MD5 943eb610ea178d1b6e24818d2c4dca16
BLAKE2b-256 c09a444139160e4000a09ca27c2700c40776c05cc0a1271c9148c1afad1fd95f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page