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

  • In-place modification of functions for common “optimization” tasks

  • 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.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

miniutils-1.0.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for miniutils-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2147bf47a6c13b597bda848132c0fa9e3c326dfc8d77f382c2c30136ecd53965
MD5 ce5f5b83d45ec9e15957b6d2e90b3ede
BLAKE2b-256 f784784e44b711742aa0e504940f7078ef41b15e0063c094e909319991632aa8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for miniutils-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26c604dfbcf1ba89eaaead2836bbe48f1f35c10b9aa5b80af7f4e72bf7b09325
MD5 b7df4442647fafb39f12005a417ae5b8
BLAKE2b-256 2f5d3619ed8540a8ae45d22e74a4f1e9b93f1b5ea7e55702624a4b3ac162c628

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