Giter Site home page Giter Site logo

carbonz0 / cython-book Goto Github PK

View Code? Open in Web Editor NEW

This project forked from philberty/cython-book

0.0 1.0 0.0 13.02 MB

Learning Cython packtpub.com code examples.

Home Page: http://www.packtpub.com/

Makefile 0.43% Python 1.87% C 85.09% Shell 4.41% C++ 0.67% Vim Script 0.41% Groff 7.11%

cython-book's Introduction

README.org

https://travis-ci.org/redbrain/cython-book.png?branch=master

1 Learning Cython README

These are all the cython code examples used within the book for easy reference and for me to be able to maintain these in the future. To keep not only the book relevant but the code aswell.

Here are some useful links to relevant links that you would care about.

-Cython: http://www.cython.org/ -Cython Official Reference: http://docs.cython.org/ -Cython Wiki: http://wiki.cython.org/ -Special Thanks to: http://www.packtpub.com/ -Author Blog: http://redbrain.co.uk/

1.1 Chapter 1 Intro

Deals with just hello world and a simple walk through of your own module from scratch!

1.2 Chatper 2 Cdef and mixing C/Python

Here things get more interesting with reusing:

  • Python ConfigParser
  • Python logging

To extend new C projects to get them up and running FAST

Then iterating over the cdef usage as a reference and the cython public keyword usage and how to handle the new header file.

1.2.1 Messaging Server

Finally a fairly quick and hacky messaging server written in an hour in C and Cython using libevent over simple Sockets. Demonstrates how to get the most of cython to extend existing systems.

1.3 Chapter 3 Cython Conventions

There are 3 parts to this chapter firstly on how to use cython to generate Python’esque classes for your C/C++ types with respect to Memory Management.

1.3.1 Memory

Such as the __dealloc__ hook when python GC decides to delete your objects. As well as using malloc/sizeof etc from cython in the __cinit__ and __str__ hooks to make it really feel like just any normal python code.

1.3.2 Speed

Using cython to simply compile your python code to get speed ups in number crunching in the primes example from cython compared to a plain nearly word for word match in pure python

1.3.3 Extending Tmux

Extending existing Open Source projects using pure Cython instead of using C!

1.4 Chapter 4 Caveats and Debugging

This chapter deals with some caveats in Type Conversion you might come across and how to use cygdb on your code.

1.5 Chapter 5 Advanced Cython

Advanced topics with cython include using C++ with cython and how to interface with that. And a little intro on how to worry about the GIL releated to threading. And finally 2 more examples on how you could extend systems with cython.

1.6 Chapter 6 Cython extra’s

Rounding off the book with a discussion on Python 3 and PyPy. And a quick look at the Auto PXD tools for cython that are available.

cython-book's People

Contributors

philberty avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.