Skip to main content

core-mixins

This project contains common functions, decorators, and mixin classes as the base for other projects or libraries…


PyPI Downloads Python Versions License Pipeline Status Docs Status Security

Installation

Install from PyPI using pip:

pip install core-mixins
uv pip install core-mixins  # Or using UV...

Features

This library provides the following modules and utilities:

Compatibility
  • Self - Type hint for self-referential classes

  • StrEnum - String enumeration compatibility across Python versions

Decorators (core_mixins.decorators)
  • cache / cache_memory_based - In-memory LRU memoization with optional maxsize and ttl

  • cache_file_based - Write-through two-level cache (L1 memory + L2 disk), survives process restarts

  • count_calls - Track function call counts

  • repeat - Execute functions multiple times

  • retry - Automatic retry with configurable backoff

  • singleton - Enforce single instance pattern

  • SyncWrapper - Convert async functions to synchronous

  • with_timeout - Subprocess-based timeout, cross-platform, sub-second precision

  • with_timeout_signal - Signal-based timeout (Unix/Linux only), minimal overhead

  • timer - Measure function execution time

File Utilities (core_mixins.files)
  • records_from_csv / records_to_csv - CSV file handling

  • records_from_buffer / records_to_buffer - In-memory CSV operations

Interfaces (core_mixins.interfaces)
  • IFactory - Factory pattern interface

  • ITask - Task interface with status tracking

  • TaskStatus - Task state enumeration

  • TaskException - Task-specific exceptions

Managers (core_mixins.managers)
  • TasksManager - Manage and execute multiple tasks

  • TaskResult - Task execution result container

Logging (core_mixins.logger)
  • get_logger - Standardized logger configuration

Utilities (core_mixins.utils)
  • random_string - Generate random strings

  • get_batches - Batch list processing

  • remove_attributes / rename_attributes / add_attributes - Dictionary manipulation

  • convert_data_type - Type conversion utilities

  • to_snake_case - Convert strings to snake_case

  • flatten_json - Flatten nested JSON structures

  • to_one_line - Convert multiline strings to single line

  • bytes_to_str - Convert bytes to string

Exceptions (core_mixins.exceptions)
  • get_exception_data - Extract structured exception information

CLI Utilities (core_mixins.cli)
  • ProgressTracker - TTY-aware progress bar; animates on real terminals, falls back to logger.info on Lambda/ECS/CI. Built as a zero-dependency alternative to tqdm, keeping core-mixins dependency-free so it does not pull transitive packages into production services where supply-chain surface area and package size matter.

Quick Start

Installation

Install the package:

pip install core-mixins
uv pip install core-mixins  # Or using UV...
pip install -e ".[dev]"    # For development...

Setting Up Environment

  1. Install required libraries:

pip install --upgrade pip
pip install virtualenv
  1. Create Python virtual environment:

virtualenv --python=python3.12 .venv
  1. Activate the virtual environment:

source .venv/bin/activate

Install packages

pip install .
pip install -e ".[dev]"

Check tests and coverage

python manager.py run-tests                             # unit tests (default)
python manager.py run-tests -t integration              # integration tests
python manager.py run-tests -t functional -p "*.py"     # functional tests
python manager.py run-coverage                          # all tests with coverage

Contributing

Contributions are welcome! Please:

  1. Fork the repository

  2. Create a feature branch

  3. Write tests for new functionality

  4. Ensure all tests pass: python manager.py run-tests

  5. Run linting: pylint core_mixins

  6. Run security checks: bandit -r core_mixins

  7. Submit a pull request

License

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

Support

For questions or support, please open an issue on GitLab or contact the maintainers.

Authors

Metadata

Release files for core-mixins 3.2.2

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

Source distribution (sdist)

Source distribution for core-mixins 3.2.2
File Size Uploaded
core_mixins-3.2.2.tar.gz 23.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for core-mixins 3.2.2
File Interpreter ABI Platform
core_mixins-3.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 52.4 kB

Release files / core_mixins-3.2.2.tar.gz

Download URL core_mixins-3.2.2.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
098b2c1a11294d7a07d844a8cdaf1549e6d68290ddd0e1dc8a71c1d5586cf3c3
BLAKE2b-256 checksum
How to use checksums
2974e9e6e8e7f0b01936817889fcf78f60c666e03b263421b98050b1474626ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / core_mixins-3.2.2-py3-none-any.whl

Download URL core_mixins-3.2.2-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2df1b8616126d1ad7d942bc437d0ceddfbeb47dd4835c7ee37d3fdc057bc184
BLAKE2b-256 checksum
How to use checksums
3d9b22f002cc5f30cd502bb6a2314ce8e54bace09f05f322fe7c410d2cd1dd0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

3.2.2 This release

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.3

2 release files

3.1.2

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.0

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