A collection of common Python utilities
Project description
pycommontools
A collection of common Python utilities and tools for your personal projects.
Installation
pip install pycommontools
# or
uv add pycommontools
Features
Resources
Singleton Metaclass - Implement the singleton pattern easily:
from pycommontools.resources.singleton import Singleton
class DatabaseConnection(metaclass=Singleton):
def __init__(self, host: str):
self.host = host
# Both instances will be the same object
db1 = DatabaseConnection("localhost")
db2 = DatabaseConnection("localhost")
assert db1 is db2 # True
Configs
Logger Setup - Configure loggers with custom levels:
from pycommontools.configs.logging import setup_logger
import logging
# Create a logger with DEBUG level
logger = setup_logger("myapp", level=logging.DEBUG)
logger.debug("Debug message")
logger.info("Info message")
# Create a logger with WARNING level
warn_logger = setup_logger("myapp.warnings", level="WARNING")
Development
This project uses uv for dependency management.
# Install dependencies
uv sync
# Run tests (when available)
uv run pytest
Requirements
- Python 3.13+
License
MIT
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
pycommontools-0.0.4.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycommontools-0.0.4.tar.gz.
File metadata
- Download URL: pycommontools-0.0.4.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2834a694739fe7b0dace0b894359664d94a6a3868513c76d85a427befa2744b
|
|
| MD5 |
38ac740f6c23879618dd6b1ebd4d5356
|
|
| BLAKE2b-256 |
a6809b02d6786a32a61d329cdc9ec18320387b3c6820953dfa16f58e90afe9e5
|
File details
Details for the file pycommontools-0.0.4-py3-none-any.whl.
File metadata
- Download URL: pycommontools-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89435ff0c8c8fd6b06efdfcb79a2c06a9ae532bbda814fba96a07c78f922de3c
|
|
| MD5 |
bae78d413fc310e02ecd6bdc6f58857d
|
|
| BLAKE2b-256 |
c486a4b577f34d824d2f07f7794648a4760c9870d4425d1cc2b6303464ae7e47
|