Menu

📰
0

Single file Python CLIs when do you split, when do you keep it monolithic?

Reddit r/Python·u/Beneficial_String411·about 1 month ago
#p3OPmzI2
#file#single#monolithic#python#clis#article
Reading 0:00
15s threshold

Working on a tool that's grown to ~4000 LOC in one .py file. argparse + 18 subcommands, stdlib + pyyaml only. Tests are in a separate dir.

Single-file has been great for:

- Debugging (one file to grep)

- Distribution (one wheel, no package layout decisions)

- Onboarding contributors

But I'm starting to wonder if it's worth keeping monolithic at this size. What's your threshold for splitting? Is it LOC, or coupling, or "I can't navigate it anymore"?

Read More