This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

ctypesGsl is a Python binding for the GSL library using the ctypes package. It is probably somewhat slower than pygsl but has other advantages:

  1. It is very easy to install, the only dependency (except for GSL itself) is the ctypes package, standard since Python 2.5. No compilation or is required during installation. The implementation is simpler too as it does not require SWIG wrappers, C code or shared libraries.
  2. ctypes seems to be the preferred future way to do Python bindings, since it is independent from python implementation used, e.g. it should work with PyPy.

Currently it is slowly becoming reasonably complete. Implemented are:

error handling basic function complex numbers polynomials special functions vectors matrices permutations (incomplete) combinations BLAS linear algebra eigensystems numerical integration random number generators quasi random number generators probability distributions Monte Carlo integration ordinary differential equations numerical integration Chebyshev approximations one dimensional root finding one dimensional minimization multidimensional root finding multidimensional minimization


GPL v.3, see LICENSE.txt


There is a (somewhat experimental) script in the top-level directory.

Alternatively, just copy the ctypesGsl directory to


or wherever you keep your local python packages. You’re ready to go:

>>> import ctypesGsl
>>> ctypesGsl.expm1(1)

the file contains some examples based on GSL tests.


The idea is that the package should be usable like a standard python library. The low level functions are thus often wrapped in python functions which try to hide some of the complexity.

The higher level interface does error handling (exceptions are raised if return value is not GSL_SUCCESS), and tries to make common usage easy, e.g. gsl_complex numbers can be used just as standard Python complex numbers, tries to allocate integration workspace of reasonable size if none is provided, etc.

See the file for examples.

Error handling

There are two ways to check for errors in GSL: internal error handler, and return values. ctypesGsl handles both. The return values are automatically checked and (by default) an exception is raised if the return value indicates an error.

Unfortunately ctypes does not propagate exceptions raised inside callback functions to the main thread, so if an exception is raised in the internal error handler, a backtrace is printed but the program continues. Internal GSL error handler is thus (by default) redefined to only print a warning message.

Both internal and return value error handlers can be redefined.


None at the moment. See file for usage examples.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ctypesGsl-0.4.tar.gz (45.5 kB) Copy SHA256 Checksum SHA256 Source Sep 26, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting