PythonAsia 2026

PythonAsia 2026

Fixit linter+AI coding
2026-03-21 , Teresa Yuchengco Auditorium (Main Hall)

This proposal introduces an innovative approach to Python code quality enforcement by combining fixit (a linting framework based on libcst) with generative AI to create custom linters tailored to team-specific coding standards.

Traditional linters like ruff provide general-purpose rules but struggle to address organization-specific requirements and coding conventions. This creates challenges where code review becomes subjective and dependent on individual reviewers' knowledge. Our solution leverages AI to generate fixit rules from natural language descriptions, dramatically reducing the barrier to creating and maintaining custom linting rules.

The core innovation lies in using libcst's Concrete Syntax Tree (CST) representation, which preserves formatting, comments, and whitespace—unlike traditional Abstract Syntax Trees (AST). This enables safe, automated code transformations that maintain the original code's style while enforcing new standards. By combining AI-assisted rule generation with fixit's powerful transformation capabilities, teams can quickly implement and enforce new coding standards across entire codebases, eliminating review subjectivity and accelerating modernization efforts.


Background and Motivation:

Organizations face diverse logging practices across different teams and projects. The industry trend shows increasing migration from Python's legacy logging module to structlog for better structured logging capabilities. However, existing general-purpose linters cannot adequately address organization-specific migration requirements and coding standards, leading to inconsistent code reviews and slow adoption.

The Custom Linter Approach:

Custom linters address three critical needs: (1) eliminating subjectivity in code reviews by codifying standards, (2) automatically enforcing "ideal patterns" defined by the organization, and (3) shifting from human-dependent review processes to machine-validated enforcement.

Technical Foundation - AST vs. CST:

The solution builds on libcst, which uses Concrete Syntax Trees (CST) rather than Abstract Syntax Trees (AST). While AST captures only structural information, discarding comments, whitespace, and formatting, CST preserves the complete source representation. This distinction is crucial for production environments where preserving existing code style and comments is essential for safe automated refactoring.

AI-Powered Rule Generation:

Developers can describe desired transformations in natural language (e.g., "Replace logging.getLogger usage with structlog.get_logger"), and AI generates corresponding fixit rules. This dramatically lowers the technical barrier for creating custom linters, enabling rapid iteration on coding standards.

Practical Implementation:

The presentation demonstrates a complete example: transforming

import logging
logger = logging.getLogger(__name__)

to

import structlog
logger = structlog.get_logger()

The generated fixit rule handles both import statements and function calls, ensuring comprehensive migration across codebases.


Category: Testing/Quality/Reliability Audience Level: Intermediate

I work as an engineer at Tokyo Gas Co., Ltd.
Tokyo Gas is a very old company with a 140-year history, but we are currently in the process of advancing DX by promoting in-house system development.