Skip to main content

Penguin Tech Python Libraries

Shared Python libraries for Penguin Tech applications.

Installation

pip install penguin-libs

# With all extras
pip install penguin-libs[all]

# With specific extras
pip install penguin-libs[flask]
pip install penguin-libs[grpc]
pip install penguin-libs[http]

Features

Validation

PyDAL-style input validators with Pydantic integration:

from penguin_libs.validation import IsEmail, IsLength, chain
from penguin_libs.pydantic import EmailStr, StrongPassword

# Direct validation
validator = IsEmail()
result = validator("user@example.com")

# Chained validators
validators = chain(IsNotEmpty(), IsLength(3, 255), IsEmail())
result = validators("user@example.com")

# Pydantic models
from pydantic import BaseModel

class User(BaseModel):
    email: EmailStr
    password: StrongPassword

gRPC

Server helpers, client utilities, and security interceptors:

from penguin_libs.grpc import create_server, GrpcClient, AuthInterceptor

# Server
interceptors = [AuthInterceptor(secret_key="your-secret")]
server = create_server(interceptors=interceptors)

# Client
client = GrpcClient('localhost:50051')
with client.channel() as channel:
    stub = MyServiceStub(channel)
    response = client.call_with_retry(stub.MyMethod, request)

HTTP

Resilient HTTP client with retry logic and circuit breaker:

from penguin_libs.http import HTTPClient, HTTPClientConfig, RetryConfig

config = HTTPClientConfig(
    timeout=30.0,
    retry=RetryConfig(max_retries=3, base_delay=1.0)
)
client = HTTPClient(config)
response = client.get("https://api.example.com/users")

Pydantic Integration

Base models and Flask integration:

from penguin_libs.pydantic import (
    RequestModel,
    validated_request,
    model_response,
)

class CreateUserRequest(RequestModel):
    name: str
    email: EmailStr

@app.route('/users', methods=['POST'])
@validated_request(body_model=CreateUserRequest)
def create_user(body: CreateUserRequest):
    return model_response(UserResponse(...))

Modules

  • validation: PyDAL-style validators (string, numeric, network, datetime, password)
  • grpc: gRPC server/client helpers and security interceptors
  • http: HTTP client with retries, circuit breaker, correlation ID
  • pydantic: Base models, Flask integration, custom Annotated types
  • crypto: Cryptographic utilities (placeholder)
  • security: Security utilities (placeholder)

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src tests
ruff check src tests

# Type check
mypy src

License

AGPL-3.0 - See LICENSE for details.

Metadata

Release files for penguin-libs 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for penguin-libs 0.1.0
File Size Uploaded
penguin_libs-0.1.0.tar.gz 42.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for penguin-libs 0.1.0
File Interpreter ABI Platform
penguin_libs-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 89.7 kB

Release files / penguin_libs-0.1.0.tar.gz

Download URL penguin_libs-0.1.0.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5b094006e50a468bef926b280f64ff42f3a718972a2d819dc553c368d4c2cefc
BLAKE2b-256 checksum
How to use checksums
97ebdf9411ffe97f0bd240ab74fa1ee861cbcc593060efa05b1d71ad1af8c661
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 11, 2026.

Transparency log

Release files / penguin_libs-0.1.0-py3-none-any.whl

Download URL penguin_libs-0.1.0-py3-none-any.whl
Size 47.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ebcf4c646cd7fafabe67eef4400d7ff536fd85ecded45bd23756c368e35b366
BLAKE2b-256 checksum
How to use checksums
bc0e2deae32c1588c6087ab18704f21c55f09b00d5e4090394743770d2708cbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page