skillfed

subprocess32

A backport of the subprocess module from Python 3 for use on 2.x.

subprocess32 v3.5.4 710.2K downloads/30d#5,260 on PyPI173
Permissive license PSF license Abandoned released

What it is and what it does

subprocess32 is a backport of Python 3's subprocess module for Python 2, designed to bring reliability improvements and modern APIs to older Python environments on POSIX systems. It includes a C extension that handles the fork/exec code path safely in multithreaded applications, addressing concurrency bugs present in Python 2's standard subprocess. The package backports timeout support from Python 3.3 and the run() API from Python 3.5, while keeping other features frozen at Python 3.2 level.

This package is intended as a drop-in replacement for Python 2's subprocess module on POSIX platforms (Linux, macOS, BSD, Solaris). However, the project is now abandoned—the repository was archived in 2020 and the last release was in May 2019. Python 2 itself reached end-of-life years ago, making this package primarily useful only for maintaining legacy Python 2 codebases that cannot be migrated.

Use it for:

  • Fixing concurrency bugs in legacy Python 2.7 applications that spawn subprocesses from multithreaded code.
  • Adding timeout support to subprocess calls in Python 2.6 or 2.7 without upgrading to Python 3.
  • Providing a unified subprocess API across Python 2 and 3 for codebases that must support both versions.
  • Replacing Python 2's built-in subprocess module on POSIX systems to gain thread-safe fork/exec handling.

Worth the install?

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

A backport of Python 3's subprocess module to Python 2, with thread-safe fork/exec handling and timeout support for POSIX systems.

No, unless you are maintaining a legacy Python 2 codebase that cannot be migrated. The project is abandoned, the repository archived, and Python 2 itself is long past end-of-life. The C extension may not compile on modern build systems. If you control the codebase, upgrade to Python 3; if you cannot, use this only as a temporary measure while planning migration.

Install

subprocess32 on PyPI

pip

pip install subprocess32

uv

uv add subprocess32

poetry

poetry add subprocess32

Installing subprocess32

Before you install

Medium install friction due to compiled C extension. Repository archived since 2020 and project abandoned; last release was 2019-05-20, over 2643 days ago. Not maintained.

License in practice

Licensed under PSF license (permissive). No licensing restrictions on use or redistribution.

Quickstart

import sys, os
if os.name == 'posix' and sys.version_info[0] < 3:
    import subprocess32 as subprocess
else:
    import subprocess

result = subprocess.run(['echo', 'hello'], timeout=5)

Python 2 only (2.6, 2.7); requires POSIX platform; C extension compilation needed at install time.

Verify before relying

  • Whether the C extension compiles cleanly on modern build systems given the 2020 last commit date.
  • Current status of the archived repository and whether security patches or critical fixes are still available.

Package facts

License PSF license (permissive)
Python support supports the current Python release (>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance abandoned — 2,643 days since the last release
Last repo commit (repository archived)
First released
Downloads 710,240/month — #5,260 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: subprocess32-3.5.4-cp27-cp27m-macosx_10_6_intel.whl; subprocess32-3.5.4-cp27-cp27mu-manylinux2014_x86_64.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Python Software Foundation LicenseOperating System :: MacOSOperating System :: MacOS :: MacOS XOperating System :: POSIXOperating System :: POSIX :: BSDOperating System :: POSIX :: LinuxOperating System :: POSIX :: SunOS/SolarisProgramming Language :: Python :: 2 :: OnlyProgramming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries

Tags

python 2 subprocess backportthread-safe subprocess python 2subprocess timeout python 2fork exec reliability python 2posix subprocess python 2.7
python-2-legacyposix-only

More Libraries packages