tinsel
PySpark schema generator
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 tinseluv
uv add tinselpoetry
poetry add tinselInstalling 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
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
sparkdanticConverts Pydantic models to PySpark schemas…
unclear · top 5,000 on PyPI
sparkaidProvides utilities for working with Spark…
copyleft · top 15,000 on PyPI
quinnQuinn provides helper methods for PySpark…
permissive · top 15,000 on PyPI
dataclasses-avroschemaGenerates Avro schemas from Python dataclasses,…
permissive · top 5,000 on PyPI
warchant_dc_schemaGenerates JSON Schema (2020-12 draft) from…
permissive · top 15,000 on PyPI
namedlistCreates mutable or immutable named tuple-like…
permissive · top 15,000 on PyPI
desertDesert generates marshmallow serialization…
permissive · top 15,000 on PyPI
recordclassRecordclass provides memory-efficient, mutable…
permissive · top 15,000 on PyPI
pyspark-pandasProvides tools for distributing Pandas…
unclear · top 5,000 on PyPI
recordtyperecordtype creates mutable record classes with…
permissive · top 15,000 on PyPI