cysignals
Interrupt and signal handling for Cython
What it is and what it does
cysignals is a Cython extension that solves a fundamental problem: Cython code normally skips interrupt checks for speed, making long-running loops impossible to stop with CTRL-C. The package provides decorators and context managers (sig_on/sig_off) that tell Cython to check for pending signals at safe points, allowing interrupts and other OS signals to be handled gracefully. It also manages error recovery and provides hooks for custom signal handling.
The package is maintained by the SageMath project and targets developers writing performance-critical Cython code who need to remain responsive to user interrupts and system signals. It requires Cython >= 3.1 and Python >= 3.12, with prebuilt wheels for macOS, Linux (including musl), and Windows across multiple architectures. No runtime dependencies means installation is straightforward once the compiled extension is available for your platform.
Use it for:
- Long-running numerical computations in Cython that must respond to CTRL-C without hanging the process.
- Building interruptible scientific libraries (e.g., SageMath) where user cancellation is essential.
- Wrapping C/C++ algorithms in Cython while maintaining signal safety and clean shutdown behavior.
- Implementing custom signal handlers in Cython code that need to coexist with Python's signal machinery.
- Debugging Cython code by catching and reporting signals that occur during execution.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides interrupt and signal handling mechanisms for Cython code, enabling CTRL-C interruption and other signal management in Cython programs that would otherwise run without checking for interrupts.
Yes, if you are writing Cython code that runs for extended periods and needs to respond to interrupts. The package is actively maintained, has no runtime dependencies, and is essential for any Cython project that must be user-interruptible. The LGPLv3+ license is permissive for linking into proprietary extensions. Install only if you meet the Cython >= 3.1 and Python >= 3.12 requirements.
Install
cysignals on PyPI
pip
pip install cysignalsuv
uv add cysignalspoetry
poetry add cysignalsInstalling cysignals
Before you install
Medium install friction due to compiled wheel distribution across multiple platforms and Python versions (3.12–3.14). Active maintenance with recent commits and no runtime dependencies simplifies deployment once installed.
License in practice
LGPLv3+ copyleft license requires that derivative works and modifications be distributed under compatible terms; linking cysignals into proprietary Cython extensions is permitted under LGPL's library exception, but modifications to cysignals itself must remain open.
Quickstart
pip install cysignals
# In a .pyx file:
from cysignals.signals cimport sig_on, sig_off
cdef long fib(long n):
sig_on()
# Long-running computation here
result = compute_fib(n)
sig_off()
return result
Requires Cython >= 3.1 and Python >= 3.12; intended for use in Cython modules (.pyx files), not standalone Python code.
Verify before relying
- Whether the package supports Python 3.11 or earlier despite the description stating Python >= 3.12 requirement.
- Performance overhead of signal checking in tight loops compared to unguarded Cython code.
- Compatibility with non-CPython implementations (PyPy, etc.) beyond CPython support shown in classifiers.
Package facts
| License | GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this… (full text in the JSON record) (copyleft) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 288 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 728,283/month — #5,213 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cysignals-1.12.6-cp312-cp312-macosx_11_0_arm64.whl; cysignals-1.12.6-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; cysignals-1.12.6-cp312-cp312-musllinux_1_2_x86_64.whl; cysignals-1.12.6-cp312-cp312-win_amd64.whl; cysignals-1.12.6-cp312-cp312-win_arm64.whl; cysignals-1.12.6-cp313-cp313-macosx_11_0_arm64.whl; cysignals-1.12.6-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; cysignals-1.12.6-cp313-cp313-musllinux_1_2_x86_64.whl; cysignals-1.12.6-cp313-cp313-win_amd64.whl; cysignals-1.12.6-cp313-cp313-win_arm64.whl; cysignals-1.12.6-cp314-cp314-macosx_11_0_arm64.whl; cysignals-1.12.6-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; cysignals-1.12.6-cp314-cp314-musllinux_1_2_x86_64.whl; cysignals-1.12.6-cp314-cp314t-macosx_11_0_arm64.whl; cysignals-1.12.6-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; cysignals-1.12.6-cp314-cp314t-musllinux_1_2_x86_64.whl; cysignals-1.12.6-cp314-cp314t-win_amd64.whl; cysignals-1.12.6-cp314-cp314t-win_arm64.whl; cysignals-1.12.6-cp314-cp314-win_amd64.whl; cysignals-1.12.6-cp314-cp314-win_arm64.whl
Tags
More System packages
Provides a platform-independent file locking…
permissive · top 100 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
aiofileProvides asynchronous file I/O operations for…
permissive · top 1,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
filetypeInfers file type and MIME type by examining…
permissive · top 1,000 on PyPI
coloredlogsAdds colored output to Python's standard…
permissive · top 1,000 on PyPI
interruptingcowInterrupts long-running Python code by raising…
permissive · top 15,000 on PyPI
pysoemPySOEM is a Cython wrapper for the Simple Open…
permissive · top 15,000 on PyPI
pysigsetProvides Python access to POSIX signal masking…
copyleft · top 15,000 on PyPI
async-interruptProvides an asyncio context manager that…
permissive · top 5,000 on PyPI
lib-cli-exit-toolsProvides portable signal handling,…
permissive · top 15,000 on PyPI
stopitProvides context managers and decorators to…
permissive · top 15,000 on PyPI
psygnalPsygnal implements the observer pattern with a…
permissive · top 5,000 on PyPI
aiosignalProvides a Signal class for managing lists of…
permissive · top 100 on PyPI
django-signal-webhooksAdds webhook support to Django models by…
permissive · top 15,000 on PyPI
neurokit2NeuroKit2 processes physiological signals (ECG,…
permissive · top 15,000 on PyPI