skillfed

pytest-shard

pytest-shard v0.1.2 1.8M downloads/30d#3,548 on PyPI38
Permissive license MIT Abandoned released

What it is and what it does

pytest-shard is a pytest plugin that divides your test suite across multiple CI workers or machines by hashing individual test names and assigning each test to a shard. It works at the finest granularity—individual test cases—so even a single parameterized test or file can be split across workers. You run pytest with two flags: --shard-id (which worker this is) and --num-shards (total number of workers), and the plugin automatically routes each test to its assigned shard.

The package is designed for continuous integration pipelines that support parallel jobs, such as CircleCI or Travis CI. It does not balance based on test runtime—all shards receive roughly equal numbers of tests—and is meant to complement tools like pytest-xdist, which parallelizes across CPU cores on a single machine. The package is no longer maintained; its last release was in December 2020.

Use it for:

  • Split a large test suite across multiple CircleCI workers using CIRCLE_NODE_INDEX and CIRCLE_NODE_TOTAL environment variables.
  • Parallelize test execution on Travis CI by distributing test cases across multiple build jobs.
  • Reduce total CI build time by running disjoint test shards on separate machines without test interdependencies.
  • Enable fine-grained parallelism even when all tests live in a single file or parameterized test method.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Distributes pytest test execution across multiple machines or CI workers by sharding individual test cases based on a hash of their names, enabling parallel test runs without requiring shared state.

Yes, if you are running pytest on a CI platform that supports parallel jobs and your test suite is stable. The plugin is simple and has no known vulnerabilities. However, do not adopt it for new projects: the package is abandoned and will not receive updates for future pytest or Python versions. Consider it only if you have an existing CI setup that already uses it or if you can commit to maintaining a fork.

Install

pytest-shard on PyPI

pip

pip install pytest-shard

uv

uv add pytest-shard

poetry

poetry add pytest-shard

Installing pytest-shard

Before you install

Low install friction with a single runtime dependency on pytest. However, the package is abandoned—last release was 2020-12-11 and no commits since 2023-08-22—so it will not receive bug fixes or compatibility updates for future Python or pytest versions.

License in practice

MIT license is permissive and imposes no restrictions on use, modification, or distribution in proprietary or open-source projects.

Quickstart

pip install pytest-shard

pytest --shard-id=0 --num-shards=2

Requires pytest to be installed; intended for CI environments that can set shard-id and num-shards parameters.

Verify before relying

  • Whether the package remains compatible with current pytest versions and modern Python releases beyond 3.8
  • Whether hash-based sharding produces balanced test distribution across workers in practice

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 1 — pytest
Maintenance abandoned — 2,072 days since the last release
Last repo commit
First released
Downloads 1,797,137/month — #3,548 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest_shard-0.1.2-py3-none-any.whl

Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Topic :: Software Development :: Testing

Tags

pytest parallel ci workersdistribute tests across machinespytest test shardingci test parallelizationpytest load balancingsplit tests multiple workerspytest horizontal scaling
ci-parallelizationtest-distribution

More Testing packages

pluggy

Pluggy provides a plugin system that lets you…

permissive · top 100 on PyPI

pytest

pytest is a testing framework that lets you…

permissive · top 100 on PyPI

virtualenv

virtualenv creates isolated Python environments…

permissive · top 100 on PyPI

coverage

Coverage.py measures which lines of Python code…

permissive · top 1,000 on PyPI

pytest-asyncio

pytest-asyncio is a pytest plugin that enables…

permissive · top 1,000 on PyPI

pytest-json-ctrf

A pytest plugin that generates test reports in…

permissive · top 1,000 on PyPI

pytest-xdist

pytest-xdist distributes pytest tests across…

permissive · top 1,000 on PyPI

pytest-circleci-parallelized

Adds a pytest plugin that automatically…

permissive · top 15,000 on PyPI

pytest-parallel

A pytest plugin that runs tests in parallel…

permissive · top 15,000 on PyPI

pytest-test-groups

pytest-test-groups is a pytest plugin that…

permissive · top 5,000 on PyPI

pytest-run-parallel

A pytest plugin that runs test functions…

permissive · top 15,000 on PyPI

pytest-split-tests

A pytest plugin that splits your test suite…

permissive · top 15,000 on PyPI

pytest-split

A pytest plugin that divides a test suite into…

permissive · top 5,000 on PyPI

pytest-forked

A pytest plugin that runs each test in a forked…

permissive · top 5,000 on PyPI

robotframework-pabot

Pabot splits Robot Framework test execution…

permissive · top 5,000 on PyPI

pytest-cov

A pytest plugin that measures code coverage…

permissive · top 1,000 on PyPI