pyuv 1.4.0 released

Today I finally found some time to put together a new pyuv release! Oh, but what is pyuv? I’m glad you asked!

pyuv is a Python module which provides an interface to libuv. libuv is a high performance asynchronous networking and platform abstraction library.

This a big one. Here are some of the highlights:

  • PyPy support (finally!)
  • CPython 3.6 support
  • Overhauled build system (we no longer rely on the libuv build system)
  • Linux and Windows wheels published on PyPI
  • New co-maintainer! Say hi to Marc Schlaich!

See the full changelog here.

I just realized the last release was over a year ago. Time flies! At any rate, here it is now. Enjoy!

pyuv 1.2.0 released

Quick heads up, I just released pyuv 1.2.0. pyuv is a Python wrapper for libuv. This time around, pyuv implements all the funcionality covering up to libuv 1.7.3.

This release was focused in 2 things: adjusting to new APIs / changes in libuv, and improving the testing, specifically on Windows.

As of this writing, pyuv is automatically tested on Linux systems thanks to Travis CI and on Windows thanks to AppVeyor. Thanks to AppVeyor, I’m now able to provide Python Wheels for pyuv, which is great because, frankly, compiling it on Windows is kind of a pain.

See the ChangeLog for a detailed outline of the changes, check the documentation, and fetch the code on GitHub. Packages have also been uploaded to PyPI.

pyuv on wheels!

If you are a Python user which happens to use Windows every now and then you probably also suffer when installing (or at least trying to) Python packages which need to be compiled. Python wheels really help here, as they ease the installation of binary packages, and even make the installation of non-binary packages faster.

Long time pyuv contributor Marc Schlaich has recently began to provide these wheels for both 32 and 64 Windows, for all supported Python versions: 2.7, 3.3 and 3.4. Wheels for pyuv 1.0.2 have already been uploaded to PyPI, you can check how to install Python wheels here.

Thanks a lot for your contributions Marc!

 

pyuv 1.0.0 released!

In case you missed the news, libuv 1.0.0 was released not long ago, so now it’s time for pyuv to hit 1.0.0.

Hitting 1.0.0 means the API will remain backwards compatible throughout the 1.x branch. But this came at a cost: pyuv 1.0.0 introduced several backwards incompatible API changes, some coming from changes in libuv itself, and some others to (hopefully) improve pyuv itself.

Here is the full changelog.

As usual, you can download pyuv from PyPI, and check the documentation here.

“So, what now?” I hear you say. Since pyuv is currently feature-complete with regards to libuv, adding CFFI bindings to pyuv will probably be the next thing I’ll tackle. You can follow the discussion here. A user already started, and I look forward to joining forces and integrating the work 🙂

New pyuv stable and pre releases

Took a while to get these together, mainly because I’m spending quite some time on libuv itself lately. In case you didn’t know libuv 1.0.0 is around the corner, yesterday libuv 1.0.0-rc2 was released, check it out!

Back to pyuv, I’m pleased to announce pyuv version 0.10.12, which a maintenance release for the v0.10 series. In addition, I’m releasing pyuv 1.0.0.dev1, the first development release in the v1.x series of pyuv (which bundles libuv 1.0.0-rc2).

Enjoy!

:wq

Evergreen 0.2.0 released!

I’m very happy to announce I just released evergreen 0.2.0! From the API standpoint, not many things changed, but a number of important internal changes happened, including a change in how callbacks are scheduled in the event loop, which fixed a nasty issue in Windows.

For those who may not know:

Evergreen is a cooperative multitasking and i/o library for Python. It provides equivalent primitives to those for thread programming, but uses a cooperative model instead.

Operations are driven by an event loop which will run the given tasks and i/o operations in a non-blocking manner while presenting the user a synchronous, blocking API.

Here is the full changelog:

 – Revert “Don’t allow futures to be used more than once”
 – Break potential cycle because we are storing the traceback
 – Fixed passing traceback when propagating exception to MAIN parent
 – Process all callbacks using an Idle handle
 – Replaced use of Future in io module for Result
 – Don’t wait for send operation to complete in UDPEndpoint
 – Always run tests from the right directory
 – Fix UDP test case on Windows
 – Added flush() method to UDPEndpoint and Stream objects
 – Cache sockname and peername properties
The code can be downloaded from GitHub, as usual. Hope you like it!
:wq

uvwsgi: a Python WSGI server

I’ve been playing with Flask and WSGI in general for a few nights… at some point I started playing with pyuv and http-parser and before I realized I had a really basic WSGI server to play with: uvwsgi.

It’s not meant for production usage (yet) but should be really simple to understand, it’s less than 400 lines of code!

Here is a list of things I’d like to implement, in no particular order:

  • Multi-process support using socket sharing
  • Multi-process support using a single acceptor and a pool of worked which get connections dispatched round-robin
  • Update http-parser to the latest and greatest version
  • Automatically restart server if modules changed
  • Tests

You can install it from the cheese shop or get the code on GitHub.

Patches are welcome, of course 🙂

:wq

 

pyuv 0.10.5 (stable) and 0.11.0 (unstable) released!

I’m happy to announce two new pyuv releases today: pyuv 0.10.5 (stable) and 0.11.0 (unstable). Why two releases? For those who may not know, pyuv follows the NodeJS release cycle, that is, odd numbered releases are the so called “unstable” releases, while the even numbered releases are “stable”.

The 0.10.5 release brings  few bugfixes and embeds the latest version of libuv, so you also benefit from the bugfixes in libuv.

pyuv 0.11.0 includes some heavy refactoring of the filesystem operations, which unfortunately are not backwards compatible, but I hope it’s for the best:

In pyuv 0.10x this is the way to stat a file asynchronously:

def cb(loop, path, result, error):
    if error is None:
        print result
    # ...

pyuv.fs.stat(loop, 'test.py', callback=cb)

And here is the equivalent in pyuv 0.11:

def cb(req):
    if req.error is None:
        print result
    # ...

req = pyuv.fs.stat(loop, 'test.py', callback=cb)

All filesystem operations now get a single argument in the callback: the FSRequest object which was returned to the caller when the function was initially called. The loop, path, result and error are now attributes of the request object. Moreover, the request object now has an instance dictionary, so you can attach any attribute to it and use it later:

def cb(req):
    assert req.foo == 'foo'
    if req.error is None:
        print result
    # ...

req = pyuv.fs.stat(loop, 'test.py', callback=cb)
req.foo = 'foo'

There have been other big internal changes due to changes in libuv itself, but those are not visible in pyuv since it provides a class-level abstraction.

The next stable release will be pyuv 0.12.0, right when Node 0.12 is launched. Until then 0.10 will remain as the stable branch, and the one installable through PyPI, those of you interested in the latest and the greatest, go fetch master on GitHub 🙂

:wq

 

Evergreen: cooperative multitasking and i/o for Python

I’ve been working on-and-off on this project for almost a year during my free time, and after meditating about it I thought: “fuck it, ship it”. Allow me to introduce Evergreen: cooperative multitasking and i/o for Python.

“So, another framework?” I hear you say. Yes, it’s another async framework. But it’s my async framework. I’ve used a number of frameworks for developing servers in Python such as Twisted, Tornado, Eventlet, Gevent and lately Tulip and all of them have great and not so great things, so I decided to blend the ideas I gathered from all of them, add some opinionated decisions, some Stackless flavour and Evergreen was the result.

standards

Evergreeen is a framework which allows developers to write synchronous looking code which is executed asynchronously in a cooperative manner. Evergreen presents an API which looks like the one you would use to write concurrent programs using threads or futures from the Python standard library. The facilities provided by Evergreen are however cooperative, that is, while a task is busy waiting for some i/o other tasks will have their chance to run.

“Show me the code!” I hear you say. Sure, it’s up here on GitHub, released under the MIT license. Since the usual example is a web crawler, here you have one.

Did I mention it supports Python 2 and 3?

“Is it production ready?” I hear you say. It’s still on a very early stage, but I believe the foundation is solid. However, the APIs provided by Evergreen may change a bit until I feel confortable with them. All feedback is welcome, so if you give it a try do let me know!

I’d like to thank all authors of similar libraries for releasing their work as Open Source which I could look into and learn from.

I hope Evergreen can help you solve some problems and you enjoy using it as much as I do developing it.

:wq