CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pyobjc-core

Python-to-Objective-C bridge providing seamless interoperability between Python and Objective-C programming languages on macOS systems.

Pending
Overview
Eval results
Files

core-bridge.mddocs/

Core Bridge Functionality

Essential bridge components that provide the foundation for Python-Objective-C interoperability, including constants, context management, and fundamental runtime integration features.

Capabilities

Objective-C Constants

Standard Objective-C constants mapped to Python equivalents for seamless code compatibility.

nil = None
"""Objective-C nil constant, equivalent to Python None."""

YES = True
"""Objective-C YES constant, equivalent to Python True."""

NO = False
"""Objective-C NO constant, equivalent to Python False."""

Autorelease Pool Management

Context manager for managing NSAutoreleasePool instances, essential for memory management when working with Objective-C objects.

class autorelease_pool:
    """
    Context manager that runs the body of the block with a fresh autorelease pool.
    The actual release pool is not accessible.
    """
    def __init__(self): ...
    def __enter__(self): ...
    def __exit__(self, exc_type, value, tp): ...

Usage Example:

import objc

# Use autorelease pool for memory management
with objc.autorelease_pool():
    # Work with Objective-C objects here
    # Pool will be automatically drained when exiting the context
    pass

Helper Functions

Utility functions for name resolution and runtime introspection.

def _resolve_name(name):
    """
    Resolve a dotted name to a Python object.
    
    Args:
        name (str): Dotted name like "module.submodule.function"
        
    Returns:
        object: The resolved Python object
        
    Raises:
        ValueError: If name doesn't contain dots
    """

Core Runtime Integration

The core bridge functionality is provided through the objc._objc C extension module, which includes:

  • Objective-C runtime integration
  • Object and class manipulation
  • Method dispatch and invocation
  • Type encoding and conversion
  • Selector and method signature handling
  • Memory management integration
  • Exception bridging between Python and Objective-C

This C extension is automatically imported and its namespace is merged into the main objc module, providing seamless access to all bridge functionality.

Install with Tessl CLI

npx tessl i tessl/pypi-pyobjc-core

docs

bridge-registration.md

class-enhancement.md

core-bridge.md

framework-loading.md

index.md

interface-builder.md

method-decorators.md

properties-accessors.md

protocol-support.md

pyobjctools.md

tile.json