|
| 1 | +# Project Q&A |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +**quickforge** is a modern Python project bootstrapper that creates production-ready Python projects with a single command. It solves the problem of repetitive project setup by generating complete project structures with 2025's best toolchain already configured: uv for package management, ruff for linting/formatting, basedpyright for type checking, and pytest for testing. The target users are Python developers who want to start new projects quickly without spending hours configuring build tools, CI/CD pipelines, and development environments. |
| 6 | + |
| 7 | +## Key Features |
| 8 | + |
| 9 | +### 1. One-Command Project Creation |
| 10 | + |
| 11 | +Run `quickforge new myproject` and get a complete, working project with: |
| 12 | +- Proper package structure (src layout) |
| 13 | +- All tools configured in pyproject.toml |
| 14 | +- GitHub Actions CI/CD pipeline |
| 15 | +- Pre-commit hooks ready to install |
| 16 | +- VS Code settings optimized for the toolchain |
| 17 | +- Test skeleton with pytest and coverage |
| 18 | + |
| 19 | +### 2. Multiple Project Types |
| 20 | + |
| 21 | +I support five project types tailored to different use cases: |
| 22 | +- **library**: PyPI-publishable packages with src layout |
| 23 | +- **cli**: Command-line tools with Typer integration |
| 24 | +- **api**: FastAPI/Flask web services |
| 25 | +- **app**: Standalone applications |
| 26 | +- **script**: Single-file scripts with PEP 723 inline dependencies |
| 27 | + |
| 28 | +### 3. Interactive and Scriptable |
| 29 | + |
| 30 | +The CLI works in two modes: |
| 31 | +- **Interactive**: Prompts guide you through all options with descriptions |
| 32 | +- **Non-interactive**: Pass flags for CI/CD usage (`--yes` skips all prompts) |
| 33 | + |
| 34 | +### 4. Project Auditing |
| 35 | + |
| 36 | +The `quickforge audit` command analyzes existing projects and identifies: |
| 37 | +- Legacy tooling (black, flake8, mypy) that could be modernized |
| 38 | +- Missing type annotations and coverage |
| 39 | +- Configuration improvements |
| 40 | +- Security best practices |
| 41 | + |
| 42 | +### 5. Automated Migration |
| 43 | + |
| 44 | +The `quickforge upgrade` command migrates projects from: |
| 45 | +- Poetry/pip/pipenv/setuptools to uv |
| 46 | +- black/isort/flake8 to ruff |
| 47 | +- mypy to basedpyright |
| 48 | + |
| 49 | +It preserves comments and formatting in existing configuration files. |
| 50 | + |
| 51 | +### 6. Feature Addition |
| 52 | + |
| 53 | +Add optional features to existing projects with `quickforge add`: |
| 54 | +- github-actions: CI/CD workflow |
| 55 | +- docker: Dockerfile and docker-compose.yml |
| 56 | +- docs: MkDocs with Material theme |
| 57 | +- pre-commit: Git hooks configuration |
| 58 | +- vscode: IDE settings and extensions |
| 59 | +- devcontainer: Dev container for VS Code |
| 60 | + |
| 61 | +## Technical Highlights |
| 62 | + |
| 63 | +### Challenge: Comment-Preserving TOML Updates |
| 64 | + |
| 65 | +When upgrading projects, I needed to modify pyproject.toml without destroying users' carefully written comments and documentation. I solved this by using `tomlkit` instead of standard TOML libraries. tomlkit parses TOML into a document model that preserves whitespace, comments, and formatting, allowing surgical modifications. |
| 66 | + |
| 67 | +### Challenge: Cross-Platform Path Handling |
| 68 | + |
| 69 | +Template paths needed to work across macOS, Linux, and Windows. I used `pathlib.Path` throughout and carefully handled path separators in templates. The src layout path is dynamically computed based on project type. |
| 70 | + |
| 71 | +### Challenge: Atomic Project Generation |
| 72 | + |
| 73 | +If generation fails midway, users shouldn't be left with a broken partial project. I implemented cleanup logic that removes partially created directories on failure, and validation that verifies the generated project is syntactically correct before reporting success. |
| 74 | + |
| 75 | +### Innovation: Detection-Based Auditing |
| 76 | + |
| 77 | +Rather than requiring users to declare their tooling, the auditor automatically detects what tools are in use by checking for lock files, configuration sections, and tool-specific files. This zero-configuration approach means it works on any Python project. |
| 78 | + |
| 79 | +### Innovation: Template Condition System |
| 80 | + |
| 81 | +Templates are conditionally rendered based on project configuration. For example, `cli.py.j2` is only rendered for CLI projects, while `main.py.j2` is rendered for app and API projects. This keeps the generated code minimal and relevant. |
| 82 | + |
| 83 | +## Frequently Asked Questions |
| 84 | + |
| 85 | +### Q1: Why create another project scaffolding tool? |
| 86 | + |
| 87 | +I found that existing tools either generate outdated structures (using setup.py, black, mypy) or require significant configuration. I wanted a tool that embodies 2025 best practices out of the box, with zero configuration needed for the common case. quickforge generates exactly what I would set up manually for a new project. |
| 88 | + |
| 89 | +### Q2: Why uv instead of Poetry or pip? |
| 90 | + |
| 91 | +uv is 10-100x faster than pip and Poetry because it's written in Rust. It handles dependency resolution, virtual environments, and Python version management in one tool. The speed difference is noticeable on every operation, making development more pleasant. |
| 92 | + |
| 93 | +### Q3: Why ruff instead of black and flake8? |
| 94 | + |
| 95 | +ruff combines linting (flake8, pylint) and formatting (black, isort) into one tool that's 10-100x faster. Having one configuration section instead of three separate tools simplifies maintenance. ruff also has more rules and better autofix capabilities. |
| 96 | + |
| 97 | +### Q4: Why basedpyright instead of mypy? |
| 98 | + |
| 99 | +basedpyright is faster (3-5x), has better error messages, and integrates seamlessly with VS Code. It's stricter by default, which catches more bugs. The "based" fork adds additional checks beyond standard pyright. |
| 100 | + |
| 101 | +### Q5: Can I customize the generated templates? |
| 102 | + |
| 103 | +Currently, templates are bundled with the package and not user-customizable. This is intentional to ensure consistency and correctness. If you need significant customization, you can use quickforge as a starting point and modify the generated files, or fork the project. |
| 104 | + |
| 105 | +### Q6: Does quickforge support monorepos? |
| 106 | + |
| 107 | +Not currently. Each invocation creates a single project. For monorepos, I'd recommend using uv workspaces directly. This might be added in a future version. |
| 108 | + |
| 109 | +### Q7: How does the audit scoring work? |
| 110 | + |
| 111 | +The audit starts at 100 points and deducts based on findings: |
| 112 | +- Critical issues: -20 points |
| 113 | +- Errors: -10 points |
| 114 | +- Warnings: -5 points |
| 115 | +- Info: -1 point |
| 116 | + |
| 117 | +A score above 80 is considered healthy, 60-80 needs attention, and below 60 indicates significant technical debt. |
| 118 | + |
| 119 | +### Q8: What happens if the upgrade fails? |
| 120 | + |
| 121 | +Before making any changes, `quickforge upgrade` creates a timestamped backup of all configuration files in `.quickforge_backup_TIMESTAMP/`. If something goes wrong, you can restore from this backup. The upgrade also supports `--dry-run` to preview changes without applying them. |
| 122 | + |
| 123 | +### Q9: Why is the coverage requirement set at 80%? |
| 124 | + |
| 125 | +I believe 80% is a pragmatic target that encourages good testing habits without becoming burdensome. It allows for untested edge cases and configuration code while ensuring core functionality is covered. The threshold is configurable in the generated pyproject.toml. |
| 126 | + |
| 127 | +### Q10: How do I contribute to quickforge? |
| 128 | + |
| 129 | +The project is open source on GitHub. To contribute: |
| 130 | +1. Clone the repository |
| 131 | +2. Run `uv sync --extra dev` to install dependencies |
| 132 | +3. Run `uv run pre-commit install` to set up hooks |
| 133 | +4. Make changes and ensure `uv run pytest` passes |
| 134 | +5. Submit a pull request |
| 135 | + |
| 136 | +I welcome contributions for new project types, additional features, and bug fixes. |
0 commit comments