Skip to main content

Sparkless

PySpark-compatible DataFrames in Python—no JVM, no cluster.
Drop-in replacement for local development and testing. Same API, 10–100× faster feedback.

Before you adopt: Read caveats — UDF limits, parity gaps, not a Spark cluster replacement.

  • Python 3.11+ · PySpark 3.2–3.5 compatible · MIT

In 30 seconds

# Swap the import—everything else stays the same.
from sparkless.sql import SparkSession, functions as F

spark = SparkSession.builder.app_name("demo").get_or_create()
df = spark.createDataFrame([{"x": 1}, {"x": 2}])
df.filter(F.col("x") > 1).show()
pip install "sparkless>=4,<5"

No Java, no Spark install, no 30-second session startup. Ideal for unit tests and CI.


Why Sparkless?

If you… Sparkless gives you…
Test PySpark code Same SparkSession / DataFrame / Column API; tests run in seconds without a JVM
Run in CI No Java, no Spark distribution, no flaky cluster; just pip install and pytest
Develop locally Fast iteration with Parquet, CSV, JSON, Delta, SQL, temp views—no cluster needed
Need real PySpark sometimes Use sparkless.testing: one test suite, run with sparkless or SPARKLESS_TEST_MODE=pyspark

v4 uses the robin-sparkless Rust engine (Polars under the hood). No Polars Python dependency at runtime—just a small native extension.


Installation

From PyPI (recommended)

pip install "sparkless>=4,<5"

Prebuilt wheels are provided for common platforms (Linux, macOS, Windows).
For development from the robin-sparkless repo:

# From repo root
pip install ./python

Contributors should use the uv setup and native build workflow.

Optional extras

Extra Use case
pip install "sparkless[dev]" pytest, pandas, hypothesis, pytest-xdist
pip install "sparkless[jdbc]" JDBC integration tests (testcontainers, drivers)
pip install "sparkless[pyspark]" Run tests against real PySpark (SPARKLESS_TEST_MODE=pyspark)
pip install "sparkless[server]" Own a native HTTP statement server child process

The optional server extra installs a platform-specific sparkless-server-bin wheel. SparklessServer and AsyncSparklessServer own the child, wait for its versioned native-readiness record, and stop/reap it when their context exits:

from sparkless import SparklessServer

with SparklessServer() as server:
    print(server.http_url)

The async equivalent supports async with. Both expose HTTP only; spark_connect_url raises because Spark Connect is not enabled. An explicit executable_path can select a matching locally built binary. The launcher does not search PATH, download a binary, or compile one at runtime.

Supported platforms

Prebuilt wheels are published for CI targets on each release (see PyPI files):

OS Architectures Notes
Linux x86_64, aarch64 glibc manylinux; musl (Alpine) wheels where available
macOS arm64, x86_64 Universal coverage via separate wheels
Windows x86_64, arm64 Prebuilt extension modules

Python: 3.11, 3.12, 3.13, 3.14 (cp311 ABI3 wheels).

If no wheel matches your platform, follow the source build instructions.


Quick start

Basic usage

from sparkless.sql import SparkSession, functions as F

spark = SparkSession.builder.app_name("MyApp").get_or_create()
data = [{"name": "Alice", "age": 25}, {"name": "Bob", "age": 30}]
df = spark.createDataFrame(data)

df.filter(F.col("age") > 25).select("name").show()
# +----+
# |name|
# +----+
# | Bob|
# +----+

result = df.filter(F.col("age") > 25).select("name").collect()
# [Row(name='Bob')]

In tests (pytest)

import pytest
from sparkless.sql import SparkSession, functions as F

def test_high_scores():
    spark = SparkSession.builder.app_name("test").get_or_create()
    df = spark.createDataFrame([{"score": 95}, {"score": 87}, {"score": 92}])
    high = df.filter(F.col("score") > 90)
    assert high.count() == 2
    assert high.agg(F.avg("score")).collect()[0][0] == 93.5
    spark.stop()

SQL and temp views

df = spark.createDataFrame([{"name": "Alice", "salary": 50000}, {"name": "Bob", "salary": 60000}])
df.createOrReplaceTempView("employees")

spark.sql("SELECT name, salary FROM employees WHERE salary > 50000").show()

Bounded Arrow export

toArrow() still returns a materialized PyArrow Table. Use toArrowBatches() to stream RecordBatches from the query plan with row and byte limits:

with df.toArrowBatches(max_rows=1024, max_bytes=8 * 1024 * 1024) as batches:
    for batch in batches:
        consume(batch)  # batch is a pyarrow.RecordBatch
        if should_stop():
            break

Each batch stays within both values (max_bytes is checked against RecordBatch.nbytes); if a single row is larger than max_bytes, iteration raises ValueError. The defaults are 10,000 rows and 64 MiB. Close the iterator (or use it as a context manager) after an early stop so the query stops producing batches.

JDBC (PostgreSQL, SQLite, MySQL, etc.)

# Read
url = "jdbc:postgresql://localhost:5432/mydb"
df = spark.read.jdbc(url=url, table="users", properties={"user": "u", "password": "p"})

# Write
df.write.jdbc(url=url, table="users_backup", properties={"user": "u", "password": "p"}, mode="overwrite")

Supported: PostgreSQL, SQLite, MySQL, MariaDB, SQL Server, Oracle, DB2. Same options as PySpark (sessionInitStatement, batchsize, truncate, etc.).


API at a glance

Area Supported
SparkSession builder, createDataFrame, table, sql, range, read_csv / read_parquet / read_json / read_delta, temp/global temp views, catalog, stop
DataFrame filter, select, withColumn, show, collect, toArrow, toArrowBatches, count, groupBy, orderBy, limit, drop, distinct, join, union, unionByName, write, createOrReplaceTempView
Column / functions col, lit, when/then/otherwise, comparison/aggregation/string/window functions; F.col("x") > 1, F.upper("name"), etc.
GroupedData count, sum, avg, min, max, agg, pivot
Read/Write Parquet, CSV, JSON, Delta; saveAsTable; JDBC with standard options

Detailed parity and differences: PYSPARK_DIFFERENCES.md, PARITY_STATUS.md.


Dual-mode testing (sparkless + PySpark)

Use sparkless.testing to run the same tests with the sparkless backend (fast) or real PySpark (parity check).

1. Register the plugin (e.g. in conftest.py):

pytest_plugins = ["sparkless.testing"]

2. Write tests using the spark and optional spark_imports fixtures:

def test_filter(spark):
    df = spark.createDataFrame([{"id": 1}, {"id": 2}])
    assert df.filter(df.id > 1).count() == 1

def test_upper(spark, spark_imports):
    F = spark_imports.F
    df = spark.createDataFrame([{"name": "alice"}])
    assert df.select(F.upper("name")).collect()[0][0] == "ALICE"

3. Run

# Default: sparkless backend (no JVM)
pytest tests/ -v

# Parallel
pytest tests/ -n 12 -v

# Against real PySpark (requires Java + pip install pyspark)
SPARKLESS_TEST_MODE=pyspark pytest tests/ -v

Fixtures: spark, spark_mode, spark_imports, isolated_session, table_prefix
Markers: @pytest.mark.sparkless_only, @pytest.mark.pyspark_only, @pytest.mark.delta
Helpers: assert_dataframes_equal(), compare_dataframes()

Full details: TESTING_GUIDE.md.


Requirements

  • Python 3.11+
  • Sparkless mode: No Java or Spark required.
  • PySpark mode (optional): Java and pip install pyspark for SPARKLESS_TEST_MODE=pyspark.

Development

Follow CONTRIBUTING.md to create the root .venv, install development dependencies with uv, and build the native extension. From the repository root:

# Rebuild after changing Rust or PyO3 code
(
  cd python
  uv run --no-project --python ../.venv/bin/python \
    python -m maturin develop --uv --locked --release
)

# Run a focused test against the rebuilt extension
uv run --no-project --python .venv/bin/python \
  python -m pytest tests/unit/test_external_catalog_provider.py -q

For wheels and PySpark parity runs, see the contributor guide. Rust engine, UDFs, embedding: see the main README and docs.


Limitations

  • UDFs: Use built-in functions and expressions; Python UDFs are not exposed. Rust UDFs are supported in the engine (UDF_GUIDE).
  • Compatibility: Some APIs or behaviors differ from PySpark; see PYSPARK_DIFFERENCES.md.

Optional security hardening

For production or multi-tenant use, set SPARKLESS_HARDENED=1 and/or:

  • SPARKLESS_JDBC_ALLOW_ARBITRARY_SQL=false — disallow arbitrary JDBC SQL; use dbtable only
  • SPARKLESS_FILES_BASE=/path/to/sandbox — confine read/write file paths to that directory

See PYSPARK_DIFFERENCES.md — Security hardening for resource limits and multiprocessing notes.


Version history: v3 vs v4

Sparkless v3 Sparkless v4 (this package)
Backend Polars (Python) robin-sparkless (Rust + Polars)
Repo sparkless robin-sparkless
Install pip install sparkless pip install "sparkless>=4,<5" or pip install ./python
Runtime Polars Python Native extension only; no Polars Python

Same from sparkless.sql import SparkSession in both. v4 is the current major release.


Metadata

Release files for sparkless 4.17.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sparkless 4.17.0
File Size Uploaded Provenance Actions
sparkless-4.17.0.tar.gz 3.0 MB With provenance Details for sparkless-4.17.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for sparkless 4.17.0
File Actions
sparkless-4.17.0-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details for sparkless-4.17.0-cp311-abi3-win_arm64.whl
sparkless-4.17.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for sparkless-4.17.0-cp311-abi3-win_amd64.whl
sparkless-4.17.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for sparkless-4.17.0-cp311-abi3-musllinux_1_2_x86_64.whl
sparkless-4.17.0-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for sparkless-4.17.0-cp311-abi3-musllinux_1_2_aarch64.whl
sparkless-4.17.0-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for sparkless-4.17.0-cp311-abi3-manylinux_2_28_aarch64.whl
sparkless-4.17.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for sparkless-4.17.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
sparkless-4.17.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for sparkless-4.17.0-cp311-abi3-macosx_11_0_arm64.whl
sparkless-4.17.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for sparkless-4.17.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 340.7 MB

Release files / sparkless-4.17.0.tar.gz

Download URL sparkless-4.17.0.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
3d79baf64508eaf2e8a34bd71d48c0c9f5a35ae95045d5fcb1ddc1b766ddea10
BLAKE2b-256 checksum
How to use checksums
ac1180b80e63ee17ae896e72a1d3885a30c7be1e062227c4a1c9b650076f1373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sparkless-4.17.0-cp311-abi3-win_arm64.whl

Download URL sparkless-4.17.0-cp311-abi3-win_arm64.whl
Size 40.4 MB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
ada3b6eeedd16a632c4b00738fc638d95e30cd9dfcfd797fa60d0ef91a24d162
BLAKE2b-256 checksum
How to use checksums
4fcda5350154a2c551c4f7a731cd0762f3565ed56fb234f3875bccd2bafff205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sparkless-4.17.0-cp311-abi3-win_amd64.whl

Download URL sparkless-4.17.0-cp311-abi3-win_amd64.whl
Size 44.1 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
828761bf58095b0e153ae5b73bd413e731007a60d44c31a8edcfc72220d4196e
BLAKE2b-256 checksum
How to use checksums
7e150ebbc80579c1ea3e6eee326ecb1fa601d5f6973b8d53533696c767d6dd03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sparkless-4.17.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL sparkless-4.17.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 42.0 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
359b8102ee990b54c027c86a6e7a0c10f711fa0347d030dd851e9c98ba2f5e77
BLAKE2b-256 checksum
How to use checksums
39f81efbf5e197103c88b7f29cad0b0a1ee1ee3940063a14a21f2d939aa4c760
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sparkless-4.17.0-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL sparkless-4.17.0-cp311-abi3-musllinux_1_2_aarch64.whl
Size 39.2 MB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
e954578bf35a2e4f6bb66725585addfb5db47e388bb140725f671abef17103b4
BLAKE2b-256 checksum
How to use checksums
bc993a84be599dc81d29167d0f574fea90a807154edb674f0e688caf2afdd316
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sparkless-4.17.0-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL sparkless-4.17.0-cp311-abi3-manylinux_2_28_aarch64.whl
Size 39.2 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
1f0cf0fc1ec4e485c805d63ed39d3ba9a04b2d129a108f9c061feb40bdf5249c
BLAKE2b-256 checksum
How to use checksums
2afb4ad6d8cbf762e0f2e9b44c01e0b0a898e7219faa1875b54d3b7e25ad2458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sparkless-4.17.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL sparkless-4.17.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 42.0 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
330689424d6ffc36a297abb5620dc1fbadd75bb3841de4fbeaf996dd3ce68364
BLAKE2b-256 checksum
How to use checksums
ed18784ba5b17286e12fd05a9616ee24a1e055d04ec804aea490baf5f68ccb7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sparkless-4.17.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL sparkless-4.17.0-cp311-abi3-macosx_11_0_arm64.whl
Size 44.1 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fc313fa44031ce098ceffd95104d050795f3d1255441ad04b38a6a5120fdceeb
BLAKE2b-256 checksum
How to use checksums
2db2af288f70584502247aefaf93be59c05dd2eda7e2c7cbd150de1e36c15282
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / sparkless-4.17.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL sparkless-4.17.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 46.6 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3a6f36a8768ee274628cb7a17c9b64996792faebb2704aeac681ddae5f2529bf
BLAKE2b-256 checksum
How to use checksums
e74764bd50e642e4d65bfa1cb6ed98cf1a96e54d116aac76696fa11aa568cb22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for sparkless 4.17.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for sparkless-4.17.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.17.0 This release

9 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page