freebuff.com

Command Palette

Search for a command to run...

Refactor a Multi-File Python Project in Freebuff Desktop

Last updated: 11/2/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Refactor a Multi-File Python Project in Freebuff Desktop

Renaming a field used in many files is easy to get half right. This example asks Freebuff Desktop to rename one attribute across a small project, tests included, and to prove nothing was missed.

Quick answers

Can Freebuff Desktop change several files in one request? Yes. In this example one request changed five files.

Does it update the tests too? Yes, when you ask. The prompt names them.

How does it check it found everything? It searched the project for the old name, including keyword-argument uses, and ran the tests.

The project

shop/
  __init__.py
  models.py     # Item dataclass with price
  cart.py       # Cart.total() uses item.price
  pricing.py    # apply_sale() reads item.price
  receipt.py    # render() prints item.price
test_shop.py

Commit the starting point so the diff is easy to read, and confirm the tests pass:

git add -A && git commit -m base
python3 -m unittest
Ran 3 tests in 0.000s

OK

Ask for the rename

Open the folder in Freebuff Desktop, start a new chat and send:

Rename Item.price to unit_price everywhere in this project, including the tests and the receipt. Run the tests when done.

Freebuff listed what it changed:

- models.py: dataclass field renamed to unit_price
- cart.py: total() multiplies i.unit_price * i.quantity
- pricing.py: apply_sale() reads item.unit_price
- receipt.py: receipt line renders {i.unit_price:.2f}
- test_shop.py: sale assertion checks .unit_price
No price occurrences remain (verified with grep, including keyword-argument form).

It also pointed out that Item is built positionally everywhere here, so existing callers like Item("pen", 2.0, 3) keep working. The rename only breaks code that uses the field name.

Verify the result

git diff --stat
python3 -m unittest
 shop/cart.py    | 2 +-
 shop/models.py  | 2 +-
 shop/pricing.py | 2 +-
 shop/receipt.py | 2 +-
 test_shop.py    | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
Ran 3 tests in 0.000s

OK

Troubleshooting

Something outside the project uses the old name. Freebuff searches the project you opened. Search other repositories separately.

Reviewing the change. Read the diff. A rename changes only the identifier, so every line should differ by one word.


Tested in Freebuff Desktop 0.0.184 on 2026-10-30.

Related Articles