Skip to main content

A modern, type-safe Python library for building robust REST API clients with automatic Pydantic validation, async support, and extensible route patterns.

Project description

Restic

PyPI version Python versions License: MIT

A modern, type-safe Python library for building robust REST API clients with automatic Pydantic validation, async support, and extensible route patterns.

Features

  • Type Safety: Full type hints and Pydantic model validation for requests and responses
  • Async Support: Both synchronous and asynchronous operations
  • Generic Routes: Reusable route classes for common REST operations (CRUD)
  • Error Handling: Comprehensive exception handling with detailed error messages
  • Flexible Configuration: Customizable timeouts, authentication, and headers
  • Extensible: Easy to extend with custom mixins and route logic

Installation

Requirements: Python 3.10+

pip install restic

Or with UV:

uv add restic

Dependencies

  • httpx: HTTP client for making requests
  • pydantic: Data validation and serialization
  • typing-extensions: Enhanced type hints for older Python versions

Usage & Examples

The package provides a ResticClient base class and reusable route mixins for building type-safe API clients. Routes are composed using mixins for different HTTP operations, with automatic request/response validation via Pydantic models.

See the examples/ directory for complete usage examples:

  • json_placeholder.py: Full example with JSONPlaceholder API

The code is simple enough that users can learn how to use it directly from the source code and examples.

Development

Setup

# Clone the repository
git clone https://github.com/tobasqo/restic.git
cd restic

# Install with UV
uv sync

Testing

# Run tests
uv run pytest

# Run linting
uv run ruff check .

# Run formatting
uv run ruff format .

# Run type checking
uv run mypy .

Building

# Build the package
uv build

License

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

References

Packages

These libraries are not integrated into the package but are worth mentioning for those who want to extend functionality:

Other resources

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

restic-0.1.0a0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

restic-0.1.0a0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file restic-0.1.0a0.tar.gz.

File metadata

  • Download URL: restic-0.1.0a0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for restic-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 d04b492eeab73fbba2635b6ede82024c9c9253ab1315ff3dbcfcddfa6e3b228b
MD5 a9282349589970025124c2ea69b6addf
BLAKE2b-256 b83ce46b28eead6fc0fc082a874bcb5583a54c8919ef2f355ea91f7d7f4a3490

See more details on using hashes here.

File details

Details for the file restic-0.1.0a0-py3-none-any.whl.

File metadata

  • Download URL: restic-0.1.0a0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for restic-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 b743aa977b43099d808206512709a0f2039525275425bf6415fa9370982b4c5d
MD5 e644f7065143d7ae268e372ee0e5392b
BLAKE2b-256 a6becf270b59a01c116f4a4fff17e9c61c90346ee9cb7f702bea67f34ac73ef5

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