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
|
||||
|
||||
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.
|
||||
|
||||
|
||||
[](https://travis-ci.org/jparyani/pycapnp)
|
||||
|
||||
Reference in New Issue
Block a user