| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3244,8 +3244,10 @@ <h1 id="cli-pn">CLI (<code>pn</code>)<a class="headerlink" href="#cli-pn" title= | |||
| 3244 | 3244 | <h2 id="subcommands">Subcommands<a class="headerlink" href="#subcommands" title="Permanent link">¶</a></h2> | |
| 3245 | 3245 | <ul> | |
| 3246 | 3246 | <li><code>pn init [name]</code>: scaffold a new project (creates <code>app/</code>, | |
| 3247 | - <code>pythonnative.toml</code>, <code>.gitignore</code>). Flag: <code>--force</code> to overwrite | ||
| 3248 | - existing files. See <a href="../../guides/configuration/">Configuration</a>.</li> | ||
| 3247 | + <code>pythonnative.toml</code>, <code>.gitignore</code>). With a name it creates <code>./<name>/</code> | ||
| 3248 | + and scaffolds into it; without one it uses the current directory. | ||
| 3249 | + Flag: <code>--force</code> to overwrite existing files or scaffold into a | ||
| 3250 | + non-empty directory. See <a href="../../guides/configuration/">Configuration</a>.</li> | ||
| 3249 | 3251 | <li><code>pn doctor [android|ios]</code>: diagnose the local toolchain and validate | |
| 3250 | 3252 | <code>pythonnative.toml</code>. Exits non-zero when something will block a build.</li> | |
| 3251 | 3253 | <li><code>pn preview [component]</code>: render the app in a desktop (Tkinter) window | |
@@ -3279,7 +3281,9 @@ <h2 id="subcommands">Subcommands<a class="headerlink" href="#subcommands" title= | |||
| 3279 | 3281 | <p><code>pn</code> CLI: scaffold, diagnose, preview, run, and build PythonNative apps.</p> | |
| 3280 | 3282 | <p>The console script <code>pn</code> (declared in <code>pyproject.toml</code>) dispatches to:</p> | |
| 3281 | 3283 | <ul> | |
| 3282 | - <li><code>pn init [name]</code>: scaffold a new project (<code>pythonnative.toml</code> + <code>app/</code>).</li> | ||
| 3284 | + <li><code>pn init [name]</code>: scaffold a new project (<code>pythonnative.toml</code> + | ||
| 3285 | + <code>app/</code>) into <code>./name/</code>, or into the current directory when no name | ||
| 3286 | + is given.</li> | ||
| 3283 | 3287 | <li><code>pn doctor [platform]</code>: diagnose the local toolchain and config.</li> | |
| 3284 | 3288 | <li><code>pn preview [component]</code>: render the app in a desktop (Tkinter) window | |
| 3285 | 3289 | with Fast Refresh, the fast inner dev loop, no device required.</li> | |
@@ -3324,7 +3328,7 @@ <h2 id="subcommands">Subcommands<a class="headerlink" href="#subcommands" title= | |||
| 3324 | 3328 | <td><code><a class="autorefs autorefs-internal" title="<code class="doc-symbol doc-symbol-heading doc-symbol-function"></code> <span class="doc doc-object-name doc-function-name">init_project</span> (<code>pythonnative.cli.pn.init_project</code>)" href="#pythonnative.cli.pn.init_project">init_project</a></code></td> | |
| 3325 | 3329 | <td> | |
| 3326 | 3330 | <div class="doc-md-description"> | |
| 3327 | - <p>Scaffold a new PythonNative project in the current directory.</p> | ||
| 3331 | + <p>Scaffold a new PythonNative project.</p> | ||
| 3328 | 3332 | </div> | |
| 3329 | 3333 | </td> | |
| 3330 | 3334 | </tr> | |
@@ -3484,9 +3488,20 @@ <h2 id="pythonnative.cli.pn.init_project" class="doc doc-heading"> | |||
| 3484 | 3488 | ||
| 3485 | 3489 | <div class="doc doc-contents "> | |
| 3486 | 3490 | ||
| 3487 | - <p>Scaffold a new PythonNative project in the current directory.</p> | ||
| 3488 | - <p>Creates <code>app/main.py</code>, <code>pythonnative.toml</code>, and <code>.gitignore</code>. | ||
| 3489 | - Refuses to overwrite existing files unless <code>--force</code> is passed.</p> | ||
| 3491 | + <p>Scaffold a new PythonNative project.</p> | ||
| 3492 | + <p>Given a name, this creates <code>./<name>/</code> and scaffolds into it. Without | ||
| 3493 | + one, it scaffolds into the current directory and names the project after | ||
| 3494 | + it. Either way it writes <code>app/main.py</code>, <code>pythonnative.toml</code>, and | ||
| 3495 | + <code>.gitignore</code>.</p> | ||
| 3496 | + <p>The name has to be a single directory name, so the project always lands | ||
| 3497 | + inside the current directory. Anything that reads as a path, such as | ||
| 3498 | + <code>a/b</code>, <code>..</code>, or <code>/tmp/app</code>, is refused, and so is a name that | ||
| 3499 | + resolves somewhere else, such as a symlink to another directory.</p> | ||
| 3500 | + <p>It won't scaffold into a target directory that already holds files, and it | ||
| 3501 | + won't overwrite any of the three paths above; pass <code>--force</code> to override | ||
| 3502 | + both. An existing but empty target directory is fine. A plain file at | ||
| 3503 | + <code>./<name></code> is always refused, since <code>--force</code> can't turn it into a | ||
| 3504 | + directory, and <code>--force</code> lifts neither of the rules above.</p> | ||
| 3490 | 3505 | ||
| 3491 | 3506 | ||
| 3492 | 3507 | <p><span class="doc-section-title">Parameters:</span></p> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3152,15 +3152,18 @@ <h1 id="getting-started">Getting Started<a class="headerlink" href="#getting-sta | |||
| 3152 | 3152 | </span></code></pre></div> | |
| 3153 | 3153 | <h2 id="create-a-project">Create a project<a class="headerlink" href="#create-a-project" title="Permanent link">¶</a></h2> | |
| 3154 | 3154 | <div class="language-bash highlight"><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a>pn<span class="w"> </span>init<span class="w"> </span>MyApp | |
| 3155 | + </span><span id="__span-1-2"><a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a><span class="nb">cd</span><span class="w"> </span>MyApp | ||
| 3155 | 3156 | </span></code></pre></div> | |
| 3156 | - <p>This scaffolds:</p> | ||
| 3157 | + <p>This creates a <code>MyApp/</code> directory containing:</p> | ||
| 3157 | 3158 | <ul> | |
| 3158 | 3159 | <li><code>app/</code> with a minimal <code>main.py</code></li> | |
| 3159 | 3160 | <li><code>pythonnative.toml</code>: your project configuration (app id, version, | |
| 3160 | 3161 | permissions, assets, and signing). See | |
| 3161 | 3162 | <a href="../guides/configuration/">Configuration</a>.</li> | |
| 3162 | 3163 | <li><code>.gitignore</code></li> | |
| 3163 | 3164 | </ul> | |
| 3165 | + <p>Run <code>pn init</code> without a name to scaffold into the current directory | ||
| 3166 | + instead, named after it.</p> | ||
| 3164 | 3167 | <p>A minimal <code>app/main.py</code> looks like:</p> | |
| 3165 | 3168 | <div class="language-python highlight"><pre><span></span><code><span id="__span-2-1"><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="kn">import</span><span class="w"> </span><span class="nn">pythonnative</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">pn</span> | |
| 3166 | 3169 | </span><span id="__span-2-2"><a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments