Auto-formatting Python with Ruff in Gemini CLI
Learn how to set up a hook in Gemini CLI that uses Ruff to format and sort imports in your Python code every time it modifies a file.
Gemini CLI is a command-line tool for querying and editing codebases of any size. It can use tools like your shell, filesystem, Google Search, and has the ability to fetch websites and connect to Model Context Protocol (MCP) servers.
Here's how to install the tool (the free tier is very generous):
npm install -g @google/gemini-cli
gemini
Learn how to set up a hook in Gemini CLI that uses Ruff to format and sort imports in your Python code every time it modifies a file.
A prompt technique to stop Gemini CLI from rushing into implementation and instead discuss logic using annotated pseudocode.
Through a process of debugging and exploration with Gemini CLI, I turned a binary data file into a visualization that truly tells the story of my workout.
I wrote a language-agnostic script that creates a list of functions and classes in a codebase, improving Gemini CLI's ability to perform exploratory tasks and recognize existing code when implementing new functionality.
Teach Gemini CLI to write executable, single-file Python scripts with an inline
dependency block, a technique that lets you run scripts without having to run
pip install first.
I started with a binary .FIT file from my sports watch and used
Gemini CLI to parse it, explore the data, and generate insightful plots about my
run.
Here are three keyboard shortcuts for Gemini CLI that I use all the time.
A look at the inner workings of Gemini CLI to understand how it learns about a codebase, from the initial snapshot to on-demand learning with tools, and how you can provide context by mentioning files with @.
This week, I used Gemini CLI to generate scripts, and write code. Here are six practical tips that go beyond basic code generation.
Google Cloud's Python buildpack reads pyproject.toml directly, installs packages with uv on Python 3.14, and detects your web server entrypoint without a Dockerfile or Procfile.
Pass --no-build to gcloud beta run deploy to skip Cloud Build and deploy from your local directory to Cloud Run in seconds.
Cloud Run supports on-demand NVIDIA L4 and RTX PRO 6000 Blackwell GPUs, enabling fast, flexible, and cost-effective deployment of AI workloads with full scale-to-zero capabilities.