or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

build-integration.mdcli-tools.mdconfiguration.mdcore-api.mdindex.md
tile.json

tessl/pypi-sip

A Python bindings generator for C and C++ libraries

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/sip@5.5.x

To install, run

npx @tessl/cli install tessl/pypi-sip@5.5.0

index.mddocs/

SIP

A comprehensive tool for creating Python bindings for C and C++ libraries. SIP originally developed to create PyQt but is applicable to any C/C++ library, providing build tools that process specification files and generate optimized C/C++ code compiled into extension modules.

Package Information

  • Package Name: sip
  • Language: Python
  • Installation: pip install sip
  • Requirements: Python 3.5.1+, packaging, toml

Core Imports

import sipbuild

For specific functionality:

from sipbuild import Project, Bindings, Builder
from sipbuild import AbstractProject, AbstractBuilder
from sipbuild import Buildable, BuildableBindings, BuildableExecutable
from sipbuild import BuildableFromSources, BuildableModule
from sipbuild import Installable, Option
from sipbuild import UserException, UserParseException, handle_exception
from sipbuild import import_callable, resolve_abi_version
from sipbuild import SIP_VERSION, SIP_VERSION_STR

Basic Usage

from sipbuild import Project, Bindings

# Create a project for building Python bindings
project = Project()

# Configure bindings
bindings = Bindings(
    sip_files=['mymodule.sip'],
    include_dirs=['/usr/include'],
    libraries=['mylib']
)

# Build the project
project.build()

Command-line usage:

# Build project in current directory
sip-build

# Install the project
sip-install

# Create wheel distribution
sip-wheel

# Generate legacy SIP v5 compatible bindings
sip5 -c . mymodule.sip

Architecture

SIP follows a configurable build pipeline architecture:

  • Projects: Top-level containers managing build configuration and coordination
  • Bindings: Specification-to-code generators that process .sip files into C/C++ source
  • Builders: Platform-specific build orchestrators handling compilation and linking
  • Buildables: Individual build targets (modules, executables, libraries)
  • Tools: Command-line interfaces wrapping the core functionality

This design enables creation of Python wheels that are version-independent (compatible with Python 3.5+), supports multiple extension modules within the same package, and provides sophisticated configuration and build management capabilities.

Capabilities

Core Python API

The primary programmatic interface for creating and managing Python binding projects, including project configuration, bindings generation, and build orchestration.

class Project:
    def build(self): ...
    def build_sdist(self, sdist_directory): ...
    def build_wheel(self, wheel_directory): ...
    def install(self): ...

class Bindings:
    def generate(self): ...
    def is_buildable(self): ...
    def verify_configuration(self): ...

class Builder:
    def build(self): ...
    def install(self): ...

Core Python API

Command-Line Tools

Seven command-line tools for building, installing, and managing SIP projects from the shell, providing complete project lifecycle management without requiring Python code.

sip-build           # Build project in-situ
sip-install         # Build and install project
sip-wheel           # Build wheel distribution
sip-sdist           # Build source distribution
sip-module          # Generate sip module source
sip-distinfo        # Create .dist-info directories
sip5                # Legacy SIP v5 compatibility

Command-Line Tools

Configuration System

Comprehensive configuration management supporting pyproject.toml files, command-line overrides, and environment markers for flexible project setup.

class Option:
    def __init__(self, name, option_type, default=None, choices=None): ...

class Configurable:
    def add_options(self, parser): ...
    def apply_options(self, options): ...

Configuration System

Build System Integration

PEP 517 build backend support and integration with modern Python packaging workflows, enabling seamless integration with pip and other build tools.

def build_sdist(sdist_directory, config_settings=None): ...
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): ...

Build System Integration

Types

class UserException(Exception):
    """Base exception for user-friendly errors."""
    pass

class UserFileException(UserException):
    """Base class for file-related user errors."""
    pass

class UserParseException(UserException):
    """Exception for parsing errors in specification files."""
    pass

class PyProjectException(UserFileException):
    """Exception related to pyproject.toml files."""
    pass

class PyProjectOptionException(PyProjectException):
    """Configuration option errors in pyproject.toml."""
    pass

class PyProjectUndefinedOptionException(PyProjectOptionException):
    """Exception for undefined required options."""
    pass

def handle_exception(exception):
    """Standard exception handler for SIP tools."""
    pass

class Installable:
    """Manages file installation to target directories."""
    def install(self): ...
    def get_full_target_dir(self): ...

def import_callable(callable_name, expected_type):
    """
    Import callable from module for factory pattern support.
    
    Args:
        callable_name (str): Name of callable to import
        expected_type (type): Expected type of the callable
        
    Returns:
        callable: Imported callable
    """
    pass

def resolve_abi_version(version_spec):
    """
    Resolve ABI version specification to actual version.
    
    Args:
        version_spec (str): Version specification (e.g., '12.8')
        
    Returns:
        tuple: (major, minor) version numbers
    """
    pass

SIP_VERSION: int
"""Numeric version identifier."""

SIP_VERSION_STR: str  
"""String version identifier (e.g., '5.5.0')."""