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-0.0.1a6.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

miniutils-0.0.1a6-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file miniutils-0.0.1a6.tar.gz.

File metadata

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

File hashes

Hashes for miniutils-0.0.1a6.tar.gz
Algorithm Hash digest
SHA256 03b219d55cefaa5a3b2ebf7098a67f95604564409c096f5db926a956f326f3df
MD5 32c88ae3623d5f37274e0306a90996df
BLAKE2b-256 1e18efdda6795a4588eee4ec7c2e7d30ae470f2ec6733fb9e2d09e60a534e186

See more details on using hashes here.

File details

Details for the file miniutils-0.0.1a6-py3-none-any.whl.

File metadata

File hashes

Hashes for miniutils-0.0.1a6-py3-none-any.whl
Algorithm Hash digest
SHA256 ef1bc41d544ea32814577343070a4cc7b9b843b75350b6af817d43686ee832cd
MD5 5420a15b8cfc5bc4fc717d08c0483671
BLAKE2b-256 636e6f6bca6c695bf261a708570bdd77f0f86cbf200169eb579d8c68fc6142b6

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