This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Rubicon-ObjC

Rubicon-ObjC is a bridge between Objective C and Python. It enables you to:

  • Use Python to instantiate objects defined in Objective C,
  • Use Python to invoke methods on objects defined in Objective C, and
  • Subclass and extend Objective C classes in Python.

It also includes wrappers of the some key data types from the Core Foundation framework (e.g., NSString).

Quickstart

Rubicon uses a combination of ctypes, plus Objective-C’s own reflection APIs, to enable Objective C objects to be referenced in a Python process.

To install Rubicon, use pip:

$ pip install rubicon-objc

Then, in a Python shell

>>> from ctypes import cdll
>>> from ctypes import util
>>> from rubicon.objc import ObjCClass, objc_method

# Use ctypes to import a framework into the Python process
>>> cdll.LoadLibrary(util.find_library('Foundation'))

# Wrap an Objective C class contained in the framework
>>> NSURL = ObjCClass("NSURL")

# Then instantiate the Objective C class, using the API
# that is exposed through Objective C. The Python method name
# is the concatenated version of the Objective C method descriptor,
# with colons replaced with underscores. So, the equivalent of
# [NSURL URLWithString:@"http://pybee.org"];
# would be:
>>> NSURL.URLWithString_("http://pybee.org/")

# To create a new Objective C class, define a Python class that
# has the methods you want to define, decorate it to indicate that it
# should be exposed to the Objective C runtime, and annotate it to
# describe the type of any arguments that aren't of type ``id``:
>>> class Handler(NSObject):
...     @objc_method
...     def initWithValue_(self, v: int):
...         self.value = v
...         return self
...
...     @objc_method
...     def pokeWithValue_(self, v: int) -> None:
...         print("Poking with", v)
...         print("Internal value is", self.value)

# Then use the class:
>>> my_handler = Handler.alloc().initWithValue_(42)
>>> my_handler.pokeWithValue_(37)

Testing

To run the Rubicon test suite:

1. Compile the Rubicon test library. A Makefile has been provided to make this easy. Type:

$ make

to compile it.

Cross platform support

This Makefile currently only works under OS/X; however, the build commands aren’t complicated; it should be fairly easy to reproduce the build on other platforms. Pull requests to make the Makefile cross-platform are welcome.

  1. Put the Rubicon support library somewhere that it will be found by dynamic library discovery. This means:

    1. Under OS X, put the tests/objc directory in your DYLD_LIBRARY_PATH
    2. Under Linux, put the tests/objc directory in your LD_LIBRARY_PATH
    3. Under Windows…. something :-)
  2. Run the test suite:

    $ python setup.py test
    

    A tox configuration has also been provided; to run the tests across all supported platforms, run:

    $ tox
    

Community

Rubicon is part of the BeeWare suite. You can talk to the community through:

Contributing

If you experience problems with this backend, log them on GitHub. If you want to contribute code, please fork the code and submit a pull request.

Release History

Release History

0.2.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
rubicon_objc-0.2.3-py3-none-any.whl (22.5 kB) Copy SHA256 Checksum SHA256 py3 Wheel Sep 27, 2016
rubicon-objc-0.2.3.tar.gz (26.1 kB) Copy SHA256 Checksum SHA256 Source Sep 27, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting