Skip to main content

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 typeguard to 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ds_efficiency-0.1.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

ds_efficiency-0.1.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

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

Hashes for ds_efficiency-0.1.1.tar.gz
Algorithm Hash digest
SHA256 658eedc9c4fbaf21e693a610d9dbaac5794d23ba749bb7bcd46eb3f620292856
MD5 94a7bb03c475dc9434938ec3b5969a1b
BLAKE2b-256 59ccd78e129dc276d68123f06c729b8b4ddf08cfdc0eac372c36583c3e835a93

See more details on using hashes here.

Provenance

The following attestation bundles were made for ds_efficiency-0.1.1.tar.gz:

Publisher: publish.yml on if722399/ds_efficiency

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

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

Hashes for ds_efficiency-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36b538b7f94b1bfa925d0cbdde32e4b3eedaa3e6dd8b94b646d5003a0a555337
MD5 504b7d206023aedad57ac2b6580bbc25
BLAKE2b-256 5211d80719bd17a68506a303218e4e67dd183eefd5a2536a7761581f909b0e40

See more details on using hashes here.

Provenance

The following attestation bundles were made for ds_efficiency-0.1.1-py3-none-any.whl:

Publisher: publish.yml on if722399/ds_efficiency

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