Jan Soubousta - How we built a Python SDK for our (open) APIs [PyData Prague 2022-12-13]

Building a Python SDK for open APIs, from duplicated code to modular solution.

Key takeaways
  • Thousands of lines of duplicated code in the source code led to the decision to build a Python SDK for the company’s open APIs.
  • RedoDocs was initially used for documentation, but it was not suitable for a complex API and was eventually replaced.
  • OpenAPI specification was used to describe the APIs, making it easier to generate API clients.
  • The company’s platform provides an API gateway, which allows clients to interact with the platform programmatically.
  • The SDK was built to be modular, with extension libraries being developed on top of it.
  • The project utilizes various tools, including TOX, SonarQube, and GitHub actions for CI/CD pipeline.
  • The team decided to open-source the SDK to encourage community contributions and to create a single source of truth for the company’s APIs.
  • The SDK was built to be flexible, allowing users to customize the API client and generate documentation programmatically.
  • The project is hosted on GitHub, with a separate repository for the SDK and another for the example integrations.
  • The team uses GitLab for ELT scheduling and Apache Arrow flight for the SQL gateway.
  • The SDK provides a simple way to interact with the APIs, allowing users to focus on building their applications rather than implementing complex API logic.
  • The project’s goals include providing a single source of truth for the company’s APIs, encouraging community contributions, and making it easier for developers to integrate with the platform.
  • The team decided to use OpenAPI specification because it is vendor-neutral and allows for generating API clients programmatically.
  • The company’s platform provides a data model and metrics for analysis, and the SDK allows users to integrate with these features.
  • The project is currently hosted on GitHub, with a plan to move to a more robust version control system in the future.
  • The team decided to open-source the SDK to create a community around the project and to encourage contributions from other developers.
  • The project’s documentation is generated programmatically from the OpenAPI specification, making it easier to keep the documentation up-to-date.
  • The SDK provides a simple way to run unit tests and integration tests, allowing developers to ensure that their code works correctly before deploying it to production.
  • The project’s CI/CD pipeline is automated using GitHub actions, making it easier to build, test, and deploy the SDK.