DiscoverTalk Python To Me#464: Seeing code flows and generating tests with Kolo
#464: Seeing code flows and generating tests with Kolo

#464: Seeing code flows and generating tests with Kolo

Update: 2024-05-29
Share

Digest

This episode of Talk Python features Wilhelm Klopp, the creator of Kolo, a visual studio code extension for Django that helps developers understand their code better. Kolo visualizes the flow of code, showing how functions are called and how data is passed through them. It also provides a playground in the browser where users can edit code and see how the visualization changes. Kolo can also be used to generate integration tests, which are more valuable than unit tests for ensuring that code doesn't break by accident. Kolo is not entirely open source, but Klopp is considering open sourcing parts of it in the future. He also discusses the possibility of a Colo Cloud, which would allow users to share traces and collaborate on code. The episode concludes with a call to action for listeners to check out Kolo.app and email Klopp if they are interested in increasing their test coverage.

Outlines

00:00:00
Introduction

This Chapter introduces the topic of Kolo, a visual studio code extension for Django that helps developers understand their code better. The host, Michael Kennedy, welcomes Wilhelm Klopp, the creator of Kolo, to the show.

00:02:13
Wilhelm Klopp's Background

This Chapter delves into Wilhelm Klopp's background, highlighting his journey from a management degree to building a successful Slack app called Simple Poll. He shares his experience working at GitHub and how Simple Poll eventually became his full-time job, surpassing his GitHub salary.

00:04:13
The Genesis of Kolo

This Chapter explores the origins of Kolo, explaining how it started as a side project to improve Wilhelm Klopp's own developer experience while building Simple Poll. He emphasizes the initial focus on Django and VS Code due to his personal usage.

00:05:04
The Time Commitment of Side Projects

This Chapter delves into the time commitment required for side projects, particularly in the early stages. Wilhelm Klopp shares his experience dedicating significant hours to Simple Poll, even while working full-time as a software engineer. He discusses the challenges of balancing work, support, and development, and the potential benefits of prioritizing and focusing on the most important aspects of a project.

00:09:42
Simple Poll: A Django-Based Slack App

This Chapter focuses on Simple Poll, a popular Slack app built using Django. Wilhelm Klopp explains the technical aspects of building Slack apps, emphasizing the backend-based approach and the use of JSON payloads for communication. He also discusses the deployment history of Simple Poll, from Heroku to AWS and ECS.

00:12:33
Kolo: Visualizing Code Flow

This Chapter introduces Kolo in detail, highlighting its core functionality of visualizing code flow. Wilhelm Klopp explains the concept of visualizing the mental model of how code functions fit together, comparing it to enabling a debugger at the beginning and end of every function. He emphasizes the focus on hierarchy and understanding code dependencies, rather than just timing.

00:18:28
Kolo Playground and Interactive Visualization

This Chapter showcases the Kolo playground, a web-based version of Kolo that allows users to interact with code and see the visualization change in real-time. Wilhelm Klopp describes the playground's features, including the ability to edit code and see how the visualization changes, and the use of PyDiode and web assembly for running Python in the browser.

00:20:15
Kolo's Test Generation Capabilities

This Chapter explores Kolo's test generation capabilities, which leverage the trace data captured by Kolo to automatically create integration tests. Wilhelm Klopp explains the process of inverting traces to build tests, focusing on the challenges of test data setup and the benefits of integration tests over unit tests.

00:36:07
Future Plans for Kolo

This Chapter discusses Wilhelm Klopp's future plans for Kolo, including expanding support beyond Django to other web frameworks like Flask and Fast API, and exploring the potential of a Colo Cloud for sharing traces and collaborating on code. He also addresses the question of open sourcing Kolo, suggesting that parts of it may become open source in the future.

Keywords

Kolo


Kolo is a visual studio code extension for Django that helps developers understand their code better. It visualizes the flow of code, showing how functions are called and how data is passed through them. It also provides a playground in the browser where users can edit code and see how the visualization changes. Kolo can also be used to generate integration tests, which are more valuable than unit tests for ensuring that code doesn't break by accident. Kolo is not entirely open source, but the creator is considering open sourcing parts of it in the future. He also discusses the possibility of a Colo Cloud, which would allow users to share traces and collaborate on code.

Django


Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It is a popular choice for building web applications, and it is known for its ease of use, scalability, and security features. Django is used by many popular websites, including Instagram, Pinterest, and Spotify.

VS Code


VS Code (Visual Studio Code) is a free and open-source code editor developed by Microsoft. It is a popular choice for developers because it is lightweight, fast, and highly customizable. VS Code supports a wide range of programming languages and has a rich ecosystem of extensions that add features and functionality.

Integration Tests


Integration tests are a type of software testing that verifies the interactions between different components of a system. They are designed to test the flow of data and functionality across multiple modules or layers of an application. Integration tests are important for ensuring that the different parts of a system work together as expected.

Simple Poll


Simple Poll is a Slack app built using Django that allows users to create and run polls within Slack. It is a popular app that has been used by many teams to make decisions, gather feedback, and engage with their members.

Slack


Slack is a popular messaging platform that is used by businesses and teams to communicate and collaborate. It offers a variety of features, including instant messaging, file sharing, and video conferencing. Slack is known for its user-friendly interface and its ability to integrate with other applications.

PyDiode


PyDiode is a Python interpreter that runs in the browser using WebAssembly. It allows developers to run Python code directly in the browser, without the need for a server-side component. PyDiode is a powerful tool for building interactive web applications and for experimenting with Python code in a sandbox environment.

WebAssembly


WebAssembly (Wasm) is a low-level bytecode format that can be run in web browsers. It is designed to be a fast and efficient way to execute code in the browser, and it is supported by all major browsers. WebAssembly is used to run a variety of applications in the browser, including games, video editors, and scientific simulations.

Code Coverage


Code coverage is a metric that measures the percentage of code that is executed by tests. It is a useful indicator of the quality of a test suite, as it shows how much of the code is being tested. High code coverage is generally considered to be a good thing, as it indicates that the code is being thoroughly tested.

LLM


LLM stands for Large Language Model. LLMs are a type of artificial intelligence (AI) that are trained on massive amounts of text data. They are capable of generating human-quality text, translating languages, writing different kinds of creative content, and answering your questions in an informative way.

Q&A

  • What is Kolo and what does it do?

    Kolo is a visual studio code extension for Django that helps developers understand their code better. It visualizes the flow of code, showing how functions are called and how data is passed through them. It also provides a playground in the browser where users can edit code and see how the visualization changes.

  • How does Kolo generate integration tests?

    Kolo uses the trace data it captures to automatically create integration tests. It inverts the traces, turning the actions taken in a request into test steps. This includes setting up test data, making requests, and asserting the results.

  • What are the benefits of integration tests over unit tests?

    Integration tests are more valuable than unit tests for ensuring that code doesn't break by accident. They test the interactions between different components of a system, providing a more comprehensive view of how the code works together.

  • What are Wilhelm Klopp's future plans for Kolo?

    Klopp plans to expand Kolo's support beyond Django to other web frameworks like Flask and Fast API. He is also exploring the possibility of a Colo Cloud, which would allow users to share traces and collaborate on code. He is considering open sourcing parts of Kolo in the future.

  • What is the business model for Kolo?

    Kolo is not entirely open source, and Klopp is working on a sustainable business model for it. He believes that test generation capabilities could be a key feature for a premium or enterprise version of Kolo.

  • What is the current state of Kolo's support for other editors besides VS Code?

    Kolo is currently only available for VS Code, but Klopp is working on a web-based version that will be available for all editors. He also mentions that Pie Charm support is a top request and is being considered for the future.

  • How does Kolo handle data privacy?

    Kolo is currently a fully local product, meaning that code and trace data never leave the user's system. However, Klopp is exploring the possibility of a Colo Cloud, which would require a different approach to data privacy.

  • What is the call to action for listeners interested in Kolo?

    Listeners are encouraged to check out Kolo.app and the playground at play.colo.app. They are also encouraged to email Klopp at w@colo.app if they are interested in increasing their test coverage or collaborating on Kolo.

  • What is the significance of Kolo's focus on Django?

    Django is a popular and influential web framework in the Python community. By focusing on Django, Kolo can reach a large and engaged audience of developers who are already familiar with the framework.

  • How does Kolo compare to other debugging tools?

    Kolo goes beyond traditional debugging tools by providing a more visual and interactive way to understand code flow. It also captures more detailed information, including the data returned by database queries, which can be helpful for debugging and testing.

Show Notes

Do you want to look inside your Django request? How about all of your requests in development and see where they overlap? If that sounds useful, you should check out Kolo. It's a pretty incredible extension for your editor (VS Code at the moment, more editors to come most likely). We have Wilhelm Klopp on to tell us all about it.



Episode sponsors



Sentry Error Monitoring, Code TALKPYTHON

Talk Python Courses



Links from the show



Wil on Twitter: @wilhelmklopp

Kolo: kolo.app

Kolo's info repo: github.com

Kolo Playground: play.kolo.app

Generating tests with Kolo: kolo.app

Watch this episode on YouTube: youtube.com

Episode transcripts: talkpython.fm



--- Stay in touch with us ---

Subscribe to us on YouTube: youtube.com

Follow Talk Python on Mastodon: talkpython

Follow Michael on Mastodon: mkennedy
Comments 
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

#464: Seeing code flows and generating tests with Kolo

#464: Seeing code flows and generating tests with Kolo

Michael Kennedy (@mkennedy)