Repository navigation
docs: add five-minute starter template #465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
codeforester
wants to merge
5
commits into
main
Choose a base branch
from
enhancement/244-20261023-five-minute-starter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9ace26b
docs: add five-minute starter template (#244)
codeforester 5017feb
fix: align starter and reference installs
codeforester 1584a65
test: update starter install assertion
codeforester 836db0b
style: satisfy starter template formatting gate
codeforester 7d0dc0d
style: normalize starter test imports
codeforester File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Starter template | ||
|
|
||
| The maintained starter is [`examples/minimal_cli`](../examples/minimal_cli/). | ||
| It is deliberately a copyable project rather than an interactive generator: | ||
| the first five minutes should expose the framework's public boundaries instead | ||
| of hiding them behind template machinery. | ||
|
|
||
| ## Five-minute proof | ||
|
|
||
| Copy the directory into a clean location and run the same commands a new | ||
| consumer would use: | ||
|
|
||
| ```bash | ||
| cp -R examples/minimal_cli my-cli | ||
| cd my-cli | ||
| python -m venv .venv | ||
| source .venv/bin/activate # Windows: .venv\Scripts\activate | ||
| python -m pip install --upgrade pip | ||
| python -m pip install -e ".[dev]" | ||
| base-minimal --name Ada | ||
| python -m pytest | ||
| ``` | ||
|
|
||
| The starter has no private-repository dependency and uses only the public | ||
| `base_cli` facade. Its tests cover a successful invocation, lifecycle help, | ||
| and the missing-option error boundary. The repository's example workflow | ||
| installs and tests it as an installed consumer as well. | ||
|
|
||
| ## What to customize | ||
|
|
||
| The command implementation belongs in | ||
| `src/minimal_cli/cli.py`; the package and console-script names belong in | ||
| `pyproject.toml`; product behavior belongs in `tests/` and `README.md`. | ||
| Keep `base_cli.run_app(app)` as the process boundary and do not import | ||
| framework-private modules. Add JSON, configuration, or optional integrations | ||
| only when the product needs them, following the corresponding contract docs. | ||
|
|
||
| The starter's `base-cli>=0.5.1,<1.0` requirement is a release-line guard for | ||
| the current pre-1.0 framework. It should be updated deliberately when the | ||
| consumer adopts base-cli 1.0. | ||
|
|
||
| ## Why there is no `base-cli init` command yet | ||
|
|
||
| The copyable starter is the 1.0 adoption surface. A generator would add a | ||
| second templating and upgrade contract before there is enough consumer | ||
| feedback to stabilize it. Interactive scaffolding remains a follow-up design | ||
| item; it must not become a hidden dependency of the core package. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| ROOT = Path(__file__).parents[1] | ||
| STARTER = ROOT / "examples" / "minimal_cli" | ||
| STARTER_DOC = ROOT / "docs" / "starter-template.md" | ||
|
|
||
|
|
||
| def test_starter_has_the_copyable_project_boundaries() -> None: | ||
| for relative in ( | ||
| "README.md", | ||
| "pyproject.toml", | ||
| "src/minimal_cli/cli.py", | ||
| "src/minimal_cli/__init__.py", | ||
| "tests/test_cli.py", | ||
| ): | ||
| assert (STARTER / relative).is_file(), relative | ||
|
|
||
|
|
||
| def test_starter_pins_the_current_pre_one_release_line() -> None: | ||
| metadata = (STARTER / "pyproject.toml").read_text(encoding="utf-8") | ||
| assert "base-cli>=0.5.1,<1.0" in metadata | ||
|
|
||
|
|
||
| def test_starter_docs_explain_copying_and_safe_customization() -> None: | ||
| text = STARTER_DOC.read_text(encoding="utf-8") | ||
| for required in ( | ||
| "examples/minimal_cli", | ||
| 'python -m pip install -e ".[dev]"', | ||
| "python -m pytest", | ||
| "base_cli.run_app(app)", | ||
| "no `base-cli init` command yet", | ||
| ): | ||
| assert required in text |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.