Skip to main content

A comprehensive HTTP utility toolkit built on httpx with CLI support

Project description

EasySeries

CI PyPI version Python 3.10+ Documentation Coverage

A comprehensive HTTP utility toolkit built on httpx with CLI support. EasySeries provides modern Python developers with a robust foundation for building HTTP clients and utilities with advanced features like rate limiting, metrics collection, retry logic, and comprehensive error handling.

โœจ Features

  • ๐Ÿš€ Modern Python: Built with Python 3.10+ using latest async/await patterns
  • ๐Ÿ”ง httpx Integration: Leverages the powerful httpx library for HTTP operations
  • ๐Ÿ“Š Metrics & Monitoring: Built-in request metrics and performance tracking
  • ๐Ÿ›ก๏ธ Error Handling: Comprehensive error handling with custom exceptions
  • โšก Rate Limiting: Configurable rate limiting to respect API limits
  • ๐Ÿ”„ Retry Logic: Intelligent retry mechanisms with exponential backoff
  • ๐ŸŽฏ CLI Interface: Friendly command-line interface for testing and utilities
  • ๐Ÿ“ Type Safety: Full type hints for better development experience
  • โš™๏ธ Configuration: Flexible configuration with environment variable support

๐Ÿš€ Quick Start

Installation

# Using pip
pip install easyseries

# Using uv (recommended)
uv add easyseries

### Basic Usage

```python
import asyncio
from easyseries import HTTPClient

async def main():
    async with HTTPClient(base_url="https://api.example.com") as client:
        # GET request
        response = await client.get("/users")
        users = response.json()

        # POST request
        new_user = await client.post("/users", json={
            "name": "John Doe",
            "email": "john@example.com"
        })

asyncio.run(main())

CLI Usage

# Make a simple request
easyseries request https://httpbin.org/get

# POST with JSON data
easyseries request https://httpbin.org/post \
    --method POST \
    --data '{"name": "John", "age": 30}'

# Benchmark an endpoint
easyseries benchmark https://httpbin.org/get \
    --requests 100 \
    --concurrency 10

# View configuration
easyseries config

๐Ÿ“‹ Development Setup

This project uses modern Python tooling for the best development experience.

Prerequisites

  • Python 3.10 or higher
  • uv (recommended) or pip

Initial Setup

# Clone the repository
git clone https://github.com/ScienisTmiaoT/easyseries.git
cd easyseries

# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install all dependencies including dev tools
uv sync --all-extras --dev

# Install pre-commit hooks
uv run pre-commit install

Development Commands

# Run tests
uv run pytest

# Run tests with coverage
uv run pytest --cov=easyseries --cov-report=html

# Lint and format code
uv run ruff check .
uv run ruff format .

# Type checking
uv run mypy src/easyseries

# Run all checks (lint, format, type check, test)
uv run pre-commit run --all-files

๐Ÿ“š Documentation

Building Documentation Locally

# Install documentation dependencies
uv sync --extra docs

# Build documentation
cd docs
uv run sphinx-build -b html source _build/html

# Serve documentation locally
python -m http.server 8000 -d _build/html

Documentation Structure

  • API Reference: Complete API documentation with examples
  • User Guide: Step-by-step tutorials and how-to guides
  • Development: Contributing guidelines and development setup

๐Ÿ”ง Configuration

EasySeries supports configuration through environment variables or .env files:

# .env file example
EASYSERIES_TIMEOUT=30.0
EASYSERIES_MAX_RETRIES=3
EASYSERIES_BASE_URL=https://api.myservice.com
EASYSERIES_USER_AGENT=MyApp/1.0.0
EASYSERIES_ENABLE_METRICS=true
EASYSERIES_RATE_LIMIT_REQUESTS=100

๐Ÿงช Testing

Running Tests

# Run all tests
uv run pytest

# Run with coverage
uv run pytest --cov=easyseries

# Run specific test file
uv run pytest tests/test_http/test_client.py

# Run with markers
uv run pytest -m "not slow"

Test Structure

  • tests/test_http/ - HTTP client tests
  • tests/test_cli/ - CLI interface tests
  • tests/conftest.py - Shared pytest fixtures

๐Ÿ—๏ธ Project Structure

easyseries/
โ”œโ”€โ”€ src/easyseries/          # Main package
โ”‚   โ”œโ”€โ”€ cli/                 # CLI interface
โ”‚   โ”œโ”€โ”€ core/                # Core functionality
โ”‚   โ””โ”€โ”€ http/                # HTTP client modules
โ”œโ”€โ”€ tests/                   # Test suite
โ”œโ”€โ”€ docs/                    # Documentation
โ”œโ”€โ”€ scripts/                 # Utility scripts
โ””โ”€โ”€ .github/workflows/       # CI/CD workflows

๐Ÿ”„ Dependency Management

Adding Dependencies

# Add runtime dependency
uv add httpx

# Add development dependency
uv add --dev pytest

# Add optional dependency group
uv add --optional docs sphinx

Updating Dependencies

# Update all dependencies
uv sync --upgrade

# Update specific dependency
uv add httpx@latest

# Check for outdated dependencies
uv tree --outdated

Environment Management

# Create lock file
uv lock

# Sync from lock file
uv sync

# Export requirements
uv export --format requirements-txt > requirements.txt

๐Ÿš€ Publishing

Building the Package

# Build wheel and source distribution
uv build

# Check the built package
uv run twine check dist/*

Publishing to PyPI

The project uses GitHub Actions for automated publishing:

  • Automatic Publishing: Push a tag starting with v (e.g., v1.0.0)
  • Manual Publishing: Use the GitHub Actions workflow dispatch
# Create and push a tag
git tag v1.0.0
git push origin v1.0.0

# Or publish manually
uv publish --token $PYPI_TOKEN

๐Ÿค– CI/CD

GitHub Actions Workflows

  • CI Pipeline (.github/workflows/ci.yml):

    • Runs on Python 3.10, 3.11, 3.12, 3.13
    • Linting, type checking, and testing
    • Code coverage reporting
    • Security scanning
  • Publishing (.github/workflows/publish.yml):

    • Publishes to PyPI on tag push
    • Deploys documentation to GitHub Pages
    • Runs on successful CI completion

Branch Protection

Recommended branch protection rules for main:

  • Require pull request reviews
  • Require status checks to pass
  • Require branches to be up to date
  • Include administrators

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Quick Contribution Steps

  • Fork the repository
  • Create a feature branch: git checkout -b feature/amazing-feature
  • Make your changes and add tests
  • Run the test suite: uv run pytest
  • Commit your changes: git commit -m 'Add amazing feature'
  • Push to the branch: git push origin feature/amazing-feature
  • Open a Pull Request

๐Ÿ“ž Support

  • ๐Ÿ“– Documentation
  • ๐Ÿ› Bug Reports
  • ๐Ÿ’ฌ Discussions

๐ŸŽฏ Roadmap

  • WebSocket support
  • GraphQL client utilities
  • Plugin system for custom middleware
  • Built-in caching mechanisms
  • Prometheus metrics export
  • OpenAPI schema validation

EasySeries - Making HTTP requests in Python easier than ever! ๐Ÿš€

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

easyseries-0.1.3.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

easyseries-0.1.3-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file easyseries-0.1.3.tar.gz.

File metadata

  • Download URL: easyseries-0.1.3.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for easyseries-0.1.3.tar.gz
Algorithm Hash digest
SHA256 452aa634c04fb7259aca64c3b15ad7e31ce71af3fe4145fde081cbbd7e0302a7
MD5 aa41d2fefe6629eec905dc81ea97210c
BLAKE2b-256 2143d686f5a75c864b52bf6b5d315f4a1897b3782c18974dd97cc8ea79e47fc4

See more details on using hashes here.

File details

Details for the file easyseries-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: easyseries-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for easyseries-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 88fd3bc48ce2b3cf601fcf42225e44d35ae78d0ae163694eda594e5e45297a64
MD5 562aa2a2b91448b2b4edb3208e853967
BLAKE2b-256 38155ef05b4122db8fd52aca84d9a70c957c8291e7687ad86984090570a27725

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