From 12ddd743ef1457c199d74ae117ac502a5d24f325 Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Mon, 14 Oct 2019 11:19:33 -0700 Subject: [PATCH] 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 --- README.md | 92 +++++++++++++++++++++++++++++++++++-------------------- setup.py | 20 ++++++------ 2 files changed, 68 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 30f8d28..d99d681 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,96 @@ -# pycapnp +# pycapnp-async + +[![Actions Status](https://github.com/haata/pycapnp-async/workflows/Python%20Test%20Packaging/badge.svg)](https://github.com/haata/pycapnp-async/actions) -More thorough docs are available at [http://jparyani.github.io/pycapnp/](http://jparyani.github.io/pycapnp/). ## Requirements -pycapnp's distribution has no requirements beyond a C++11 compatible compiler. GCC 4.8+ or Clang 3.3+ should work fine. +* C++14 supported compiler + - gcc 6.1+ (5+ may work) + - clang 6 (3.4+ may work) + - Visual Studio 2017+ +* cmake (needed for bundled capnproto) + - ninja (macOS + Linux) + - Visual Studio 2017+ + +* capnproto-0.7.0 + - Not necessary if using bundled capnproto + +32-bit Linux requires that capnproto be compiled with `-fPIC`. This is usually set correctly unless you are compiling canproto yourself. This is also called `-DCMAKE_POSITION_INDEPENDENT_CODE=1` for cmake. + +pycapnp has additional development dependencies, including cython and pytest. See requirements.txt for them all. -pycapnp has additional development dependencies, including cython and py.test. See requirements.txt for them all. ## Building and installation -Install with `pip install pycapnp`. You can set the CC environment variable to control which compiler is used, ie `CC=gcc-4.8 pip install pycapnp`. +Install with `pip install pycapnp`. You can set the CC environment variable to control which compiler is used, ie `CC=gcc-8.2 pip install pycapnp`. 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 may need to set `CFLAGS` like so: - - CFLAGS='-stdlib=libc++' pip install pycapnp +```bash +git clone https://github.com/haata/pycapnp-async.git +cd pycapnp-async +pip install . +``` If you wish to install using the latest upstream C++ Cap'n Proto: - pip install --install-option "--libcapnp-url" --install-option "https://github.com/sandstorm-io/capnproto/archive/master.tar.gz" --install-option "--force-bundled-libcapnp" . +```bash +pip install \ + --install-option "--libcapnp-url" \ + --install-option "https://github.com/sandstorm-io/capnproto/archive/master.tar.gz" \ + --install-option "--force-bundled-libcapnp" . +``` + +To force bundled python: + +```bash +pip install --install-option "--force-bundled-libcapnp" . +``` ## Python Versions -Python 2.7, Python 3.4+, and PyPy 2.1+ are supported. +Python 3.7+ is supported. +Earlier versions of Python have asyncio bugs that might be possible to work around, but may require significant work (3.5 and 3.6). -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. +Git flow has been abandoned, use master. + +To test, use a pipenv (or install requirements.txt and run pytest manually). +```bash +pip install pipenv +pipenv install +pipenv run pytest +``` + ### Binary Packages Building a dumb binary distribution: - python setup.py bdist_dumb +```bash +python setup.py bdist_dumb +``` Building a Python wheel distributiion: - python setup.py bdist_wheel +```bash +python setup.py bdist_wheel +``` -If it fails with an error like `clang: error: no such file or directory: 'capnp/lib/capnp.cpp'`, then you need to cythonize fist. This can be done with: - python setup.py build --force-cython +### Pypi Upload Instructions + +Only necessary if uploading release to pypi.org. + +TODO + ## Documentation/Example + There is some basic documentation [here](http://jparyani.github.io/pycapnp/). The examples directory has one example that shows off pycapnp quite nicely. Here it is, reproduced: @@ -161,17 +201,3 @@ if __name__ == '__main__': server(write_end) client(read_end) ``` - -## Common Problems - -If you get an error on installation like: - - ... - gcc-4.8: error: capnp/capnp.c: No such file or directory - - gcc-4.8: fatal error: no input files - -Then you have too old a version of setuptools. Run `pip install -U setuptools` then try again. - - -[![Build Status](https://travis-ci.org/jparyani/pycapnp.png?branch=develop)](https://travis-ci.org/jparyani/pycapnp) diff --git a/setup.py b/setup.py index 09ac805..5c47573 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python ''' -pycapnp distutils setup.py +pycapnp-async distutils setup.py ''' from __future__ import print_function @@ -20,15 +20,15 @@ from buildutils import test_build, fetch_libcapnp, build_libcapnp, info _this_dir = os.path.dirname(__file__) MAJOR = 0 -MINOR = 6 -MICRO = 4 +MINOR = 7 +MICRO = 0 VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) # Write version info def write_version_py(filename=None): ''' - Generate pycapnp version + Generate pycapnp-async version ''' cnt = """\ version = '%s' @@ -156,7 +156,7 @@ import Cython # noqa: F401 extensions = cythonize('capnp/lib/*.pyx') setup( - name="pycapnp", + name="pycapnp-async", packages=["capnp"], version=VERSION, package_data={ @@ -178,10 +178,10 @@ setup( description="A cython wrapping of the C++ Cap'n Proto library", long_description=long_description, license='BSD', - author="Jason Paryani", - author_email="pypi-contact@jparyani.com", - url='https://github.com/jparyani/pycapnp', - download_url='https://github.com/jparyani/pycapnp/archive/v%s.zip' % VERSION, + author="Jacob Alexander", + author_email="haata@kiibohd.com", + url='https://github.com/haata/pycapnp-async', + download_url='https://github.com/haata/pycapnp-async/archive/v%s.zip' % VERSION, keywords=['capnp', 'capnproto', "Cap'n Proto"], classifiers=[ 'Development Status :: 4 - Beta', @@ -191,8 +191,6 @@ setup( 'Operating System :: POSIX', 'Programming Language :: C++', 'Programming Language :: Cython', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Communications'],