Skip to content

Instantly share code, notes, and snippets.

@amrutnrp
Created December 1, 2025 02:18
Show Gist options
  • Select an option

  • Save amrutnrp/e8e8ab7761e47d4afb35dab2a29ff388 to your computer and use it in GitHub Desktop.

Select an option

Save amrutnrp/e8e8ab7761e47d4afb35dab2a29ff388 to your computer and use it in GitHub Desktop.
Python Application BKM

Best Known Methods (BKM) - for Python App development

Afte years of development in python, here are my go-to approaches for building any (desktop/ web) application.

Framework / Structure

+----------------------------+--------------------------------+
|  UI and File Management    | User management (if web-hosted)|
+----------------------------+--------------------------------+
           |              |            
           v              v            
+--------------+     +-------------+   
| Extraction / | --> | Processing  |  
| Compaction   |     |             |   
+--------------+     +-------------+   
           |              |            
           v              v         
+-------------------------------------------+
|       Subroutines / Small Functions       |
+-------------------------------------------+

Extract the Input files when

  • Big files requiring heavy libraries (e.g., Excel, SnP, PDF)
  • Files needing asynchronous handling (e.g., large CSV files and frequently cross-referenced)
  • Files with sparse data (e.g., sparse matrices)
  • Extract files into smaller-sized data objects

Data Storage

  • Extract and store in a lightweight, easily accessible format (e.g., Pickle)
  • Trim the data: keep it small, compact, and accurate
  • Ensure data writing is reliable and error-free

Encapsulation

  • Use objects for encapsulating data when:
    • Input and processing are large
  • e.g. - classes, import-able files in python

Modular Code

  • break tasks into as many moderately sized chunks as possible
  • Helps in debugging
  • Lets user focus on only one section, instead of getting overwhelmed
  • use subprocess, functions/subroutines

Use Web-Hosted Apps When

  • Tasks require small execution time but depend on large libraries
  • Libraries are not supported on all PCs (e.g., ARM Windows)

Processing Considerations

  • If processing takes a long time - Show a progress bar to keep the user informed

Use Deterministic Programming When

  • Data is sensitive and impacts cost or timeline
  • Always ask the user to verify the data

When to use AI

  • Use AI for:
    • For quick access to tutorials
    • Verify approaches and ideas
    • Understanding and implementing new domains (libraries, languages)
    • For new trends, explore forums and experiment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment