Metadata-Version: 2.4
Name: pydiverse-colspec
Version: 0.2.4
Summary: Validate column specifications and constraints for SQL tables and polars data frames.
Author: QuantCo, Inc.
Author-email: Martin Trautmann <windiana@users.sf.net>, Finn Rudolph <finn.rudolph@t-online.de>
License: BSD 3-Clause License
        
        Copyright (c) 2022, pydiverse
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: SQL
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development
Requires-Python: <3.14,>=3.11
Requires-Dist: pydiverse-common<0.4,>=0.3.4
Requires-Dist: structlog<26,>=25.4.0
Description-Content-Type: text/markdown

# pydiverse.colspec

[![CI](https://github.com/pydiverse/pydiverse.colspec/actions/workflows/tests.yml/badge.svg)](https://github.com/pydiverse/pydiverse.colspec/actions/workflows/tests.yml)

A data validation library that ensures type conformity of columns in SQL tables and polars data frames.
It can also validate constraints regarding the data as defined in a so-called column specification provided
by the user.

The purpose is to make data pipelines more robust by ensuring that data meets expectations and more readable by adding
type hints when working with tables and data frames.

ColSpec is founded on the ideas of [dataframely](https://github.com/Quantco/dataframely) which does exactly the same but
with focus on polars data frames. ColSpec delegates to dataframely in the back especially for features like sampling random
input data conforming to a given column specification. dataframely uses the term schema as it is also used in the polars
community. Since ColSpec also works with SQL databases where the term schema is used for a collection of tables, the
term is avoided as much as possible. The term column specification means exactly the same but avoids the confusion.

## Merit attribution

ColSpec is the brain child of [dataframely](https://github.com/Quantco/dataframely). Large parts of the codebase is code
duplicated from it. Unfortunately, integrating the SQL native validation into dataframely would have made it a less clean
solution for people who just focus on Polars. Thus the decision was made to replicate the same functionality in the
pydiverse library collection also with the benefit to enable smoother integration with other pydiverse libraries.

## Usage

pydiverse.colspec can either be installed via pypi with `pip install pydiverse-colspec` or via
conda-forge with `conda install pydiverse-colspec -c conda-forge`.
