skillfed

tinsel

PySpark schema generator

tinsel v0.3.0 186.8K downloads/30d#9,976 on PyPI
Permissive license MIT license Abandoned released

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 on this page — 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

tinsel on PyPI

pip

pip install tinsel

uv

uv add tinsel

poetry

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 not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — pyspark
Maintenance abandoned — 2,904 days since the last release
First released
Downloads 186,783/month — #9,976 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tinsel-0.3.0-py2.py3-none-any.whl

Keywords: tinsel, pyspark, spark, schema, struct

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7

Tags

pyspark schema generatordataclass to spark schemanamedtuple spark structpyspark schema from python typesautomatic spark dataframe schema
pysparkschema-generationabandoned

More Software Development packages