A professional toolkit for Data Science efficiency, featuring automatic logging, runtime type checking, and DataFrame schema validation.
Project description
ds_efficiency
A professional toolkit for Data Science efficiency, featuring automatic logging, runtime type checking, and DataFrame schema validation.
Key Features
- MetaEngine: A metaclass that automatically adds logging, timing, and type validation to your classes.
- DataFrame Validation: Validate Polars DataFrames using docstring schemas.
- Granular Logging: Automatic method-level loggers for easier debugging.
- Runtime Type Checking: Powered by
typeguardto ensure data integrity.
Installation
Using uv (recommended):
uv pip install ds_efficiency
Or using pip:
pip install ds_efficiency
Quick Start
Using MetaEngine
Simply set MetaEngine as the metaclass for your data processing classes.
import polars as pl
from ds_efficiency import MetaEngine
class DataProcessor(metaclass=MetaEngine):
def process_data(self, df: pl.DataFrame) -> pl.DataFrame:
"""
Schema:
-------
df: pl.DataFrame
|-- id: int
|-- value: float
Meta instruction: Drop extra columns.
"""
# The 'df' is automatically validated and casted before this line
self.log_process_data.info("Calculating total...")
return df.with_columns((pl.col("value") * 2).alias("doubled"))
# Usage
processor = DataProcessor()
df = pl.DataFrame({"id": [1, 2], "value": [10.5, 20.0], "extra": [True, False]})
result = processor.process_data(df)
# 'extra' column is dropped, types are checked, and timing is logged!
Logging Configuration
You can configure the log file at the class or environment level:
class MyClass(metaclass=MetaEngine):
log_file = "logs/my_app.log"
log_level = "DEBUG"
Or set the environment variable:
export METAENGINE_LOG_FILE="logs/global.log"
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 ds_efficiency-0.1.1.tar.gz.
File metadata
- Download URL: ds_efficiency-0.1.1.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
658eedc9c4fbaf21e693a610d9dbaac5794d23ba749bb7bcd46eb3f620292856
|
|
| MD5 |
94a7bb03c475dc9434938ec3b5969a1b
|
|
| BLAKE2b-256 |
59ccd78e129dc276d68123f06c729b8b4ddf08cfdc0eac372c36583c3e835a93
|
Provenance
The following attestation bundles were made for ds_efficiency-0.1.1.tar.gz:
Publisher:
publish.yml on if722399/ds_efficiency
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ds_efficiency-0.1.1.tar.gz -
Subject digest:
658eedc9c4fbaf21e693a610d9dbaac5794d23ba749bb7bcd46eb3f620292856 - Sigstore transparency entry: 1333916566
- Sigstore integration time:
-
Permalink:
if722399/ds_efficiency@2188a600c061e81f2f3f7039845980b59775ea53 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/if722399
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2188a600c061e81f2f3f7039845980b59775ea53 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ds_efficiency-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ds_efficiency-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36b538b7f94b1bfa925d0cbdde32e4b3eedaa3e6dd8b94b646d5003a0a555337
|
|
| MD5 |
504b7d206023aedad57ac2b6580bbc25
|
|
| BLAKE2b-256 |
5211d80719bd17a68506a303218e4e67dd183eefd5a2536a7761581f909b0e40
|
Provenance
The following attestation bundles were made for ds_efficiency-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on if722399/ds_efficiency
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ds_efficiency-0.1.1-py3-none-any.whl -
Subject digest:
36b538b7f94b1bfa925d0cbdde32e4b3eedaa3e6dd8b94b646d5003a0a555337 - Sigstore transparency entry: 1333916684
- Sigstore integration time:
-
Permalink:
if722399/ds_efficiency@2188a600c061e81f2f3f7039845980b59775ea53 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/if722399
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2188a600c061e81f2f3f7039845980b59775ea53 -
Trigger Event:
release
-
Statement type: