FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

deploy: 5f84246da722ed077864dd060f3322d47ae4ee76 · pythonnative/pythonnative@ef4e5a6 · GitHub

Commit ef4e5a6

Browse files
committed
deploy: 5f84246
1 parent 2e21e7d commit ef4e5a6

6 files changed

Lines changed: 174 additions & 39 deletions

File tree

‎api/cli/index.html‎

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3244,8 +3244,10 @@ <h1 id="cli-pn">CLI (<code>pn</code>)<a class="headerlink" href="#cli-pn" title=
32443244
<h2 id="subcommands">Subcommands<a class="headerlink" href="#subcommands" title="Permanent link">&para;</a></h2>
32453245
<ul>
32463246
<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>./&lt;name&gt;/</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>
32493251
<li><code>pn doctor [android|ios]</code>: diagnose the local toolchain and validate
32503252
<code>pythonnative.toml</code>. Exits non-zero when something will block a build.</li>
32513253
<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=
32793281
<p><code>pn</code> CLI: scaffold, diagnose, preview, run, and build PythonNative apps.</p>
32803282
<p>The console script <code>pn</code> (declared in <code>pyproject.toml</code>) dispatches to:</p>
32813283
<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>
32833287
<li><code>pn doctor [platform]</code>: diagnose the local toolchain and config.</li>
32843288
<li><code>pn preview [component]</code>: render the app in a desktop (Tkinter) window
32853289
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=
33243328
<td><code><a class="autorefs autorefs-internal" title="&lt;code class=&quot;doc-symbol doc-symbol-heading doc-symbol-function&quot;&gt;&lt;/code&gt; &lt;span class=&quot;doc doc-object-name doc-function-name&quot;&gt;init_project&lt;/span&gt; (&lt;code&gt;pythonnative.cli.pn.init_project&lt;/code&gt;)" href="#pythonnative.cli.pn.init_project">init_project</a></code></td>
33253329
<td>
33263330
<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>
33283332
</div>
33293333
</td>
33303334
</tr>
@@ -3484,9 +3488,20 @@ <h2 id="pythonnative.cli.pn.init_project" class="doc doc-heading">
34843488

34853489
<div class="doc doc-contents ">
34863490

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>./&lt;name&gt;/</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>./&lt;name&gt;</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>
34903505

34913506

34923507
<p><span class="doc-section-title">Parameters:</span></p>

‎getting-started/index.html‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3152,15 +3152,18 @@ <h1 id="getting-started">Getting Started<a class="headerlink" href="#getting-sta
31523152
</span></code></pre></div>
31533153
<h2 id="create-a-project">Create a project<a class="headerlink" href="#create-a-project" title="Permanent link">&para;</a></h2>
31543154
<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
31553156
</span></code></pre></div>
3156-
<p>This scaffolds:</p>
3157+
<p>This creates a <code>MyApp/</code> directory containing:</p>
31573158
<ul>
31583159
<li><code>app/</code> with a minimal <code>main.py</code></li>
31593160
<li><code>pythonnative.toml</code>: your project configuration (app id, version,
31603161
permissions, assets, and signing). See
31613162
<a href="../guides/configuration/">Configuration</a>.</li>
31623163
<li><code>.gitignore</code></li>
31633164
</ul>
3165+
<p>Run <code>pn init</code> without a name to scaffold into the current directory
3166+
instead, named after it.</p>
31643167
<p>A minimal <code>app/main.py</code> looks like:</p>
31653168
<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>
31663169
</span><span id="__span-2-2"><a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a>

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL