Modern Python utilities for web APIs
Project description
MarqetiveLib
Modern Python utilities for web APIs - Simple, type-safe, and async-ready.
Features
- 🚀 Fast and Lightweight: Built on httpx with minimal dependencies
- 🔒 Type-Safe: Full type hints and Pyright compliance for better IDE support
- 📦 Zero Learning Curve: Intuitive API design that feels natural
- 🧪 Well Tested: Comprehensive test coverage (>90%)
- 📚 Excellent Documentation: Clear examples and detailed API reference
- 🔄 Async/Await Support: Built for modern async Python applications
- ✨ Developer Friendly: Great error messages and helpful utilities
Installation
pip install marqetive-lib
Or with Poetry:
poetry add marqetive-lib
Quick Start
import asyncio
from marqetive_lib import APIClient
async def main():
async with APIClient(base_url="https://api.example.com") as client:
# Make a GET request
response = await client.get("/users/1")
print(f"User: {response.data['name']}")
# Make a POST request
new_user = {"name": "John Doe", "email": "john@example.com"}
response = await client.post("/users", data=new_user)
print(f"Created user ID: {response.data['id']}")
asyncio.run(main())
Core Features
Simple HTTP Client
from marqetive_lib import APIClient
async with APIClient(base_url="https://api.example.com") as client:
# GET request with query parameters
response = await client.get("/search", params={"q": "python"})
# POST request with JSON body
response = await client.post("/users", data={"name": "Alice"})
# Access response details
print(response.status_code) # 200
print(response.data) # Parsed JSON response
print(response.headers) # Response headers
Utility Functions
from marqetive_lib.utils import (
format_response,
parse_query_params,
build_query_string,
merge_headers
)
# Format JSON responses beautifully
data = {"users": [{"id": 1, "name": "Alice"}]}
print(format_response(data, pretty=True, indent=2))
# Parse URL query parameters
params = parse_query_params("https://api.com/search?q=python&page=1")
# {'q': ['python'], 'page': ['1']}
# Build query strings
query = build_query_string({"search": "api", "limit": 10})
# "search=api&limit=10"
# Merge HTTP headers
headers = merge_headers(
{"Content-Type": "application/json"},
{"Authorization": "Bearer token"}
)
Type-Safe Responses
from marqetive_lib import APIClient
from pydantic import BaseModel
class User(BaseModel):
id: int
name: str
email: str
async with APIClient(base_url="https://api.example.com") as client:
response = await client.get("/users/1")
user = User(**response.data) # Automatic validation
print(user.name)
Documentation
Full documentation is available at marqetive-lib.readthedocs.io
Requirements
- Python 3.9+
- httpx >= 0.27.0
- pydantic >= 2.0.0
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/yourusername/marqetive-lib.git
cd marqetive-lib
# Install Poetry if you haven't already
curl -sSL https://install.python-poetry.org | python3 -
# Install dependencies
poetry install --with dev,docs
# Activate virtual environment
poetry shell
Running Tests
# Run tests
poetry run pytest
# Run tests with coverage
poetry run pytest --cov=src/marqetive_lib --cov-report=term-missing
# Run tests for specific Python versions
poetry run tox
Code Quality
# Lint code with Ruff
poetry run ruff check .
# Format code with Ruff
poetry run ruff format .
# Type check with Pyright
poetry run pyright src/
Building Documentation
# Serve documentation locally with live reload
poetry run mkdocs serve
# Build static documentation
poetry run mkdocs build
Contributing
Contributions are welcome! Please read our Contributing Guide for details on:
- Code of conduct
- Development workflow
- Code style guidelines
- Testing requirements
- Pull request process
Changelog
See CHANGELOG.md for a list of changes in each release.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with httpx for HTTP requests
- Uses Pydantic for data validation
- Tested with pytest
- Documentation powered by MkDocs Material
Support
- Documentation: marqetive-lib.readthedocs.io
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Links
- PyPI: pypi.org/project/marqetive-lib
- Source Code: github.com/yourusername/marqetive-lib
- Documentation: marqetive-lib.readthedocs.io
- Changelog: CHANGELOG.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marqetive_lib-0.1.5.tar.gz.
File metadata
- Download URL: marqetive_lib-0.1.5.tar.gz
- Upload date:
- Size: 69.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.9 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1867cbb8a052b520b030831026acc8b83def8dbb1b821e33bd6e00a578dd5dc3
|
|
| MD5 |
5a9d68810a9e6b7c5758cfe7bf5f1772
|
|
| BLAKE2b-256 |
ab384bc4465ea6f96d389d4b2eb2e561a94ebc9a6c9e57584569d25eca95af5d
|
File details
Details for the file marqetive_lib-0.1.5-py3-none-any.whl.
File metadata
- Download URL: marqetive_lib-0.1.5-py3-none-any.whl
- Upload date:
- Size: 85.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.9 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b4a2ee0e8c91aec839ae206f864681343e1b34dc0d07311c505c60c2f5d0942
|
|
| MD5 |
9363d957c1d69b8670b37d1a1087389f
|
|
| BLAKE2b-256 |
4b3dbb62b7442a370c1bef6b5745158518d57cbe2524bf51b67030692b9bada7
|