Skip to main content

A toolkit for reuse

Project description

🧰 ten-utils

A reusable Python toolkit for structured logging, configuration, and utilities — built for extensibility and clarity.

PyPI version License Python


✨ Features

  • ✅ Structured and styled logging with rich
  • 🔁 Singleton-based configuration manager
  • 🧪 Clean testable architecture with pytest
  • 📦 Easy to integrate into any project

📦 Installation

You can install ten-utils using pip:

pip install ten-utils

Or with development tools:

pip install ten-utils[dev]

🚀 Quick Start

from ten_utils.log.logger import Logger
from ten_utils.log.config import LoggerConfig

# Set global configuration
LoggerConfig().set_default_level_log(1)       # INFO
LoggerConfig().set_save_log_to_file(False)    # Don't write to file

# Create logger instance
logger = Logger(name="MyApp")

# Logging
logger.debug("This is a debug message")     # Will be ignored (default = INFO)
logger.info("App started successfully")
logger.warning("This is a warning")
logger.error("An error occurred")

⚙️ Configuration

Use LoggerConfig to globally control logging behavior:

from ten_utils.log.config import LoggerConfig

LoggerConfig().set_default_level_log(2)       # Set minimum level to WARNING
LoggerConfig().set_save_log_to_file(True)     # Enable file output

🧪 Running Tests

pytest tests/ --disable-warnings -v

To install test/dev dependencies:

pip install ten-utils[dev]

🧱 Project Structure

ten_utils/
│
├── log/
│   ├── logger.py            # Main Logger class (Rich-powered)
│   ├── config.py            # Global logging configuration (Singleton)
│
├── common/
│   ├── decorators.py        # Decorators (e.g., log-level filter)
│   ├── constants.py         # Global constants for log levels and formats
│   ├── singleton.py         # Base singleton pattern implementation
│   ├── validators.py        # Input validation helpers
│
├── tests/                   # Unit tests

📜 License

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


👤 Author

Александр Караваев
Email
GitHub Profile


💡 Contributing

Contributions, issues and feature requests are welcome!
Feel free to open a discussion or a pull request.


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

ten_utils-0.0.9.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

ten_utils-0.0.9-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file ten_utils-0.0.9.tar.gz.

File metadata

  • Download URL: ten_utils-0.0.9.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for ten_utils-0.0.9.tar.gz
Algorithm Hash digest
SHA256 d524dda340d41cb0a02234bc9e3819fbfc136a510698a0b51ed5a8f07a66daea
MD5 314cb2675be98082161f73aa15ead31d
BLAKE2b-256 eab12e5f1ffca7c48b07cce0a8a90a224d18c77e296bd446b68484e5cd03e7ea

See more details on using hashes here.

File details

Details for the file ten_utils-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: ten_utils-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for ten_utils-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 be81a9d13c7299546d502d0f8a7ffe00d468147ae2957dbdd5d463938f1e7c04
MD5 7fc65d244d6b38f7d370580de2854c1e
BLAKE2b-256 07ba75879c00f05f15bce53825726cc3f372940f6619f0fc9a58fa8cf311ef98

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