Skip to main content

Small Python utilities for adding concise functionality and usability to your code

Project description

https://coveralls.io/repos/github/scnerd/miniutils/badge.svg?branch=master https://travis-ci.org/scnerd/miniutils.svg?branch=master Documentation Status

Overview

Full documentation for this module is available over at ReadTheDocs.

This module provides numerous helper utilities for Python3.X code to add functionality with minimal code footprint. It has tools for the following tasks:

  • Progress bars on serial loops and parallel mappings (leveraging the excellent tqdm library)

  • Simple lazy-compute and caching of class properties, including dependency chaining

  • Executing Python2 code from within a Python3 program

  • More intuitive contract decorator (leveraging pycontracts)

Installation

As usual, you can install the latest code version directly from Github:

pip install git+https://github.com/scnerd/miniutils

Or you can pip install the latest release from PyPi:

pip install miniutils

Examples

To get started, you can import your desired utilities directly from miniutils. For example, to use the CachedProperty decorator:

from miniutils import CachedProperty

class MyClass:
   @CachedProperty
   def attribute(self):
      return some_slow_computation(self)

Or to use the progress bar utilities:

from miniutils import progbar, parallel_progbar

def mapper(x):
   return x**2

assert [mapper(i) for i in progbar(100)] == parallel_progbar(mapper, range(100))

To see documentation for each feature, look through this documentation or the table of contents above.

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

miniutils-1.0.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

miniutils-1.0.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file miniutils-1.0.1.tar.gz.

File metadata

  • Download URL: miniutils-1.0.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for miniutils-1.0.1.tar.gz
Algorithm Hash digest
SHA256 addc11154f801d8feb3c0da15e77d9f7e0d724ed99d71e71eba74ec1add24907
MD5 037803909a59a347ac871fb4279d89eb
BLAKE2b-256 bf6f21dd9777ce54caf3956bbf07b414176318e3700599edcf4658f9c12ff7e0

See more details on using hashes here.

File details

Details for the file miniutils-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for miniutils-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 604aeee7fb2466c14a09a97cdc7571f186a28b105d56e0cc21d1fb87f74f9d8e
MD5 26b3e0e5bc56932569df7176609ab856
BLAKE2b-256 31a5fb922ee4c7a1c5301534a7fdb9462b48c5dc18e3b23f40d4e2b3d076b89f

See more details on using hashes here.

Supported by

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