Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 36 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,53 @@
# smartutils
# pyquicktools

<div align="center">

![PyPI Version](https://img.shields.io/pypi/v/smartutils?color=blue&style=flat-square)
![Python Versions](https://img.shields.io/pypi/pyversions/smartutils?style=flat-square)
![License](https://img.shields.io/pypi/l/smartutils?style=flat-square)
![GitHub Stars](https://img.shields.io/github/stars/suhani1234-5/smartutils?style=flat-square)
![Downloads](https://static.pepy.tech/personalized-badge/smartutils?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)

![PyPI Version](https://img.shields.io/pypi/v/pyquicktools?color=blue&style=flat-square)
![Python Versions](https://img.shields.io/pypi/pyversions/pyquicktools?style=flat-square)
![License](https://img.shields.io/pypi/l/pyquicktools?style=flat-square)
![GitHub Stars](https://img.shields.io/github/stars/Suhani1234-5/pyquicktools?style=flat-square)
![Downloads](https://static.pepy.tech/personalized-badge/pyquicktools?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)

**The Python utility toolbox you didn't know you needed — until now.**

*One package. Minimal dependencies. Maximum productivity.*

**Perfect for GSoC, open-source contributors, backend engineers & interview projects**

Built with **real-world backend failures** in mind — not toy examples.
Built with **real-world backend failures** in mind — not toy examples.

[Installation](#-installation) • [Features](#-features) • [Quick Start](#-quick-start) • [Documentation](#-documentation) • [Contributing](#-contributing)

</div>

---

## Why smartutils?
## Why pyquicktools?

Stop installing 5+ packages for basic Python tasks. **smartutils** combines the most-needed utilities into one lightweight, blazing-fast package:
Stop installing 5+ packages for basic Python tasks. **pyquicktools** combines the most-needed utilities into one lightweight, blazing-fast package:

**Auto-retry HTTP requests** with exponential backoff
**Auto-retry HTTP requests** with exponential backoff
**Colorized debug printing** with file/line tracking
**Async retry support** for `aiohttp`
**Async retry support** for `aiohttp`
**Safe JSON parsing** that fixes common errors
**Minimal configuration** — works out of the box

**Before smartutils:**
**Before pyquicktools:**
```bash
pip install requests tenacity simplejson pprint colorama
```

**After smartutils:**
**After pyquicktools:**
```bash
pip install smartutils
pip install pyquicktools
```

---

## 📦 Installation

```bash
pip install smartutils
pip install pyquicktools
```

**Requirements:** Python 3.8+
Expand All @@ -62,7 +61,7 @@ pip install smartutils
Never lose data to flaky APIs again. Automatic retries with exponential backoff.

```python
from smartutils import get, post
from pyquicktools import get, post

# Auto-retry on failure (default: 3 retries)
response = get("https://api.example.com/data", retries=5, timeout=10)
Expand Down Expand Up @@ -90,7 +89,7 @@ response = post(
Say goodbye to boring `print()` statements. Get beautiful, informative debug output.

```python
from smartutils import dprint
from pyquicktools import dprint

user = {"name": "Suhani", "age": 22}
items = ["laptop", "phone", "charger"]
Expand All @@ -104,7 +103,7 @@ dprint(user, items)
```

**Features:**
- **Color-coded** output (variables in cyan, values in green)
- **Color-coded** output (variables in cyan, values in green)
- **Automatic file + line number** tracking
- **Named arguments** shown clearly
- **Minimal configuration** — just replace `print()` with `dprint()`
Expand All @@ -131,11 +130,11 @@ dprint(error_data, file=open("debug.log", "a"))
Supercharge your async code with automatic retries.

> ⚠️ **Note:** Async features require `aiohttp`.
> Install with: `pip install smartutils aiohttp`
> Install with: `pip install pyquicktools aiohttp`

```python
import asyncio
from smartutils import async_get
from pyquicktools import async_get

async def fetch_data():
# Auto-retry async requests
Expand All @@ -162,7 +161,7 @@ asyncio.run(fetch_data())
Parse JSON that's almost-but-not-quite valid. Fixes common errors automatically.

```python
from smartutils import load_json
from pyquicktools import load_json

# Handles trailing commas, comments, NaN, Infinity
data = load_json("""
Expand All @@ -180,7 +179,7 @@ print(data["age"]) # Output: 22 (int, not string!)
- Trailing commas in arrays/objects
- JavaScript-style comments (`//` and `/* */`)
- `NaN` and `Infinity` values
- Optional smart typecasting for numeric strings
- Optional smart typecasting for numeric strings

---

Expand All @@ -189,7 +188,7 @@ print(data["age"]) # Output: 22 (int, not string!)
### Example 1: Resilient API Calls

```python
from smartutils import get, dprint
from pyquicktools import get, dprint

try:
response = get(
Expand All @@ -209,7 +208,7 @@ except Exception as e:

```python
import asyncio
from smartutils import async_get
from pyquicktools import async_get

async def fetch_multiple():
urls = [
Expand All @@ -232,7 +231,7 @@ asyncio.run(fetch_multiple())
### Example 3: Parse Messy JSON

```python
from smartutils import load_json
from pyquicktools import load_json

# From API response with comments
messy_json = """
Expand Down Expand Up @@ -300,12 +299,12 @@ print(type(data["total"])) # <class 'int'>

---

## 🛠️ Advanced Usage
## Advanced Usage

### Custom Retry Strategy

```python
from smartutils import get
from pyquicktools import get

response = get(
"https://api.example.com/data",
Expand All @@ -321,7 +320,7 @@ response = get(
### Logging with dprint

```python
from smartutils import dprint
from pyquicktools import dprint

# In production: disable colors for log files
with open("debug.log", "a") as log_file:
Expand All @@ -343,38 +342,38 @@ We love contributions! Here's how to get started:
### Development Setup

```bash
git clone https://github.com/Suhani1234-5/smartutils.git
cd smartutils
git clone https://github.com/Suhani1234-5/pyquicktools.git
cd pyquicktools
pip install -e ".[dev]"
pytest
```

---

## License
## License

This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.

---

## Star History
## Star History

If you find this project useful, please consider giving it a ⭐ on [GitHub](https://github.com/suhani1234-5/smartutils)!
If you find this project useful, please consider giving it a ⭐ on [GitHub](https://github.com/Suhani1234-5/pyquicktools)!

---

## 📧 Contact
## Contact

**Suhani Garg**
📧 suhanigarg59@gmail.com
[GitHub](https://github.com/Suhani1234-5)
[GitHub](https://github.com/Suhani1234-5)

---

<div align="center">

**Made with ❤️ by Suhani Garg**

[⬆ Back to Top](#-smartutils)
[⬆ Back to Top](#-pyquicktools)

</div>
15 changes: 8 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "smartutils"
version = "0.1.1"
description = "Smart Python utilities: retry-safe HTTP, colorized debug prints, async retries, safe JSON"
name = "pyquicktools"
version = "0.1.0"
description = "Smart Python utilities for HTTP retries, logging control, async retries, and diagnostics CLI"
readme = "README.md"
license = "MIT"

authors = [
{ name = "Suhani Garg", email = "suhanigarg59@gmail.com" }
]

keywords = ["http", "retry", "debug", "async", "utilities"]
keywords = ["python", "http", "retry", "requests", "cli", "utilities", "logging", "devtools"]
requires-python = ">=3.8"

dependencies = [
Expand All @@ -28,6 +28,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
]

[project.optional-dependencies]
Expand All @@ -36,6 +37,6 @@ async = [
]

[project.urls]
Homepage = "https://github.com/Suhani1234-5/smartutils"
Repository = "https://github.com/Suhani1234-5/smartutils"
Issues = "https://github.com/Suhani1234-5/smartutils/issues"
Homepage = "https://github.com/Suhani1234-5/pyquicktools"
Repository = "https://github.com/Suhani1234-5/pyquicktools"
Issues = "https://github.com/Suhani1234-5/pyquicktools/issues"
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion smartutils/debug_print.py → pyquicktools/debug_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def dprint(*args, prefix="debug", show_location=True, color="cyan"):
"""
Debug print with variable names, values, color and source location
"""
if os.getenv("SMARTUTILS_DEBUG", "1") != "1":
if os.getenv("PYQUICKTOOLS_DEBUG", "1") != "1":
return

frame = inspect.currentframe().f_back
Expand Down
4 changes: 2 additions & 2 deletions smartutils/doctor.py → pyquicktools/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ def run_doctor():
import platform
import requests

print("🩺 smartutils doctor report\n")
print("🩺 pyquicktools doctor report\n")

print(f"✔ Python version: {platform.python_version()}")
print(f"✔ SMARTUTILS_LOG: {'ON' if os.getenv('SMARTUTILS_LOG', '1') == '1' else 'OFF'}")
print(f"✔ PYQUICKTOOLS_LOG: {'ON' if os.getenv('PYQUICKTOOLS_LOG', '1') == '1' else 'OFF'}")

try:
import requests
Expand Down
6 changes: 3 additions & 3 deletions smartutils/http_retry.py → pyquicktools/http_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

# ------------------ LOGGER ------------------
def _get_logger(log_file=None):
if os.getenv("SMARTUTILS_LOG", "1") != "1":
logger = logging.getLogger("smartutils.http")
if os.getenv("PYQUICKTOOLS_LOG", "1") != "1":
logger = logging.getLogger("pyquicktools.http")
logger.addHandler(logging.NullHandler())
return logger

logger = logging.getLogger("smartutils.http")
logger = logging.getLogger("pyquicktools.http")

if logger.handlers:
return logger
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from smartutils import dprint
from pyquicktools import dprint

name = "Suhani"
age = 20

dprint(name, age)
dprint(name, age)
2 changes: 1 addition & 1 deletion tests/test_debug.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from smartutils import dprint
from pyquicktools import dprint


def test_dprint_runs():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_http.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from smartutils import get
from pyquicktools import get


def test_get_success():
Expand All @@ -10,4 +10,4 @@ def test_get_success():

def test_get_retry_fail():
with pytest.raises(Exception):
get("https://httpstat.us/500", retries=1)
get("https://httpstat.us/500", retries=1)
2 changes: 1 addition & 1 deletion tests/test_jsonsafe.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from smartutils import load_json
from pyquicktools import load_json


def test_safe_json():
Expand Down
Loading