Merge branch 'release/v0.5.5'

This commit is contained in:
Jason Paryani
2015-03-09 22:31:12 -07:00
4 changed files with 66 additions and 39 deletions

View File

@@ -1,3 +1,7 @@
## v0.5.5 (2015-03-06)
- Update bundled C++ libcapnp to v0.5.1.2 security release
## v0.5.4 (2015-03-02) ## v0.5.4 (2015-03-02)
- Update bundled C++ libcapnp to v0.5.1.1 security release - Update bundled C++ libcapnp to v0.5.1.1 security release
- Add bootstrap RPC methods - Add bootstrap RPC methods

View File

@@ -4,23 +4,9 @@ More thorough docs are available at [http://jparyani.github.io/pycapnp/](http://
## Requirements ## Requirements
First you need a system-wide installation of the Cap'n Proto C++ library == 0.5.x. Follow the [official installation docs](http://kentonv.github.io/capnproto/install.html) or for the lazy: pycapnp's distribution has no requirements beyond a C++11 compatible compiler. GCC 4.8+ or Clang 3.3+ should work fine.
```bash pycapnp has additional development dependencies, including cython and py.test. See requirements.txt for them all.
curl -O http://capnproto.org/capnproto-c++-0.5.0.tar.gz
tar zxf capnproto-c++-0.5.0.tar.gz
cd capnproto-c++-0.5.0
./configure
make -j6 check
sudo make install
```
A recent version of cython and setuptools is also required. You can install these with:
```bash
pip install -U cython
pip install -U setuptools
```
## Building and installation ## Building and installation
@@ -31,10 +17,20 @@ Or you can clone the repo like so:
git clone https://github.com/jparyani/pycapnp.git git clone https://github.com/jparyani/pycapnp.git
pip install --install-option '--force-cython' ./pycapnp pip install --install-option '--force-cython' ./pycapnp
Note: for OSX, if using clang from Xcode 5, you will need to set `CFLAGS` like so: Note: for OSX, if using clang from Xcode 5, you may need to set `CFLAGS` like so:
CFLAGS='-stdlib=libc++' pip install pycapnp CFLAGS='-stdlib=libc++' pip install pycapnp
## Python Versions
Python 2.6/2.7 are supported as well as Python 3.2+. PyPy 2.1+ is also supported.
One oddity to note is that `Text` type fields will be treated as byte strings under Python 2, and unicode strings under Python 3. `Data` fields will always be treated as byte strings.
## Development
This project uses [git-flow](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/). Essentially, just make sure you do your changes in the `develop` branch. You can run the tests by installing pytest with `pip install pytest`, and then run `py.test` from the `test` directory.
### Binary Packages ### Binary Packages
In order to build binary packages from this source code, you must specify the `--disable-cython` option: In order to build binary packages from this source code, you must specify the `--disable-cython` option:
@@ -51,20 +47,10 @@ If it fails with an error like `clang: error: no such file or directory: 'capnp/
python setup.py build --force-cython python setup.py build --force-cython
## Python Versions
Python 2.6/2.7 are supported as well as Python 3.2+. PyPy 2.1+ is also supported.
One oddity to note is that `Text` type fields will be treated as byte strings under Python 2, and unicode strings under Python 3. `Data` fields will always be treated as byte strings.
## Development
This project uses [git-flow](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/). Essentially, just make sure you do your changes in the `develop` branch. You can run the tests by installing pytest with `pip install pytest`, and then run `py.test` from the `test` directory.
## Documentation/Example ## Documentation/Example
There is some basic documentation [here](http://jparyani.github.io/pycapnp/). There is some basic documentation [here](http://jparyani.github.io/pycapnp/).
The examples directory has one example that shows off the capabilities quite nicely. Here it is, reproduced: The examples directory has one example that shows off pycapnp quite nicely. Here it is, reproduced:
```python ```python
from __future__ import print_function from __future__ import print_function
@@ -130,6 +116,49 @@ if __name__ == '__main__':
printAddressBook(f) printAddressBook(f)
``` ```
Also, pycapnp has gained RPC features that include pipelining and a promise style API. Refer to the calculator example in the examples directory for a much better demonstration:
```python
import capnp
import socket
import test_capability_capnp
class Server(test_capability_capnp.TestInterface.Server):
def __init__(self, val=1):
self.val = val
def foo(self, i, j, **kwargs):
return str(i * 5 + self.val)
def server(write_end):
server = capnp.TwoPartyServer(write_end, bootstrap=Server(100))
def client(read_end):
client = capnp.TwoPartyClient(read_end)
cap = client.bootstrap()
cap = cap.cast_as(test_capability_capnp.TestInterface)
remote = cap.foo(i=5)
response = remote.wait()
assert response.x == '125'
if __name__ == '__main__':
read_end, write_end = socket.socketpair(socket.AF_UNIX)
# This is a toy example using socketpair.
# In real situations, you can use any socket.
server(write_end)
client(read_end)
```
## Common Problems ## Common Problems
If you get an error on installation like: If you get an error on installation like:
@@ -142,13 +171,4 @@ If you get an error on installation like:
Then you have too old a version of setuptools. Run `pip install -U setuptools` then try again. Then you have too old a version of setuptools. Run `pip install -U setuptools` then try again.
An error like:
...
capnp/capnp.cpp:312:10: fatal error: 'capnp/dynamic.h' file not found
#include "capnp/dynamic.h"
Means your sytem can't find the installed the Cap'n Proto C++ library. If you haven't installed it yet, please follow the directions at the [official installation docs](http://kentonv.github.io/capnproto/install.html). Otherwise trying `LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include pip install pycapnp` may fix the problem for you.
[![Build Status](https://travis-ci.org/jparyani/pycapnp.png?branch=develop)](https://travis-ci.org/jparyani/pycapnp) [![Build Status](https://travis-ci.org/jparyani/pycapnp.png?branch=develop)](https://travis-ci.org/jparyani/pycapnp)

View File

@@ -35,7 +35,7 @@ pjoin = os.path.join
# Constants # Constants
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
bundled_version = (0,5,1,1) bundled_version = (0,5,1,2)
libcapnp = "capnproto-c++-%i.%i.%i.%i.tar.gz" % (bundled_version) libcapnp = "capnproto-c++-%i.%i.%i.%i.tar.gz" % (bundled_version)
libcapnp_url = "https://capnproto.org/" + libcapnp libcapnp_url = "https://capnproto.org/" + libcapnp

View File

@@ -14,7 +14,7 @@ _this_dir = os.path.dirname(__file__)
MAJOR = 0 MAJOR = 0
MINOR = 5 MINOR = 5
MICRO = 4 MICRO = 5
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
@@ -45,6 +45,9 @@ write_version_py()
try: try:
import pypandoc import pypandoc
long_description = pypandoc.convert('README.md', 'rst') long_description = pypandoc.convert('README.md', 'rst')
changelog = pypandoc.convert('CHANGELOG.md', 'rst')
changelog = '\nChangelog\n=============\n' + changelog
long_description += changelog
except (IOError, ImportError): except (IOError, ImportError):
long_description = '' long_description = ''