Skip to content

Instantly share code, notes, and snippets.

View kszucs's full-sized avatar

Krisztián Szűcs kszucs

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manuphatak
manuphatak / atexit_setup.py
Created December 8, 2015 05:47
Dealing with `atexit` and setup.py test command deleting modules.
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
@DasIch
DasIch / example.py
Created May 12, 2013 06:20
__prepare__ for Python 2.x
from __future__ import print_function
from collections import OrderedDict
from prepareable import Prepareable
from six import with_metaclass, iteritems
class FooMeta(with_metaclass(Prepareable, type)):
def __new__(cls, name, bases, attributes):
@GaelVaroquaux
GaelVaroquaux / 00README.rst
Last active September 15, 2023 03:58
Copy-less bindings of C-generated arrays with Cython

Cython example of exposing C-computed arrays in Python without data copies

The goal of this example is to show how an existing C codebase for numerical computing (here c_code.c) can be wrapped in Cython to be exposed in Python.

The meat of the example is that the data is allocated in C, but exposed in Python without a copy using the PyArray_SimpleNewFromData numpy