Skip to main content

Tools I need in every python project

Project description

What is this?

The tools I find myself copying and pasting between every python project.

How do I use this?

pip install blissful_basics

from blissful_basics import print, flatten, to_pure, stringify, stats, product, countdown, large_pickle_save, large_pickle_load, FS, Object

# 
# print helpers
# 
if 1:
    # settings
    print.indent.string = "    "
    
    # recursively indents function calls
    @print.indent.function 
    def my_func(counter=5):
        if counter <= 0: return
        print(f"function call {counter} start")
        my_func(counter-1)
        print(f"function call {counter} done")
    
    
    my_func()
    
    #    function call 5 start
    #        function call 4 start
    #            function call 3 start
    #                function call 2 start
    #                    function call 1 start
    #                    function call 1 done
    #                function call 2 done
    #            function call 3 done
    #        function call 4 done
    #    function call 5 done
    
    
    # simple indent
    with print.indent:
        print("howdy1")
        with print.indent:
            print("howdy2")
        print("howdy3")
    
    #    howdy1
    #        howdy2
    #    howdy3
    
    # also indents stuff from the function
    with print.indent.block("stuff"):
        print("hi")
        my_func()
    
    # stuff
    #     hi
    #        function call 5 start
    #            function call 4 start
    #                function call 3 start
    #                    function call 2 start
    #                        function call 1 start
    #                        function call 1 done
    #                    function call 2 done
    #                function call 3 done
    #            function call 4 done
    #        function call 5 done

# 
# to_pure()
# 
if 1:
    import numpy
    import torch

    to_pure(numpy.array([1,2,3,4,5]))   # [1,2,3,4,5]
    to_pure(torch.tensor([1,2,3,4,5]))  # [1,2,3,4,5] # even if its on a GPU device

# 
# stats
# 
if 1:
    stats([1,2,3,4,5])
    # Object(
    #     max = 5,
    #     min = 1,
    #     range = 4,
    #     count = 5,
    #     sum = 15,
    #     average = 3.0,
    #     stdev = 1.5811388300841898,
    #     median = 3,
    #     q1 = 1.5,
    #     q3 = 4.5,
    #     normalized = (0.0, 0.25, 0.5, 0.75, 1.0),
    # )

# 
# plain object
# 
if 1:
    a = Object(thing=10)
    a.thing # 10
    a.thing = 99
    a.thing # 99

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

blissful_basics-0.2.33.tar.gz (4.2 MB view details)

Uploaded Source

Built Distribution

blissful_basics-0.2.33-py3-none-any.whl (4.4 MB view details)

Uploaded Python 3

File details

Details for the file blissful_basics-0.2.33.tar.gz.

File metadata

  • Download URL: blissful_basics-0.2.33.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/6.7.0 pkginfo/1.9.6 requests/2.31.0 requests-toolbelt/1.0.0 tqdm/4.65.0 CPython/3.8.13

File hashes

Hashes for blissful_basics-0.2.33.tar.gz
Algorithm Hash digest
SHA256 35e2ce49706a1f7eee99e0de956ab82b5336c69527b8f88931a0eb1698065e54
MD5 2d5be40299d3103db819d145d201a17f
BLAKE2b-256 c05db2e54ff95ac4ef9b1c54790f79c25269667b4c2dced683aa46d830b566ac

See more details on using hashes here.

File details

Details for the file blissful_basics-0.2.33-py3-none-any.whl.

File metadata

  • Download URL: blissful_basics-0.2.33-py3-none-any.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/6.7.0 pkginfo/1.9.6 requests/2.31.0 requests-toolbelt/1.0.0 tqdm/4.65.0 CPython/3.8.13

File hashes

Hashes for blissful_basics-0.2.33-py3-none-any.whl
Algorithm Hash digest
SHA256 76957621e56ff74bf3fc7d839014d2909255239878cc0053bba7e6440600e863
MD5 5b2e4fa6dec1d066b24cf28229b6c447
BLAKE2b-256 29821c6402026374397e6d44979a7c1bb65cfd824583e2bd341cad6fc700daab

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