diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 57fb23d6..9a4c46a8 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 06ed501f..92e8d583 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 63982a47..88c95ddc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/buildutils/bundle.py b/buildutils/bundle.py index 09645900..a29fce02 100644 --- a/buildutils/bundle.py +++ b/buildutils/bundle.py @@ -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 @@ -50,8 +50,13 @@ 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) @@ -59,7 +64,6 @@ def fetch_archive(savedir, url, fname, force=False): 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 @@ -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) diff --git a/capnp/includes/capnp_cpp.pxd b/capnp/includes/capnp_cpp.pxd index 6edc40e4..335b1726 100644 --- a/capnp/includes/capnp_cpp.pxd +++ b/capnp/includes/capnp_cpp.pxd @@ -476,7 +476,6 @@ cdef extern from "capnp/capability.h" namespace " ::capnp": # void adoptResults(Orphan&& 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: diff --git a/capnp/lib/capnp.pyx b/capnp/lib/capnp.pyx index b90c7794..ff775a25 100644 --- a/capnp/lib/capnp.pyx +++ b/capnp/lib/capnp.pyx @@ -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)))) diff --git a/docs/install.rst b/docs/install.rst index abb81c0f..c31121a5 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -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 @@ -50,11 +50,6 @@ And install pycapnp with:: cd pycapnp pip install . -or:: - - cd pycapnp - python setup.py install - Development ----------- @@ -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:: diff --git a/setup.py b/setup.py index 8ba020f9..b263a961 100644 --- a/setup.py +++ b/setup.py @@ -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) @@ -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) @@ -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", ], diff --git a/tox.ini b/tox.ini index 2aea6579..71d1c9ac 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py37,py38,py39,py310,py311 +envlist = py38,py39,py310,py311,py12 skipsdist = True [testenv]