I’m happy to announce the first alpha of Couchbase Python Client 3.0. This major new version shares the same advanced internals of its predecessor, while presenting a new, harmonised and revised API shaped by our experiences supporting and developing SDK2.

If you want to get going right away, then check out the getting started guide here . The Python SDK is available to download right now, in a pre-release alpha form, by running:

Here are some of the many new features:

Further Cross-SDK Harmonisation

Version 2 of the Python SDK began the process of harmonising syntax and semantics with the other Couchbase APIs and Version 3 continues this. At the same time, our goal is always to express the functionality that Couchbase provides as idiomatically as possible.

To this end, this alpha showcases the availability of OptionBlocks while retaining named parameters. We have adapted the naming of various services and functions accordingly, and have updated the Result and error-handling class structures to conform to an agreed, cross-SDK model.

New in Couchbase Server 6.5

Collections

Version 3 provides direct support for collections, which will be previewed by Couchbase Server soon. In later alphas, you will be able to create and manipulate individual collections, but for now we are supporting the default collection, which will give you a flavour of the new API.

Synchronous Durability

Out-of-the-box the SDK supports the new stronger durability that will be available in upcoming previews of Couchbase Server:

Batteries Included

Version 3 entirely automates the provision of an appropriate version of libcouchbase, the underlying C SDK that enables the high performance it provides.

Firstly, we recently began supporting Python binary wheels, a method of distributing pre-built binaries for many platforms, for SDK2, and intend to continue and expand this support as time goes on.

However, if a wheel is not available, the installer will hunt down an appropriate version of the library, building and installing it alongside the Couchbase Python Client binaries if necessary, assuming you have the right kind of development tools available. Whenever you install or upgrade the client, it will provide you with the latest fixes and functionality form libcouchbase.

Type hints

In our aim to improve discoverability and reliability of our SDK and the applications that depend upon it, we have added extensive support for the emerging Python type annotation standards (see PEP 484, PEP 526, PEP 483 to name but a few). Numerous tools, including MyPy, PyDev and PyCharm (both standalone and as a plugin) offer excellent support for these, as these screenshots demonstrate:

Autocompletion, even with chained methods.

Never guess a parameter again.

Method overloads are listed clearly.

Invalid use of the API is highlighted clearly.

Of course, there are some other things left behind to get all of this greatness. Python 2.7 works with all the new features for now, but is EOL in January 2020. Therefore this SDK will support only Python 3.  Keep that in mind as you are looking at all of the new features of Version 3. Type annotations are a recent Python feature and much of the tooling is designed for Python 3.6 and later. We also support Python 3.7’s incarnation of asyncio. This should help you to simplify your concurrent code and make the most of Couchbase.

Conclusion

If you’re excited to get started with the Couchbase Python SDK 3.0 alpha, then check it out here.  It’s available right now, though in its early alpha form.  There may be a few breaking changes before full release, but try it out and give us your feedback.  We welcome the chance to make some changes and make this the best Python development interface to Couchbase possible.

 

Posted by Ellis Breen, Senior Software Developer, Couchbase

Seasoned polyglot developer of 15+ years, with extensive experience in (amongst others) C++, Python, Java, C#, Perl, and unextensive experience in Haskell and JavaScript. Maintainer of the Couchbase Python SDK. Unseasoned keyboardist for a Mancunian funk band.

Leave a reply