DataPlug Development Diary 01
Development Philosophy
- MVP, minimum viable product, fast iteration. Each iteration is a working version.
- Use AI for vibe coding.
System Features
The app can batch replace variables in txt, md, word and other files based on data in config files. Variable rules follow jinja2 syntax. For example, if config.ini has variable definition: company = Moomboss Using variable in txt, md, word files will replace it with Moomboss.
App Commands
Planned commands include:
dataplug -hShow help informationdataplug -vShow version informationdataplug aboutShow about informationdataplug create <project_name>Create projectdataplug check [project_name]Check project (default current directory)dataplug fresh [project_name]Replace files in project (default current directory)dataplug fresh [project_name] --configUse specified config file to replace variablesdataplug log [project_name]View logs (default current directory)dataplug notificationUpdate notifications
Technology Stack Selection
I want to use Python-based desktop app solutions, but most online solutions are outdated. Here are the desktop app solutions I tried. Initially with UI frameworks, I wanted to complete project creation, selection, config file editing, text preview in the UI. But during use, I found UI frameworks make local file display very difficult, much more complicated than WinForm development.
CustomTkinter
- CustomTkinter is a GUI framework based on Tkinter. But when I saw it doesn't even have native menu (needs tk menu), I had doubts about this UI framework. Maybe consider it after CLI version is complete.
DearpyGui
(DearPyGui)[https://dearpygui.readthedocs.io/en/latest/index.html] Can develop desktop apps and web apps with Python. First problem: Chinese text showed as garbled characters. Tried loading local fonts as online solutions suggested, but fonts were blurry and affected experience. Abandoned it.
pywebview
(pywebview)[https://pywebview.flowrl.com/] Framework includes browser, can make desktop apps with Python and JavaScript two-way calls. But I couldn't figure out how to arrange the UI, tried several versions and gave up. Now focus on CLI first, then consider UI solutions.
CLI Solution
AI recommended these solutions, I finally chose Typer solution. For programmers first, writing config files and jinja2 syntax variables already has some learning curve.
- argparse (Python standard library)
import argparse
parser = argparse.ArgumentParser(description='Example CLI tool')
parser.add_argument('--input', '-i', required=True, help='Input file')
parser.add_argument('--output', '-o', help='Output file')
parser.add_argument('--verbose', '-v', action='store_true', help='Verbose mode')
args = parser.parse_args()
print(f"Processing file: {args.input}")- Click (most popular)
import click
@click.command()
@click.option('--input', '-i', required=True, help='Input file')
@click.option('--output', '-o', help='Output file')
@click.option('--verbose', '-v', is_flag=True, help='Verbose mode')
def cli(input, output, verbose):
"""Example CLI tool"""
if verbose:
click.echo(f"Processing file: {input}")
click.echo("Operation completed")
if __name__ == '__main__':
cli()- Typer (type hints based, modern)
import typer
app = typer.Typer()
@app.command()
def process(input: str, output: str = None, verbose: bool = False):
"""CLI tool for processing files"""
if verbose:
typer.echo(f"Processing file: {input}")
typer.echo("Operation completed")
if __name__ == "__main__":
app()V0.1
2025-09-18 Used AI to complete project framework structure, implemented replacement function for txt, md and other text files. After pyinstaller packaging, runs well.