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
This commit is contained in:
92
README.md
92
README.md
@@ -1,56 +1,96 @@
|
|||||||
# pycapnp
|
# pycapnp-async
|
||||||
|
|
||||||
|
[](https://github.com/haata/pycapnp-async/actions)
|
||||||
|
|
||||||
More thorough docs are available at [http://jparyani.github.io/pycapnp/](http://jparyani.github.io/pycapnp/).
|
|
||||||
|
|
||||||
## Requirements
|
## 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
|
## 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:
|
Or you can clone the repo like so:
|
||||||
|
|
||||||
git clone https://github.com/jparyani/pycapnp.git
|
```bash
|
||||||
pip install --install-option '--force-cython' ./pycapnp
|
git clone https://github.com/haata/pycapnp-async.git
|
||||||
|
cd pycapnp-async
|
||||||
Note: for OSX, if using clang from Xcode 5, you may need to set `CFLAGS` like so:
|
pip install .
|
||||||
|
```
|
||||||
CFLAGS='-stdlib=libc++' pip install pycapnp
|
|
||||||
|
|
||||||
If you wish to install using the latest upstream C++ Cap'n Proto:
|
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 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
|
## 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
|
### Binary Packages
|
||||||
|
|
||||||
Building a dumb binary distribution:
|
Building a dumb binary distribution:
|
||||||
|
|
||||||
python setup.py bdist_dumb
|
```bash
|
||||||
|
python setup.py bdist_dumb
|
||||||
|
```
|
||||||
|
|
||||||
Building a Python wheel distributiion:
|
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
|
## 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 pycapnp quite nicely. Here it is, reproduced:
|
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)
|
server(write_end)
|
||||||
client(read_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.
|
|
||||||
|
|
||||||
|
|
||||||
[](https://travis-ci.org/jparyani/pycapnp)
|
|
||||||
|
|||||||
20
setup.py
20
setup.py
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
'''
|
'''
|
||||||
pycapnp distutils setup.py
|
pycapnp-async distutils setup.py
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from __future__ import print_function
|
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__)
|
_this_dir = os.path.dirname(__file__)
|
||||||
|
|
||||||
MAJOR = 0
|
MAJOR = 0
|
||||||
MINOR = 6
|
MINOR = 7
|
||||||
MICRO = 4
|
MICRO = 0
|
||||||
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
|
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
|
||||||
|
|
||||||
|
|
||||||
# Write version info
|
# Write version info
|
||||||
def write_version_py(filename=None):
|
def write_version_py(filename=None):
|
||||||
'''
|
'''
|
||||||
Generate pycapnp version
|
Generate pycapnp-async version
|
||||||
'''
|
'''
|
||||||
cnt = """\
|
cnt = """\
|
||||||
version = '%s'
|
version = '%s'
|
||||||
@@ -156,7 +156,7 @@ import Cython # noqa: F401
|
|||||||
extensions = cythonize('capnp/lib/*.pyx')
|
extensions = cythonize('capnp/lib/*.pyx')
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="pycapnp",
|
name="pycapnp-async",
|
||||||
packages=["capnp"],
|
packages=["capnp"],
|
||||||
version=VERSION,
|
version=VERSION,
|
||||||
package_data={
|
package_data={
|
||||||
@@ -178,10 +178,10 @@ setup(
|
|||||||
description="A cython wrapping of the C++ Cap'n Proto library",
|
description="A cython wrapping of the C++ Cap'n Proto library",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
license='BSD',
|
license='BSD',
|
||||||
author="Jason Paryani",
|
author="Jacob Alexander",
|
||||||
author_email="pypi-contact@jparyani.com",
|
author_email="haata@kiibohd.com",
|
||||||
url='https://github.com/jparyani/pycapnp',
|
url='https://github.com/haata/pycapnp-async',
|
||||||
download_url='https://github.com/jparyani/pycapnp/archive/v%s.zip' % VERSION,
|
download_url='https://github.com/haata/pycapnp-async/archive/v%s.zip' % VERSION,
|
||||||
keywords=['capnp', 'capnproto', "Cap'n Proto"],
|
keywords=['capnp', 'capnproto', "Cap'n Proto"],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 4 - Beta',
|
'Development Status :: 4 - Beta',
|
||||||
@@ -191,8 +191,6 @@ setup(
|
|||||||
'Operating System :: POSIX',
|
'Operating System :: POSIX',
|
||||||
'Programming Language :: C++',
|
'Programming Language :: C++',
|
||||||
'Programming Language :: Cython',
|
'Programming Language :: Cython',
|
||||||
'Programming Language :: Python :: 3.5',
|
|
||||||
'Programming Language :: Python :: 3.6',
|
|
||||||
'Programming Language :: Python :: 3.7',
|
'Programming Language :: Python :: 3.7',
|
||||||
'Programming Language :: Python :: Implementation :: PyPy',
|
'Programming Language :: Python :: Implementation :: PyPy',
|
||||||
'Topic :: Communications'],
|
'Topic :: Communications'],
|
||||||
|
|||||||
Reference in New Issue
Block a user