skillfed

cysignals

Interrupt and signal handling for Cython

cysignals v1.12.6 728.3K downloads/30d#5,213 on PyPI44
Copyleft 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) Active released

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 cysignals

uv

uv add cysignals

poetry

poetry add cysignals

Installing 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

Development Status :: 6 - MatureIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)Operating System :: MacOS :: MacOS XOperating System :: POSIXProgramming Language :: CProgramming Language :: CythonProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: DebuggersTopic :: System

Tags

cython interrupt handlingcython signal managementcython ctrl-c supportcython signal handlerscython exception handlingcython keyboard interruptcython async signal safe
cython-extensionsignal-handlinginterrupt-management

More System packages