--- id: tinsel version: "0.3.0" license: MIT license license_treatment: permissive maintenance: abandoned --- # tinsel — PySpark schema generator License: permissive · Maintenance: abandoned · Downloads: 186.8K/mo ## What it is and what it does tinsel is a lightweight PySpark schema generator that converts Python NamedTuple and dataclass definitions into PySpark StructType schemas. Instead of writing verbose, error-prone schema definitions by hand, you define your data structure as a standard Python class, decorate it with @struct, and call transform() to produce the corresponding Spark schema. It handles nested structures, optional fields, collections (lists, dicts), and type annotations natively. The package was last released in September 2018 and is no longer maintained. It targets Python 3.6–3.7 and depends only on pyspark. While it solves a real problem—schema boilerplate reduction—its age and lack of maintenance mean it may not work reliably with modern PySpark or Python versions without testing. Use it for: - Define PySpark DataFrame schemas using Python dataclasses or NamedTuples to avoid hand-written StructType boilerplate. - Quickly prototype data pipelines where schema structure mirrors your application's domain objects. - Generate schemas for nested, optional, and collection-heavy data structures with minimal code. - Keep schema definitions in sync with Python type definitions during development. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates PySpark DataFrame schemas from Python NamedTuple and dataclass definitions, eliminating hand-written schema complexity. No. The package is abandoned (last release 2018-09-01, no maintenance since) and targets Python 3.6–3.7. Compatibility with modern PySpark and Python versions is unverified. For new projects, consider modern alternatives or write schemas directly using PySpark's StructType API. Install only if you are maintaining legacy code already using tinsel and cannot migrate. ## Install pip install tinsel uv add tinsel poetry add tinsel ## Installing tinsel Before you install: Low install friction; depends only on pyspark. However, the package is abandoned—last release was 2018-09-01 and no commits or maintenance activity since. Use only if your PySpark and Python versions remain compatible with the 3.6–3.7 era. License in practice: MIT license (permissive); you may use, modify, and distribute freely with attribution. Quickstart: from dataclasses import dataclass from tinsel import struct, transform from typing import NamedTuple, Optional, List @struct @dataclass class UserInfo: hobby: List[str] @struct class User(NamedTuple): login: str age: int info: Optional[UserInfo] schema = transform(User) df = spark.createDataFrame(data, schema=schema) Requires pyspark to be installed and a SparkSession available; designed for Python 3.6–3.7 era, compatibility with modern Python versions unverified. Verify before relying: - Whether tinsel works with modern PySpark versions (3.x+) and Python 3.8+ - Whether the package handles all complex nested types (e.g., deeply nested structs, union types) reliably - Performance characteristics when dealing with very large or deeply nested schema definitions ## Package facts - License: MIT license (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 186.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pyspark schema generator, dataclass to spark schema, namedtuple spark struct, pyspark schema from python types, automatic spark dataframe schema, pyspark, schema-generation, abandoned [View on SkillFed](https://skillfed.io/packages/tinsel) · [View on PyPI](https://pypi.org/project/tinsel/)