From a901b358ca002dd8debe42527d5b918adb52cfbb Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Mon, 2 Mar 2015 14:42:32 -0800 Subject: [PATCH 1/5] Update README --- README.md | 94 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 7575b7d..d4e9f9c 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,9 @@ More thorough docs are available at [http://jparyani.github.io/pycapnp/](http:// ## 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 -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 -``` +pycapnp has additional development dependencies, including cython and py.test. See requirements.txt for them all. ## Building and installation @@ -31,10 +17,20 @@ Or you can clone the repo like so: git clone https://github.com/jparyani/pycapnp.git 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 +## 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 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 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 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 from __future__ import print_function @@ -130,6 +116,49 @@ if __name__ == '__main__': 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 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. -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) From 95d1ce5903cee48fe5cbcf7857ddc1f4af10cb2b Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Thu, 5 Mar 2015 12:51:56 -0800 Subject: [PATCH 2/5] Add changelog to description --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 6dac4e4..28cea7e 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,9 @@ write_version_py() try: import pypandoc long_description = pypandoc.convert('README.md', 'rst') + changelog = pypandoc.convert('CHANGELOG.md', 'rst') + changelog = '\nChangelog\n=============\n' + changelog + long_description += changelog except (IOError, ImportError): long_description = '' From 2027bac43493fe4fa8bdfcf8a80ef67a3bdb085d Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Thu, 5 Mar 2015 12:52:06 -0800 Subject: [PATCH 3/5] Update bundled libcapnp to v0.5.1.2 --- buildutils/bundle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildutils/bundle.py b/buildutils/bundle.py index 2e3b3e0..f1292c4 100644 --- a/buildutils/bundle.py +++ b/buildutils/bundle.py @@ -35,7 +35,7 @@ pjoin = os.path.join # 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_url = "https://capnproto.org/" + libcapnp From 00e6bf2a5b31aac41198d57acf8060e20d1fd568 Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Thu, 5 Mar 2015 12:56:58 -0800 Subject: [PATCH 4/5] Bump version to v0.5.5 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 28cea7e..ef81089 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ _this_dir = os.path.dirname(__file__) MAJOR = 0 MINOR = 5 -MICRO = 4 +MICRO = 5 VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) From fb5f62ce21c7ecfaa615acc823677bdd7ac237e4 Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Thu, 5 Mar 2015 12:57:29 -0800 Subject: [PATCH 5/5] Update CHANGELOG for v0.5.5 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbc5178..268304e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) - Update bundled C++ libcapnp to v0.5.1.1 security release - Add bootstrap RPC methods