Skip to main content

Collection of general python utilities for future projects

Project description

Holytools

A collection of general utilities in various very general areas that aim for simplicity in use. Functionalities include:

  • object serialization -> holytools.abstract.serialization
  • fileIO and mock files -> holytools.file
  • configuration management -> holytools.configs
  • file system navigation and management -> holytools.fsys
  • task/event scheduling -> holytools.events
  • hardware interaction -> holytools.hardware
  • web search/scraping -> holytools.web
  • command line interfaces -> holytools.userIO

Setup

Latest release from PyPI:

pip install holytools 

OR: Most recent commit from github:

git clone https://github.com/Somerandomguy10111/holytools && pip install ./holytools

Examples

  • holytools.fsys -> Zip a file or folder or get resource information
# fsys
from holytools.fsys import FsysNode
node = FsysNode(path='/home/daniel/Drive/Desktop/fluent_python.pdf')
zip_bytes = node.get_zip()
last_modified : float = node.get_epochtime_last_modified()
file_size_mb : float = node.get_size_in_MB()
  • holytools.config -> set/get configs from a config file or from unix password manager "pass"
# config
from holytools.configs import FileConfigs, PassConfigs
configs = FileConfigs(config_fpath='~/myconfigs.ini')
key = 'plot_images'
configs.set(key=key, value=False)
plot_images : bool = configs.get(key=key) # False

pass_configs = PassConfigs()
secret_key = pass_configs.get(key='secret_key')
  • holytools.abstract -> Save/load
# serialization
from holytools.abstract import Picklable
class SomeClass(Picklable):
    def __init__(self, s : str, x : float):
        import uuid
        self.s = s
        self.x = x
        self.uuid = uuid.uuid4()

obj = SomeClass(s='hello there', x =2.3)
serialized_obj = obj.to_str()
loaded_obj = SomeClass.from_str(s=serialized_obj)
print(obj.__dict__)          # {'s': 'hello there', 'x': 2.3, 'uuid': UUID('79b489be-3871-4da0-ade4-665097b9bf42')}
print(loaded_obj.__dict__)   # {'s': 'hello there', 'x': 2.3, 'uuid': UUID('79b489be-3871-4da0-ade4-665097b9bf42')}

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

holytools-0.9.4.tar.gz (861.1 kB view hashes)

Uploaded Source

Built Distribution

holytools-0.9.4-py3-none-any.whl (875.9 kB view hashes)

Uploaded Python 3

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