Commit graph

832 commits

Author SHA1 Message Date
Jacob Alexander
67d5276936
Defaulting to built-in capnproto
- Adding code to detect if bundled capnproto is already built
2019-10-15 09:35:55 -07:00
Jacob Alexander
7789ebbf96
Fixing flake8 linting errors 2019-10-15 01:08:11 -07:00
Jacob Alexander
0e830c2127
Minor test fixes for Linux with IPv6 2019-10-15 01:04:00 -07:00
Jacob Alexander
f2651facde
Updating capnproto bundling code to use CMake and ninja
- Must faster
- Also showing output by default (easier to diagnose errors)
  * ninja has minimal verbosity (unless there are errors)
2019-10-15 00:42:34 -07:00
Jacob Alexander
10355a74ac
More agressive warning fixes
capnp/lib/capnp.cpp:35163:294: warning: moving a temporary object prevents copy
      elision [-Wpessimizing-move]
  ...*)__pyx_t_3), new  ::capnp::DynamicStruct::Pipeline(std::move((( ::capn...
                                                         ^
capnp/lib/capnp.cpp:35163:294: note: remove std::move call here
  ...std::move((( ::capnp::DynamicValue::Pipeline)__pyx_v_self->thisptr->get(__pyx_t_5)).releaseAs< ::capnp::DynamicStruct>())...
     ^~~~~~~~~~                                                                                                              ~
capnp/lib/capnp.cpp:39540:53: warning: moving a temporary object prevents copy
      elision [-Wpessimizing-move]
  __pyx_v_self->thisptr = new  ::kj::AsyncIoContext(std::move( ::kj::se...
                                                    ^
capnp/lib/capnp.cpp:39540:53: note: remove std::move call here
  ...= new  ::kj::AsyncIoContext(std::move( ::kj::setupAsyncIo()));
                                 ^~~~~~~~~~                     ~
capnp/lib/capnp.cpp:47838:294: warning: moving a temporary object prevents copy
      elision [-Wpessimizing-move]
  ...*)__pyx_t_3), new  ::capnp::DynamicStruct::Pipeline(std::move((( ::capn...
                                                         ^
capnp/lib/capnp.cpp:47838:294: note: remove std::move call here
  ...std::move((( ::capnp::DynamicValue::Pipeline)__pyx_v_self->thisptr->get(__pyx_t_5)).releaseAs< ::capnp::DynamicStruct>())...
     ^~~~~~~~~~                                                                                                              ~
2019-10-14 23:54:00 -07:00
Jacob Alexander
f6dd08dda6
Removing deprecated Restorer and ezRestore references
- Not recommended to be used in new designs
- Just pollutes warning messages during compilation (hiding ones that
should be fixed)
- Updated test code to use bootstrap
- Sped up some of the test code that was just sleeping while waiting for
the server (now polling for the socket)
2019-10-14 23:19:39 -07:00
Jacob Alexander
12ddd743ef
Fork pycapnp to pycapnp-async
- Breaking some earlier compatibility to cleanup build messages
- As well as being able to publish pypi releases
  * Builds can be complicated to package correctly
- Windows support
2019-10-14 21:34:08 -07:00
Jacob Alexander
de61c304e1
Adding sleep delay
- Reduces 99% CPU usage to around 1%
- It might be useful to have the sleep/delay tunable for certain
applications depending on the latency requirements
2019-10-12 16:21:58 -07:00
Jacob Alexander
940ab9916d
Adding reconnecting async ssl example
- async_reconnecting_ssl_client.py will automatically close and
reconnect to a server when it becomes available (rather than hanging or
dying when the server disappears)
2019-10-05 14:50:56 -07:00
Yann Diorcet
722579d671
Guess include and lib directory using capnp executable 2019-09-30 00:58:10 -07:00
Yann Diorcet
a7efe4e3f8
Fix setup.py for MSVC 2019-09-30 00:55:16 -07:00
Jacob Alexander
8361fa8597
Currently asyncio examples require Python 3.7+
- It should be possible to port asyncio examples to at least Python 3.6
  * However, in my quick 10 minute attempt it wasn't as smooth as I'd
  hoped
2019-09-29 23:54:49 -07:00
Jacob Alexander
78776de647
Adding examples as pytest tests
- This way they will be included in CI checks
- Decreased the delay time in the thread-like examples to speed up tests
(probably could decrease the time some more)
- Added an async version of the calculator test
- Forcing python3 support for example scripts
2019-09-27 14:40:54 -07:00
Jacob Alexander
58a5c5fc1f
Initial pythonpackage.yml for GitHub Actions 2019-09-27 01:52:41 -07:00
Jacob Alexander
75e0e7e84c
Fixed or waved all pytest failures and errors
- Needed to include cleanup_global_schema_parser() to handle duplicate
imports of the same .capnp file
  * Duplicate IDs are a problem as pytest does not fully cleanup between
  tests
- Marked some tests as xfail as I'm not sure the test is supposed to
work anymore with recent versions of capnproto
2019-09-27 01:12:54 -07:00
Jacob Alexander
d62e9b80f7
Always use Cython 2019-09-27 00:30:08 -07:00
Jacob Alexander
b3021e4f6b
Fixing flake8 warnings and errors
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude benchmark

Excluding the benchmark directory (due to protobuf generated files)
Also removing some Python2 specific code
2019-09-27 00:15:13 -07:00
Jacob Alexander
1f0200af9c
Unlocking python package version requirements 2019-09-26 21:54:12 -07:00
Jacob Alexander
db4e567c6b
Upgrading to capnproto-0.7.0
- Needed for asyncio support
2019-09-26 21:42:55 -07:00
Jacob Alexander
1a127bec6f
Adding pure python SSL test using asyncio
- Uses thread.capnp
- Follows same format as thread_client.py/thread_server.py and
async_client.py/async_server.py
- Including a basic self signed certificate for testing convenience
- Python 3.7 has a bug cleaning up SSL when using asyncio.run
  https://bugs.python.org/issue36709
  Have a slightly more verbose workaround to do proper cleanup
2019-09-26 21:42:54 -07:00
Jacob Alexander
8915ef79f1
TwoWayPipe and basic asyncio support
Note: I've tried not to break any behaviour of the previously working APIs

Python API Changes / Additions
- capnp/lib/capnp.pyx
  * class _RemotePromise
    + [Added] cpdef _wait(self)
      = Exception raising code that used to be inside of wait(self)
    + [Modified] def wait(self)
      = Same functionality as before
    + [Added] async def a_wait(self)
      = Cannot use await as that's a reserved keyword
      = Uses pollRemote and asyncio.sleep(0) to make call asynchronous
  * class _TwoPartyVatNetwork
    + [Added] cdef _init_pipe(self, _TwoWayPipe pipe, Side side,
    schema_cpp.ReaderOptions opts)
      = Instanciates a TwoPartyVatNetwork using a TwoWayPipe (instead of
      using a file handle or connection as before)
  * class TwoPartyClient
    + [Modified] def __init__(self, socket=None, restorer=None,
    traversal_limit_in_words=None, nesting_limit=None)
      = Changes the socket parameter to be optional
      = If socket is not specified, default to using a TwoWayPipe
    + [Added] async def read(self, bufsize)
      = awaitable function that blocks until data has been read
      = bufsize defines the maximum amount of data to be read back
        (e.g. 4096 bytes)
      = Reads data from TwoWayPipe
    + [Added] def write(self, data)
      = Write data to TwoWayPipe
      = Not awaitable as the write interface of the TwoWayPipe doesn't
      have poll functionality
  * class TwoPartyServer
    + [Modified] def __init__(self, socket=None, restorer=None,
    server_socket=None, bootstrap=None, traversal_limit_in_words=None,
    nesting_limit=None)
      = Changes the socket parameter to be optional
      = If socket is not specified, default to using a TwoWayPipe
      = Simplified code by removing an else (self._connect)
    + [Added] async def read(self, bufsize)
      = awaitable function that blocks until data has been read
      = bufsize defines the maximum amount of data to be read back
        (e.g. 4096 bytes)
      = Reads data from TwoWayPipe
    + [Added] def write(self, data)
      = Write data to TwoWayPipe
      = Not awaitable as the write interface of the TwoWayPipe doesn't
      have poll functionality
    + [Added] async def poll_forever(self)
      = asyncio equivalent of run_forever()
  * class _TwoWayPipe
    + Wrapper class for TwoWayPipe

Other Additions
- capnp/helpers/asyncHelper.h
  * pollWaitScope
    + Pumps the kj event handler
    + Used for the TwoWayServer
  * pollRemote
    + Polls a remote promise
    + i.e. a capnp RPC call
- capnp/helpers/asyncIoHelper.h
  * AsyncIoStreamReadHelper
    + I wasn't able to figure out Promise[size_t] using Cython so this was
    the next best thing I could think of doing
    + Was needed to handle read polling from a read promise
      = Polling is used for asyncio as kj waits need a wrapper to be
      compatible
- capnp/lib/capnp.pyx
  * makeTwoWayPipe
    + Wrapper for kj newTwoWayPipe function
  * poll_once
    + Single pump of the kj event handler (used with pollWaitScope)

TwoWayClient Usage - TwoWayPipe
- See examples/async_client.py

TwoWayServer Usage - TwoWayPipe
- See examples/async_server.py

capnp/helpers/asyncIoHelper.h

Misc Changes
- Fixed thread_server.py and thread_client.py to use bootstrap instead
of ez_restore
- async_client.py and async_server.py examples
  * Uses the same thread.capnp as thread_client.py and thread_server.py
  * They are compatible, so you can mix and match client and server for
  compatibility testing
  * async_client.py and async_server.py require <address>:<port>
  formatting (unlike autodetection from thread_client.py and
  thread_server.py)
2019-09-26 21:42:48 -07:00
Jacob Alexander
e73b63ddd1
Removed deprecated functions
- PyObject_AsReadBuffer
- PyObject_AsWriteBuffer
2019-09-16 21:37:00 -07:00
Andrey Cizov
33725b9e7f
ignore files created during setup.py install 2019-09-16 21:34:58 -07:00
Andrey Cizov
e8662a1dc9
remove deprecation warnings 2019-09-16 21:34:58 -07:00
Andrey Cizov
423e4f1f8c
remove warning during compilation 2019-09-16 21:34:58 -07:00
Jacob Alexander
de22f7eb97
Fixing compilation errors with capnproto-7.0.0 2019-09-16 21:33:56 -07:00
Colin Jermain
bc1a3a5f3f
Merge pull request #185 from andreycizov/fix-travis-build
fix travis build failure
2019-07-15 19:43:08 -04:00
Andrey Cizov
ab267eccbd fix travis build failure 2019-07-13 15:06:18 +01:00
Jason Paryani
cb3f190b95 Add deploy notes about tags 2019-02-01 15:11:53 -08:00
Jason Paryani
3ab199b4b9 Fix minor typo in Changelog 2019-01-31 01:30:07 -08:00
Jason Paryani
bdb7d101e9 Add DEPLOY.md with instructions for deploying to PyPI 2019-01-31 01:20:29 -08:00
Jason Paryani
a4f740fb0f Bump version to v0.6.4 and update changelog 2019-01-31 01:10:15 -08:00
Jason Paryani
e4d7e21a66 Add error if trying to run python setup.py sdist without pandoc 2019-01-31 01:03:21 -08:00
Jason Paryani
da8f8869fc Add some edge case tests for read_multiple_bytes 2019-01-31 01:02:11 -08:00
Colin Jermain
29e63de41d
Merge pull request #179 from tsh56/bugfix/issue-178
Support long messages in read_multiple_bytes.
2019-01-28 18:50:47 -05:00
Trevor Highland
2a66c2f6bf Skip tests based on python version. 2019-01-28 18:09:17 +00:00
Trevor Highland
ed6e39ded0 Update test to support 3.5 2019-01-28 17:39:10 +00:00
Trevor Highland
dbd23721a9 Support long messages in read_multiple_bytes. 2019-01-28 17:04:34 +00:00
Colin Jermain
adfc76f4c2
Merge pull request #175 from cjermain/feature/schema-parser-header
Exposing SchemaParser in Cython header
2019-01-15 19:19:58 -05:00
Colin Jermain
ddb0bc9306 Merge branch 'develop' into feature/schema-parser-header 2019-01-14 20:11:55 -05:00
Colin Jermain
59fdf948a6
Merge pull request #176 from cjermain/bug/fix-python-versions
Replacing end-of-life Python versions with live versions
2019-01-14 20:07:43 -05:00
Colin Jermain
2b26665f56 Removing Python 3.7 from this PR 2018-11-18 16:27:09 -05:00
Colin Jermain
afe72a15b1 Setting distro to Xenial globally in attempt to get Python 3.7 CI 2018-11-18 15:39:33 -05:00
Colin Jermain
7052cdbaba Removing Python 3.7 from normal Travis Python list 2018-11-18 10:52:58 -05:00
Colin Jermain
770896132b Adding patch to Travis CI for Python 3.7 support 2018-11-18 10:35:57 -05:00
Colin Jermain
3afcbb3918 Replacing end-of-life Python versions with live versions 2018-11-18 10:01:10 -05:00
Colin Jermain
eb62693915 Exposing SchemaParser in Cython header 2018-11-06 21:11:59 -05:00
Jason Paryani
19e1b189ca Bump version to v0.6.3 and update changelog 2018-01-14 11:57:08 -08:00
Jason Paryani
1665f9003f
Merge pull request #164 from E8-Storage/develop
Capnproto 0.6.1 and one less memory leak
2018-01-14 11:50:45 -08:00
Yuval Katsnelson
74618de3ef Update bundled capnp to 0.6.1 2017-12-06 10:49:09 +02:00