Skip to content

Commit

Permalink
Update setup.py and README
Browse files Browse the repository at this point in the history
  • Loading branch information
artfwo committed Jul 26, 2014
1 parent 0d910b6 commit 54ad629
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 53 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include LICENSE
include README.md
include README.rst
include examples/*.py
49 changes: 0 additions & 49 deletions README.md

This file was deleted.

84 changes: 84 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
=====
aiosc
=====

This is an experimental minimalistic Open Sound Control (OSC) communication
module which uses asyncio for network operations and is compatible with the
asyncio event loop.

Installation
============

aiosc requires at least Python 3.4. It can be installed using pip::

pip3 install aiosc
pip3 install --user aiosc

Usage
=====

To send an OSC message just use ``aiosc.send``:

.. code-block:: python
import asyncio
import aiosc
loop = asyncio.get_event_loop()
loop.run_until_complete(
aiosc.send(('127.0.0.1', 9000), '/hello', 'world')
)
To implement an OSC server with ``aiosc`` you should create an UDP endpoint
using ``aiosc.OSCProtocol`` as the protocol. ``OSCProtocol`` can be subclassed
or directly constructed with a dictionary mapping OSC address patterns to
handler methods for incoming messages:

.. code-block:: python
def protocol_factory():
osc = aiosc.OSCProtocol({
'//*': lambda addr, path, *args: print(addr, path, args)
})
return osc
loop = asyncio.get_event_loop()
coro = loop.create_datagram_endpoint(protocol_factory, local_addr=('127.0.0.1', 9000))
transport, protocol = loop.run_until_complete(coro)
loop.run_forever()
For more examples, see ``examples/``.

OSC address patterns
====================

``aiosc`` dispatches messages to handler methods using glob-style address
pattern matching as described in the OSC 1.0 specification. The ``//`` operator
from OSC 1.1 preliminary specification is also supported.

Examples:

* ``/hello/world`` matches ``/hello/world``.
* ``/hello/*`` matches ``/hello/world`` and ``/hello/sarah``.
* ``/{hello,goodbye}//world`` matches ``/hello/world`` and ``/goodbye/cruel/world``.
* ``//*`` matches any address.

Notes
=====

Bundles are not yet supported.

Contrary to most OSC implementations, OSC data types are picked from the
preliminary spec documented in Features and Future of Open Sound Control
version 1.1 for NIME paper. For example, 'I' typetag is decoded to Impulse
(aka "bang") which is passed around as ``aiosc.Impulse`` singleton.

Suggestions, bug reports, issues and/or pull requests are, of course, welcome.

License
=======

Copyright (c) 2014 Artem Popov <artfwo@gmail.com>

aiosc is licensed under the MIT license, please see LICENSE file for details.
20 changes: 17 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
#! /usr/bin/env python3

from setuptools import setup

with open('README.rst') as file:
long_description = file.read()

setup(
name='aiosc',
author='Artem Popov',
author_email='artfwo@gmail.com',
url='https://github.com/artfwo/aiosc',
description='Minimalistic OSC communication module using asyncio.',
version='0.1',
description='Minimalistic Open Sound Control (OSC) communication module using asyncio',
long_description=long_description,
version='0.1.1',
py_modules=['aiosc'],
include_package_data=True,
license='MIT',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Topic :: Multimedia :: Sound/Audio',
'Topic :: Software Development :: Libraries',
'Topic :: System :: Networking',
],
license='MIT'
)

0 comments on commit 54ad629

Please sign in to comment.