setproctitle

Rename your Python process's title so ps, top, and htop show what it's actually doing

Library
PyPI
v1.3.7
559stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
36/100Needs Attention
Development Activity0
Maintenance0
Community64
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
61/100Good
Architecture58
Code Quality62
Innovation55
Learning Curve70

setproctitle is a small C-extension module that lets a Python process change the title displayed by system tools such as ps, top, htop, and MacOS Activity Monitor. It is most useful in multi-process systems where a master process forks workers: giving each child a distinct, descriptive title makes it far easier for operators to identify which task each process is handling at a glance, without attaching a debugger or grepping through logs.

The module wraps the multi-platform process-title implementation originally written for PostgreSQL, and works across GNU/Linux, BSD, macOS, and (with caveats) Windows. It requires a C compiler at install time since it ships as a compiled extension, but has no further external dependencies and installs cleanly via pip on most platforms thanks to prebuilt wheels.

What You Get

  • setproctitle()/getproctitle() functions to set and read the current process’s displayed title
  • setthreadtitle()/getthreadtitle() functions for per-thread titles, surfaced by tools like htop via /proc/PID/task/TID/comm
  • Cross-platform support for GNU/Linux, BSD, and macOS, with a best-effort Named Object workaround on Windows
  • SPT_NOENV environment variable to avoid clobbering /proc/PID/environ when the full environment file must stay intact
  • SPT_DEBUG environment variable to print diagnostic information when the title change doesn’t behave as expected
  • A pure C extension with no runtime Python dependencies beyond the interpreter itself

Common Use Cases

  • Labeling forked worker processes in a multiprocessing pool so each shows its assigned task in ps/top output
  • Distinguishing Celery, Gunicorn, or uWSGI worker processes from each other and from the master process in process monitors
  • Making long-running daemons and background services identifiable in system process listings for ops and on-call debugging
  • Giving management commands or one-off scripts a recognizable name instead of showing the generic ‘python’ invocation

Under The Hood

Architecture: setproctitle is a thin Python-facing layer (pkg/setproctitle/init.py) over a C extension (src/setproctitle.c) that dispatches to per-platform backends selected at build time — spt_status.c for the PostgreSQL-derived Linux/BSD argv-overwrite technique, darwin_set_process_name.c for macOS, and a Named Object fallback on Windows — so a single Python API (setproctitle/getproctitle/setthreadtitle/getthreadtitle) hides genuinely different OS mechanisms for renaming a process’s displayed identity.

Tech Stack: The extension is built with setuptools’ Extension/build_ext, using platform sniffing in setup.py (sys.platform checks) to set preprocessor macros like HAVE_SYS_PRCTL_H, darwin, and HAVE_SETPROCTITLE per OS, and cibuildwheel to produce prebuilt wheels across CPython versions including free-threaded 3.13t and PyPy, so most users never need a local C toolchain despite it being a compiled extension.

Code Quality: The C source (~2,400 lines across src/) is organized into small single-purpose files (spt_setup.c, spt_status.c, spt_debug.c, spt_strlcpy.c) with a dedicated tests/ directory covering module behavior, thread titles, and Windows-specific paths (module_test.py, setthreadtitle_test.py, test_win32.py) run via conftest.py fixtures; the project is mature (created 2012) with 411 total commits and 20 contributors, though recent commit velocity is low per the health data.

API Design: The public surface is deliberately minimal — four functions with no configuration objects or classes — which keeps the learning curve near zero; the two environment-variable escape hatches (SPT_NOENV, SPT_DEBUG) handle the edge cases (broken /proc/PID/environ, silent platform failures) without cluttering the function signatures themselves.

Used by 5 apps in this directory

Python
99%
MIT

Agent Lightning

AI Development

17,500

A Microsoft-built training framework that optimizes AI agents with reinforcement learning, automatic prompt optimization, or supervised fine-tuning — with near-zero code changes to your existing agent, in any framework.

View details
84
Repo Health
68
Technical
69
Dependency
Built with
Python99%
Updated today
Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,530

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
66
Dependency
Built with
Python90%
Updated today
Python
88%
Apache 2.0

ART

AI Development

10,603

Give your LLM agents on-the-job training—ART lets you apply GRPO reinforcement learning to any multi-step agentic workflow with minimal code changes.

View details
85
Repo Health
82
Technical
72
Dependency
Built with
Python88%
Cuda10%
Updated today
Python
54%
Other

authentik

Authentication · Security

24,980

The self-hosted Identity Provider that replaces Okta, Auth0, and Entra ID with a unified SSO platform supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and WebAuthn.

View details
92
Repo Health
81
Technical
68
Dependency
Built with
Python54%
TypeScript33%
Updated today
Python
61%
GPL 3.0

Paperless-ngx

Bookmarks Archiving

44,394

Turn your paper pile into a searchable digital archive with OCR, AI classification, and automated workflows — all running on your own server.

View details
91
Repo Health
88
Technical
70
Dependency
Built with
Python61%
TypeScript30%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search