Standard plugins
July 28, 2026 ยท View on GitHub
Ariadne Codegen ships with optional plugins importable from the ariadne_codegen.contrib package:
-
ariadne_codegen.contrib.shorter_results.ShorterResultsPlugin- This plugin processes generated client methods for operations where only single top field is requested, so they return this field's value directly instead of operation's result type. For example get_user method generated for queryGetUser() { user(...) { ... }}will return value of user field directly instead ofGetUserResult. -
ariadne_codegen.contrib.extract_operations.ExtractOperationsPlugin- This extracts query strings from generated client's methods into separateoperations.pymodule. It also modifies the generated client to import these definitions. Generated module name can be customized by addingoperations_module_name="custom_name"to the[tool.ariadne-codegen.extract-operations]section in config. Eg.:[tool.ariadne-codegen] ... plugins = ["ariadne_codegen.contrib.extract_operations.ExtractOperationsPlugin"] [tool.ariadne-codegen.extract-operations] operations_module_name = "custom_operations_module_name" -
ariadne_codegen.contrib.client_forward_refs.ClientForwardRefsPlugin- This plugin changes generated client module moving all Pydantic models imports under theTYPE_CHECKINGcondition, making them forward references. This greatly improves the import performance of theclientmodule. -
ariadne_codegen.contrib.no_reimports.NoReimportsPlugin- This plugin removes content of generated__init__.py. This is useful in scenarios where generated modules contain so many Pydantic models that client's eager initialization of entire package on first import is very slow. -
ariadne_codegen.contrib.single_file_client.SingleFileClientPlugin- This plugin reads all the generated files, merge them into a single file, and removes the package. This can be useful for small clients with limited number of types and operations. The behavior can be customized as follows; see package file for details:[tool.ariadne-codegen] ... plugins = ["ariadne_codegen.contrib.single_file_client.SingleFileClientPlugin"] [tool.ariadne-codegen.single-file-client] output_file_name = "my_client.py" # default: client.py should_remove_package = false # default: true