Skip to main content

Shared Python utilities for Penguin Tech applications

Project description

Penguin Tech Python Utilities

Shared Python utilities for Penguin Tech applications.

Installation

pip install penguin-utils

# With Flask extras
pip install penguin-utils[flask]

Usage

Sanitized Logging

from penguintechinc_utils import get_logger, sanitize_log_data
from penguintechinc_utils.logging import SanitizedLogger

# Simple logger
log = SanitizedLogger("MyComponent")

# Automatically sanitizes sensitive data
log.info("User login attempt", {
    "email": "user@example.com",  # Logs as: [email]@example.com
    "password": "secret123",       # Logs as: [REDACTED]
    "remember_me": True,           # Logs as-is
})

# Output: [MyComponent] INFO: User login attempt {'email': '[email]@example.com', 'password': '[REDACTED]', 'remember_me': True}

Sanitization Rules

The following are automatically redacted:

  • Passwords, secrets, tokens
  • API keys, auth tokens
  • MFA/TOTP codes
  • Session IDs, cookies
  • Full email addresses (only domain is logged)

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.

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

penguin_utils-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

penguin_utils-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file penguin_utils-0.1.0.tar.gz.

File metadata

  • Download URL: penguin_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for penguin_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 885da3f3ffb50bb9130def5b871e52420b7ad4b285e3b1c1bd85c4d259a08b1e
MD5 186d65c245c70a711697c2c83a629b75
BLAKE2b-256 0dde73a16f786c5ed1339fb97bd925ac46caca0abbb6b84b86ccade84b29eabd

See more details on using hashes here.

Provenance

The following attestation bundles were made for penguin_utils-0.1.0.tar.gz:

Publisher: publish.yml on penguintechinc/penguin-libs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file penguin_utils-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: penguin_utils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for penguin_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e66b54b1fbb0a87d91bdff5465d2e616ffb6c26be925f321f99215eb74e5d4aa
MD5 08d56e2e8a9800238b61a7d458b63a66
BLAKE2b-256 ffd5e85e4cd98b3201d3ef7ee47f1255a0a2f8a95cff72c3b16186833f2c1d25

See more details on using hashes here.

Provenance

The following attestation bundles were made for penguin_utils-0.1.0-py3-none-any.whl:

Publisher: publish.yml on penguintechinc/penguin-libs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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