# Python Mooch

![PyPI](https://img.shields.io/pypi/v/mooch?label=mooch)
![PyPI - Downloads](https://img.shields.io/pypi/dm/mooch)
<img alt="GitHub Issues or Pull Requests" src="https://img.shields.io/github/issues/nickstuer/mooch">

[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![license](https://img.shields.io/github/license/nickstuer/mooch.svg)](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](https://github.com/nickstuer/mooch?tab=readme-ov-file#-features)
- [Install](https://github.com/nickstuer/mooch?tab=readme-ov-file#-install)
- [Usage](https://github.com/nickstuer/mooch?tab=readme-ov-file#-usage)
- [Contributing](https://github.com/nickstuer/mooch?tab=readme-ov-file#-contributing)
- [License](https://github.com/nickstuer/mooch?tab=readme-ov-file#-license)

## 📖 Features

### 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

### Location
```python
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.
```python
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.

```python
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](https://github.com/RichardLitt/standard-readme) specification.

#### Bug Reports and Feature Requests
Please use the [issue tracker](https://github.com/nickstuer/mooch/issues) to report any bugs or request new features.

#### Contributors

<a href = "https://github.com/nickstuer/mooch/graphs/contributors">
  <img src = "https://contrib.rocks/image?repo=nickstuer/mooch"/>
</a>

## 📃 License

[MIT © Nick Stuer](LICENSE)