Skip to main content

A collection of common python utilities.

Project description

Python Mooch

PyPI PyPI - Downloads GitHub Issues or Pull Requests

standard-readme compliant license

This Python package is a collection of useful Python code that is commonly used on all types of Python projects.

Table of Contents

📖 Features

Config File

Uses a TOML config file. Easily get/set configuration values. Automatically sets values to defaults if they're not currently saved in the configuration file.

Location

Provide a zip code to get city, state and lat, lon.

Requires

Throw an exception if the installed python version isn't new enough. Throw an exception if the desired operating system is incorrect.

Logging

Add automatic logging to methods that are run by using a decorator. Useful for logging function arguments, start of function and end of function.

🛠 Install

# PyPI
pip install mooch

or

uv add mooch

📌 Dependencies

Python 3.9 or greater

🎮 Usage

Config File

from mooch import Config
default_settings = {
    "settings": {
        "name": "MyName,
        "mood": "happy",
    },
}

config = Config("settings.toml", default_settings)

print(config["settings.mood"])
config["settings.mood"] = "angry"
print(config["settings.mood"])

Location

from mooch import Location
location = Location(62704).load()

assert location.city == "Springfield"
assert location.state == "Illinois"
assert location.state_abbreviation == "IL"
assert location.latitude == "39.7725"
assert location.longitude == "-89.6889"

Requires

Throws an Exception if the requirement isn't satisified.

from mooch import Require

Require.python_version("3.13")
Require.operating_system("Windows")

Logging Decorator

For adding 'BEGIN' and 'END' to log files whenever the decorated function runs. Also logs the values of the args passed in.

from mooch.logging.decorators import log_entry_exit

@log_entry_exit
def random_function(arg1, arg2){
    print(arg1)
    print(arg2)
}

🏆 Contributing

PRs accepted.

If editing the Readme, please conform to the standard-readme specification.

Bug Reports and Feature Requests

Please use the issue tracker to report any bugs or request new features.

Contributors

📃 License

MIT © Nick Stuer

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

mooch-0.0.2.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

mooch-0.0.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file mooch-0.0.2.tar.gz.

File metadata

  • Download URL: mooch-0.0.2.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.22

File hashes

Hashes for mooch-0.0.2.tar.gz
Algorithm Hash digest
SHA256 076c06933f9bf9e6dd578626947d30d71e0edd1556cc93e0bb1303914b648c9b
MD5 e632c3ef7eb7dee3913c3047901c33d1
BLAKE2b-256 4472fa8833e2f6304619eb69ad6ba9609d747446752299b9310b36473eebac3b

See more details on using hashes here.

File details

Details for the file mooch-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: mooch-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.22

File hashes

Hashes for mooch-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bb74647f3e60da947a207592f5d8e5e232c6504b3bb11dc3ae81cfad2c96c67d
MD5 3500571658cd8e90c1e93af7097702cc
BLAKE2b-256 c1e108891c55b242171aeec829224d4eddb58661c80cb922e769c430a91f5c06

See more details on using hashes here.

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