C Py Ext Patt 0.2.1 | Coderz Repository

cPyExtPatt 0.2.1

Last updated:

0 purchases

cPyExtPatt 0.2.1 Image
cPyExtPatt 0.2.1 Images

Free

Languages

Categories

Add to Cart

Description:

cPyExtPatt 0.2.1

If you need to write C extension for Python then this is the place for you.
The full documentation is on
Read the Docs.
Code examples and documentation source are right here on GitHub.

Videos
I have presented some of this, well mostly the chapter “PyObjects and Reference Counting”,
at Python conferences so if you prefer videos they are here:

PyCon UK 2015
PyCon US 2016



Subjects Covered

Introduction
A Simple Example
PyObjects and Reference Counting
Exception Raising
A Pythonic Coding Pattern for C Functions
Parsing Python Arguments
Creating New Types
Setting and Getting Module Globals
Logging
File Paths and Files
Subclassing and Using super()
Capsules
Iterators and Generators
Pickling C Extension Types
Setting Compiler Flags
Debugging
Memory Leaks
Thread Safety
Source Code Layout
Using C++ With CPython Code
Miscellaneous
Further Reading


Installation
This is primarily a documentation project hosted on
Read the Docs.
However all the example code is buildable and testable so if you want to examine that then here is how to get the
project.

From PyPi
pip install cPyExtPatt


From Source
Choose a directory of your choice, in this case: ~/dev/tmp.
mkdir -p ~/dev/tmp
cd ~/dev/tmp
git clone https://github.com/paulross/PythonExtensionPatterns.git
cd PythonExtensionPatterns


Virtual Environment
Create a Python environment in the directory of your choice, in this case:
~/dev/tmp/PythonExtensionPatterns/venv_3.11 and activate it:
python3.11 -m venv venv_3.11
source venv_3.11/bin/activate


Install the Dependencies
pip install -r requirements.txt


Running the Tests
You now should be able to run the following commands successfully in
~/dev/tmp/PythonExtensionPatterns with your environment activated:
pytest tests/


Building the Documentation
This will build the html and PDF documentation (requires a latex installation):
cd doc/sphinx
make html latexpdf




History

0.2.1 (2024-07-29)

Python versions supported: 3.9, 3.10, 3.11, 3.12, 3.13 (possibly backwards compatible with Python 3.6, 3.7, 3.8)
Almost all example code is built and tested against these Python versions.
Added a chapter on managing file paths and files between Python and C.
Added a chapter on subclassing from your classes or builtin classes.
Added a chapter on pickling from C.
Added a chapter on Capsules.
Added a chapter on Iterators and Generators.
Added a chapter on memory leaks and how to detect them.
Added a chapter on thread safety.
Update “Homogeneous Python Containers and C++” to refer to https://github.com/paulross/PyCppContainers
All the documentation has been extensively reviewed and corrected where necessary.
Development Status :: 5 - Production/Stable


Contributors
Many thanks!

Pull Requests

https://github.com/marioemmanuel
https://github.com/miurahr
https://github.com/gdevanla
https://github.com/joelwhitehouse
https://github.com/dhermes
https://github.com/gst
https://github.com/adamchainz
https://github.com/nnathan



Issues

https://github.com/ngoldbaum
https://github.com/niki-sp
https://github.com/ldo
https://github.com/1a1a11a
https://github.com/congma





0.1.0 (2014-09-09)

First release.
Originally “Examples of reliable coding of Python ‘C’ extensions by Paul Ross.”.
Development Status :: 3 - Alpha

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.