Skip to main content

Python powertool in your pocket

Project description

pocketwelt

Python powertool in your pocket :hammer:

Introduction

pocketwelt purpose is to provide basic tools for Python projects.

Idea for this package came from my personal experience of repeating certain methods over and over again - quite simple, but yet too complex to keep them in my memory at all times.

Hopefully pocketwelt will help you as it helps me - as a pocekt tool that comes in handy when I want to kickstart development as fast as possible or simply forgot about simple base64 encoding ;)

Worth noting - package uses only built-in Python libraries. My purpose is to keep this as vanilla as possible, so it does not collide with other dependencies you might have in your project.

Installation

pocketwelt is available on PyPi and you can install it via pip:

pip install pocketwelt

You can also install it straight from git:

pip install git+https://github.com/neurowelt/pocketwelt.git

Usage

Since this package is built using only vanilla Python libraries you can start using it right away after installing! Check out a few examples to get you going:

Custom colored logger

pocketwelt comes with a neat CustomLogger class that provides colored logs and simple file based logging. You can create as many loggers as you want by simply calling the following method:

from pocketwelt import getCustomLogger

error_logger = getCustomLogger("Error Logger", "ERROR")
info_logger = getCustomLogger("Info Logger", "INFO")

# Use as usual
error_logger.error("Error")
error_logger.info("Info that won't log")
info_logger.info("Info")

Pickle your custom class

Often times when working with large dictionaries that contain more complex types you may want to save your current class for later to quickly reload it. You can more than easily use the following methods to do this:

from pocketwelt import save_pickle, load_pickle
from your_script.complex_class import CustomClass

# Perform some operations with your class
llm = CustomClass()
llm.func()
llm.calc()

# Save object for later
save_pickle(llm, "llm.pkl")

# Reload it back
llm = load_pickle("llm.pkl")

Decode base64 images

You never know when you're going have to decode some base64 objects - that's where the encodings module comes in! For example, decoding base64 image to PIL.Image never have been easier:

from pocketwelt import b64_decode
from PIL import Image

decoded_obj = b64_decode(b64_image)
image = Image.open(decoded_obj)

[!TIP] Check out the official documentation to read in detail about every single method and their limitations!

Contribute

If you have a tool in your mind that you would like to see added to this package - feel encouraged to setup an issue, create a pull request with your own code or just write to me with anything that comes to your mind!

Whenever you see a bug, vulnerability or place for enhancement, also do not hesitate to open an issue describing your findings. Any contribution will be greatly appreciated <3

Notes

When going through the tests directory you will find a painting of Gandalf (see original) that I use for testing. It was created by Jef Murray, a reknown fantasy illustrator. I recommend visiting his site to see more of his work. MIT License

Copyright (c) - 2024 - neurowelt

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

pocketwelt-0.1.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pocketwelt-0.1.2-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file pocketwelt-0.1.2.tar.gz.

File metadata

  • Download URL: pocketwelt-0.1.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pocketwelt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f4b68beb88302490eeb3f5ae98cd537c59d1da8fad176d7544b3855b375ef930
MD5 132e495d1f88b3889a05469653b8a2ec
BLAKE2b-256 c6d40503cf660bba519f0699b9810eb1707cd3f73a60641fe01eb089b7c78749

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocketwelt-0.1.2.tar.gz:

Publisher: publishing.yml on neurowelt/pocketwelt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pocketwelt-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pocketwelt-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pocketwelt-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e79a97dc057461ac20da4133da3809ed8e741fad79bda77fbcc1aa9cf91590d0
MD5 c38f29e4d1a77ce80b08fe594a76c40c
BLAKE2b-256 36efa77fc29bbd9cacfd5954c7da5b943709eb708692ea4f73c7559b9fdf0726

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocketwelt-0.1.2-py3-none-any.whl:

Publisher: publishing.yml on neurowelt/pocketwelt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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