Skip to main content

We'll take care of the boilerplate, so you can focus on your problems.

Project description

katalytic version tests coverage docs license: MIT

Don't use in production yet. I will likely tweak the function names and the default behaviour a few more times.

We'll take care of the boilerplate, so you can focus on your problems.

Installation

pip install katalytic

# Include plugins with 3rd-party dependencies
pip install katalytic[all]

Plugins with 3rd-party dependencies:

Features

data

  • Checks for the structure or properties of data structures
  • Convert between different data representations
  • Sort or apply map recursively on nested data structures
  • Positive and negative front detection
  • TODO: Link to tocs
>>> detect_fronts_positive('00101101')
[2, 4, 7]

>>> swap_keys_and_values({'a': 1, 'b': 2, 'c': 3})
{1: 'a', 2: 'b', 3: 'c'}

>>> as_list_of_dicts([['b', 'a'], [1, 2], [3, 4]])
[{'b': 1, 'a': 2}, {'b': 3, 'a': 4}]

>>> flatten_recursive([1, [2, [3, 4], 5], 6])
[1, 2, 3, 4, 5, 6]

files

  • Atomic operations
  • Load and save files with a uniform interface
  • Copy, move, and delete files without searching the docs for the right function
  • The functions return the same type as the input (Path or str)
  • TODO: Link to tocs
>>> get_files('/home/user/*bash*', prefix=True)
['/home/user/.bash_history', '/home/user/.bash_logout', '/home/user/.bashrc']

>>> get_files('/home/user/*bash*', prefix=False)
['.bash_history', '.bash_logout', '.bashrc']

>>> get_unique_path('{}.csv')
'/tmp/tmp3s0_ltan/1.csv'

maths

  • Calculate the L1 and L2 distance between two vectors
  • Clip a value to a minimum or maximum
  • Convert bounding boxes between different formats
  • Calculate the IoU (Intersection Over Union) between bounding boxes
  • TODO: Link to tocs
>>> clip(123, 0, 10)
10
>>> clip(-1, 0, 10)
0

>>> convert_bbox([100, 100, 300, 400], 'xyXY', 'xy_wh')
((100, 100), (200, 300))

>>> box_1 = [100, 100, 300, 400]
>>> box_2 = [50, 150, 250, 100]
>>> intersect_bboxes(box_1, 'xyXY', box_2, 'xywh')
(100, 150, 300, 250)

>>> calc_IoU(box_1, 'xyXY', box_2, 'xywh')
0.3076923076923077

metaprogramming

  • Access the functions at any depth of the call stack
  • TODO: Link to tocs
    >>> def foo():
    ...     caller = reference_caller_function()
    ...     print(f'{caller.__name__}() called foo()')
    ...
    >>> def bar():
    ...     foo()
    ...
    >>> bar()
    bar() called foo()

Roadmap

  • decorators
  • regexes
  • interactive exploration tools/utilities
  • maths
  • geometry
  • data processing
    • images
    • text
    • tabular
    • structured (e.g. list of dicts <-> dict of lists)

Similar projects

  • boltons
    • Boltons is a set of over 230 BSD-licensed, pure-Python utilities in the same spirit as — and yet conspicuously missing from — the standard library
  • more-itertools
    • Python's itertools library is a gem - you can compose elegant solutions for a variety of problems with the functions it provides. In more-itertools we collect additional building blocks, recipes, and routines for working with Python iterables.
  • dateutil
    • The dateutil module provides powerful extensions to the standard datetime module, available in Python.
  • toolz
    • A functional standard library for Python.

Contributing

We appreciate any form of contribution, including but not limited to:

  • Code contributions: Enhance our repository with your code and tests.
  • Feature suggestions: Your ideas can shape the future development of our package.
  • Architectural improvements: Help us optimize our system's design and API.
  • Bug fixes: Improve user experience by reporting or resolving issues.
  • Documentation: Help us maintain clear and up-to-date instructions for users.

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

katalytic-0.4.0.tar.gz (55.3 kB view details)

Uploaded Source

Built Distribution

katalytic-0.4.0-py3-none-any.whl (40.0 kB view details)

Uploaded Python 3

File details

Details for the file katalytic-0.4.0.tar.gz.

File metadata

  • Download URL: katalytic-0.4.0.tar.gz
  • Upload date:
  • Size: 55.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for katalytic-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ff098114dfa8afe0d159631276e1fb51756c0f1a96623c72bac0e3f63de161fd
MD5 4c28d36ab184e32e8dd8d2f9bd468f28
BLAKE2b-256 2d644837b0768db309cd8f4a1f9eb6678914c937f975be7e35921a5acc427065

See more details on using hashes here.

File details

Details for the file katalytic-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: katalytic-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 40.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for katalytic-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f455100df9586b21af67983c3c124468865daa7c82c1c5755d3e6bfc6327b94a
MD5 3c67f0b82b4a6651dca5bcd40fb9b41f
BLAKE2b-256 9779fd15451414ed3922e5c218ca3db703a4ecb10bd6da2c63e8b95533d187f9

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