Skip to content

Commit

Permalink
Prepare for v2.0.0b1 release
Browse files Browse the repository at this point in the history
- Update CHANGELOG.md
- Update to bundled capnproto-1.0.1
  * Compiles with capnproto-0.8.0 and higher
- *Breaking Change* Remove allow_cancellation (see
  https://capnproto.org/news/2023-07-28-capnproto-1.0.html)
  * This is tricky to handle for older versions of capnproto. Instead of
    dealing with lots of complication, removing it entirely.
- Fix some documentation after the build backend support was added
- Update tox.ini to support 3.8 to 3.12
- Update cibuildwheel to 2.16.1
  * Adds Python 3.12 supports and implicitly deprecates EOL 3.7 (though it's
    still built)
  • Loading branch information
haata committed Oct 3, 2023
1 parent e13a0c9 commit 313d0d4
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ jobs:
# Used to host cibuildwheel
- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.12.0
run: python -m pip install cibuildwheel==2.16.1

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## v2.0.0b1 (2023-10-03)
- Update to bundled capnproto-1.0.1
- Remove explicit support for Python 3.7 (though wheels are still built for now)
- Use custom build backend to support build args (#328)
- Update Cython version and Python to 3.12 (#320)
- Wrap all capnp code in a context-manager to avoid segfaults (#317)
- Schema loading from the wire (#307)
- Make pycapnp more GIL friendly (#308)
- Use cibuildwheel in ci (#309)
- Integrate the KJ event loop into Python's asyncio event loop (#310)
- Allow capability implementation methods to be `async` (#312)
- Allow reading and writing messages from sockets in `async` mode (#313)
- Remove the synchronous RPC mode (#315)

## v1.3.0 (2023-01-26)
- Update to bundled capnproto-0.10.3
- Add Python 3.11 to Github Actions builds (#306)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* cmake (needed for bundled capnproto)
- ninja (macOS + Linux)
- Visual Studio 2017+
* capnproto-0.10 (>=0.7.0 will also work if linking to system libraries)
* capnproto-1.0 (>=0.8.0 will also work if linking to system libraries)
- Not necessary if using bundled capnproto
* Python development headers (i.e. Python.h)
- Distributables from python.org include these, however they are usually in a separate package on Linux distributions
Expand Down
12 changes: 8 additions & 4 deletions buildutils/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#


bundled_version = (0, 10, 3)
bundled_version = (1, 0, 1)
libcapnp_name = "capnproto-c++-%i.%i.%i.tar.gz" % (bundled_version)
libcapnp_url = "https://capnproto.org/" + libcapnp_name

Expand All @@ -50,16 +50,20 @@ def localpath(*args):
return os.path.abspath(pjoin(*plist))


def fetch_archive(savedir, url, fname, force=False):
def fetch_archive(savedir, url, force=False):
"""download an archive to a specific location"""
req = urlopen(url)
# Lookup filename
fname = req.info().get_filename()
if not fname:
fname = os.path.basename(url)
dest = pjoin(savedir, fname)
if os.path.exists(dest) and not force:
print("already have %s" % fname)
return dest
print("fetching %s into %s" % (url, savedir))
if not os.path.exists(savedir):
os.makedirs(savedir)
req = urlopen(url)
with open(dest, "wb") as f:
f.write(req.read())
return dest
Expand All @@ -80,7 +84,7 @@ def fetch_libcapnp(savedir, url=None):
if os.path.exists(dest):
print("already have %s" % dest)
return
fname = fetch_archive(savedir, url, libcapnp_name)
fname = fetch_archive(savedir, url)
tf = tarfile.open(fname)
with_version = pjoin(savedir, tf.firstmember.path)
tf.extractall(savedir)
Expand Down
1 change: 0 additions & 1 deletion capnp/includes/capnp_cpp.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ cdef extern from "capnp/capability.h" namespace " ::capnp":
# void adoptResults(Orphan<Results>&& value);
# Orphanage getResultsOrphanage(uint firstSegmentWordSize = 0);
VoidPromise tailCall(Request & tailRequest)
void allowCancellation() except +reraise_kj_exception

cdef extern from "kj/async.h" namespace " ::kj":
cdef cppclass EventPort:
Expand Down
3 changes: 0 additions & 3 deletions capnp/lib/capnp.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1912,9 +1912,6 @@ cdef class _CallContext:
cpdef release_params(self):
self.thisptr.releaseParams()

cpdef allow_cancellation(self):
self.thisptr.allowCancellation()

cpdef tail_call(self, _Request tailRequest):
return _voidpromise_to_asyncio(self.thisptr.tailCall(move(deref(tailRequest.thisptr_child))))

Expand Down
21 changes: 5 additions & 16 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To force rebuilding the pip package from source (you'll need requirments.txt or

pip install --no-binary :all: pycapnp

To force bundling libcapnp (or force system libcapnp), just in case setup.py isn't doing the right thing::
To force bundling libcapnp (or force system libcapnp), just in case pip isn't doing the right thing::

pip install --no-binary :all: -C force-bundled-libcapnp=True
pip install --no-binary :all: -C force-system-libcapnp=True
Expand Down Expand Up @@ -50,11 +50,6 @@ And install pycapnp with::
cd pycapnp
pip install .

or::

cd pycapnp
python setup.py install


Development
-----------
Expand All @@ -72,21 +67,15 @@ Building::
cd pycapnp
pip install .

or::

cd pycapnp
python setup.py install

Useful targets for setup.py::

python setup.py build
python setup.py clean

Useful command-line arguments are available for setup.py::
Useful command-line arguments are available for pip install::

--force-bundled-libcapnp
--force-system-libcapnp
--libcapnp-url
-C force-bundled-libcapnp=True
-C force-system-libcapnp=True
-C libcapnp-url="https://github.com/capnproto/capnproto/archive/master.tar.gz"

Testing is done through pytest::

Expand Down
20 changes: 11 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
from buildutils.bundle import fetch_libcapnp


MAJOR = 1
MINOR = 3
MAJOR = 2
MINOR = 0
MICRO = 0
TAG = ""
TAG = "b1"
VERSION = "%d.%d.%d%s" % (MAJOR, MINOR, MICRO, TAG)


Expand Down Expand Up @@ -170,15 +170,16 @@ def run(self): # noqa: C901
else:
print("capnproto already built at {}".format(build_dir))

self.include_dirs += [os.path.join(build_dir, "include")]
self.library_dirs += [
os.path.join(build_dir, "lib{}".format(8 * struct.calcsize("P")))
]
self.library_dirs += [os.path.join(build_dir, "lib")]
self.include_dirs = [os.path.join(build_dir, "include")] + self.include_dirs
self.library_dirs = [
os.path.join(build_dir, "lib{}".format(8 * struct.calcsize("P"))),
os.path.join(build_dir, "lib"),
] + self.library_dirs

# Copy .capnp files from source
src_glob = glob.glob(os.path.join(build_dir, "include", "capnp", "*.capnp"))
dst_dir = os.path.join(self.build_lib, "capnp")
os.makedirs(dst_dir, exist_ok=True)
for file in src_glob:
print("copying {} -> {}".format(file, dst_dir))
shutil.copy(file, dst_dir)
Expand Down Expand Up @@ -253,10 +254,11 @@ def run(self): # noqa: C901
"Operating System :: POSIX",
"Programming Language :: C++",
"Programming Language :: Cython",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Communications",
],
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37,py38,py39,py310,py311
envlist = py38,py39,py310,py311,py12
skipsdist = True

[testenv]
Expand Down

0 comments on commit 313d0d4

Please sign in to comment.