ecommercepythonopen-sourcesoftware-development

Python SDK for Commercetools

2 min read

Python SDK for Commercetools

--

As you might have seen, we have added a new technology to our portfolio: Commercetools.

We have been doing e-commerce for many years and found Commercetools to be a good fit with our core values as a technology company. Primarily the way it is set up (API-First and Cloud Native) and a focus on the open source ecosystem is what made it really appealing to us.

For our larger deployments we have already introduced our Terraform Provider along with a Go SDK. This greatly improves the way we can manage individual Commercetools deployments using Infrastructure-as-Code practices, and proves very useful across our projects.

As Lab Digital is a Python house, we decided to start work on a Python SDK as well, as Commercetools does not have this available. This way we can leverage our years of e-commerce experience with Oscar Commerce — another Python based Commerce platform, to the full extent with Commercetools.

Code generation

During the Hackathon we had at Commercetools we briefly talked about code generation, which is a technique that Commercetools uses to support SDK’s in multiple languages from a single source.

Key in this approach is the way that Commercetools documents its API, using a RAML specification.

For the Python SDK we followed this approach as well: large parts of the SDK are generated using Pythons Abstract Syntax Tree (AST) module. This makes maintenance easier and allows for a really consistent implementation of the SDK, including Type Annotation for a better developer experience.

commercetools-python-sdk

At the moment the SDK is not feature complete and it may be a bit rough around the edges. We are currently implementing a couple of Commercetools projects against the SDK, and will be adding broader endpoint-coverage along with those projects.

Documentation is also lacking at the moment (coming soon!). Though we believe the SDK is quite self-explanatory, when you work with the Commercetools HTTP API documentation.

If there are endpoints missing that you need right away, don’t hesitate to submit a Pull Request or open a ticket for it.

You can find the repository at the usual place!

Tags used in this article:
ecommercepythonopen-sourcesoftware-development