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

deploy: 3e78f6ea20084da0b5a419b17be5fa40e8575128 · pythonnative/pythonnative@4037731 · GitHub

Commit 4037731

Browse files
committed
deploy: 3e78f6e
1 parent 22fc3d5 commit 4037731

4 files changed

Lines changed: 55 additions & 12 deletions

File tree

‎api/cli/index.html‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3335,7 +3335,8 @@ <h2 id="subcommands">Subcommands<a class="headerlink" href="#subcommands" title=
33353335
<ul>
33363336
<li><code>pn init [name]</code>: scaffold a new project (creates <code>app/</code>,
33373337
<code>pythonnative.toml</code>, <code>.gitignore</code>). With a name it creates <code>./&lt;name&gt;/</code>
3338-
and scaffolds into it; without one it uses the current directory.
3338+
and scaffolds into it; the name must match <code>^[a-z][a-z0-9_-]*$</code>.
3339+
Without one it uses the current directory, whatever it's called.
33393340
Flag: <code>--force</code> to overwrite existing files or scaffold into a
33403341
non-empty directory. See <a href="../../guides/configuration/">Configuration</a>.</li>
33413342
<li><code>pn doctor [android|ios]</code>: diagnose the local toolchain and validate
@@ -3586,9 +3587,16 @@ <h2 id="pythonnative.cli.pn.init_project" class="doc doc-heading">
35863587
one, it scaffolds into the current directory and names the project after
35873588
it. Either way it writes <code>app/main.py</code>, <code>pythonnative.toml</code>, and
35883589
<code>.gitignore</code>.</p>
3589-
<p>The name has to be a single directory name, so the project always lands
3590-
inside the current directory. Anything that reads as a path, such as
3591-
<code>a/b</code>, <code>..</code>, or <code>/tmp/app</code>, is refused, and so is a name that
3590+
<p>A name you pass has to match <code>^[a-z][a-z0-9_-]*$</code>: lowercase letters,
3591+
digits, <code>-</code>, and <code>_</code>, starting with a letter. Anything else is
3592+
refused with a legal suggestion. That keeps the directory name and the
3593+
<code>name</code> field in the generated config identical, in the same spirit as
3594+
<code>flutter create</code> and <code>cargo new</code>. The name taken from the current
3595+
directory when you pass none is used as-is, so an existing directory
3596+
with any name still works.</p>
3597+
<p>The name also has to be a single directory name, so the project always
3598+
lands inside the current directory. Anything that reads as a path, such
3599+
as <code>a/b</code>, <code>..</code>, or <code>/tmp/app</code>, is refused, and so is a name that
35923600
resolves somewhere else, such as a symlink to another directory.</p>
35933601
<p>It won't scaffold into a target directory that already holds files, and it
35943602
won't overwrite any of the three paths above; pass <code>--force</code> to override

‎getting-started/index.html‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,19 +3241,21 @@ <h1 id="getting-started">Getting Started<a class="headerlink" href="#getting-sta
32413241
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>pn<span class="w"> </span>--help
32423242
</span></code></pre></div>
32433243
<h2 id="create-a-project">Create a project<a class="headerlink" href="#create-a-project" title="Permanent link">&para;</a></h2>
3244-
<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
3245-
</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
3244+
<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>my_app
3245+
</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>my_app
32463246
</span></code></pre></div>
3247-
<p>This creates a <code>MyApp/</code> directory containing:</p>
3247+
<p>This creates a <code>my_app/</code> directory containing:</p>
32483248
<ul>
32493249
<li><code>app/</code> with a minimal <code>main.py</code></li>
32503250
<li><code>pythonnative.toml</code>: your project configuration (app id, version,
32513251
permissions, assets, and signing). See
32523252
<a href="../guides/configuration/">Configuration</a>.</li>
32533253
<li><code>.gitignore</code></li>
32543254
</ul>
3255-
<p>Run <code>pn init</code> without a name to scaffold into the current directory
3256-
instead, named after it.</p>
3255+
<p>A name has to be lowercase letters, digits, <code>-</code>, and <code>_</code>, starting with
3256+
a letter, so the directory name and the <code>name</code> field in the generated
3257+
config stay identical. Run <code>pn init</code> without a name to scaffold into the
3258+
current directory instead, named after it; that name is used as-is.</p>
32573259
<p>A minimal <code>app/main.py</code> looks like:</p>
32583260
<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>
32593261
</span><span id="__span-2-2"><a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a>
@@ -3304,8 +3306,8 @@ <h2 id="configure-your-app">Configure your app<a class="headerlink" href="#confi
33043306
splash, third-party packages, and signing) lives in a single
33053307
<code>pythonnative.toml</code> at the project root:</p>
33063308
<div class="language-toml highlight"><pre><span></span><code><span id="__span-3-1"><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a><span class="k">[app]</span>
3307-
</span><span id="__span-3-2"><a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a><span class="n">id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"com.example.myapp"</span>
3308-
</span><span id="__span-3-3"><a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a><span class="n">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"myapp"</span>
3309+
</span><span id="__span-3-2"><a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a><span class="n">id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"com.example.my_app"</span>
3310+
</span><span id="__span-3-3"><a id="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a><span class="n">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"my_app"</span>
33093311
</span><span id="__span-3-4"><a id="__codelineno-3-4" name="__codelineno-3-4" href="#__codelineno-3-4"></a><span class="n">display_name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"My App"</span>
33103312
</span><span id="__span-3-5"><a id="__codelineno-3-5" name="__codelineno-3-5" href="#__codelineno-3-5"></a><span class="n">version</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"1.0.0"</span>
33113313
</span><span id="__span-3-6"><a id="__codelineno-3-6" name="__codelineno-3-6" href="#__codelineno-3-6"></a><span class="n">build</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span>

‎meta/troubleshooting/index.html‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,6 +3003,17 @@
30033003
</span>
30043004
</a>
30053005

3006+
</li>
3007+
3008+
<li class="md-nav__item">
3009+
<a href="#invalid-project-name-myapp" class="md-nav__link">
3010+
<span class="md-ellipsis">
3011+
3012+
Invalid project name: 'MyApp'
3013+
3014+
</span>
3015+
</a>
3016+
30063017
</li>
30073018

30083019
<li class="md-nav__item">
@@ -3461,6 +3472,17 @@
34613472
</span>
34623473
</a>
34633474

3475+
</li>
3476+
3477+
<li class="md-nav__item">
3478+
<a href="#invalid-project-name-myapp" class="md-nav__link">
3479+
<span class="md-ellipsis">
3480+
3481+
Invalid project name: 'MyApp'
3482+
3483+
</span>
3484+
</a>
3485+
34643486
</li>
34653487

34663488
<li class="md-nav__item">
@@ -3851,6 +3873,17 @@ <h3 id="refusing-to-treat-a-path-as-a-project-name-app"><code>Refusing to treat
38513873
lands inside the current directory. Pass a plain name like <code>my_app</code>, or
38523874
<code>cd</code> to the directory you want the project in and run <code>pn init</code> with no
38533875
name at all. <code>--force</code> doesn't lift this one.</p>
3876+
<h3 id="invalid-project-name-myapp"><code>Invalid project name: 'MyApp'</code><a class="headerlink" href="#invalid-project-name-myapp" title="Permanent link">&para;</a></h3>
3877+
<p>A name you pass to <code>pn init</code> has to match <code>^[a-z][a-z0-9_-]*$</code>: lowercase
3878+
letters, digits, <code>-</code>, and <code>_</code>, starting with a letter. That's the same
3879+
spirit as <code>flutter create</code> and <code>cargo new</code>, and it keeps the directory
3880+
name and the <code>name</code> field in the config identical. The error suggests a
3881+
legal name you can paste straight back, so <code>MyApp</code> suggests <code>myapp</code> and
3882+
<code>my app</code> suggests <code>my_app</code>. <code>--force</code> doesn't lift this one.</p>
3883+
<p>This applies only to a name you type. <code>pn init</code> with no name takes the
3884+
current directory's name as-is, so a directory called <code>MyProject</code> is
3885+
fine. To use a display name outside this set, edit <code>display_name</code> in
3886+
<code>pythonnative.toml</code> after scaffolding.</p>
38543887
<h3 id="refusing-to-scaffold-through-a-link-or-outside-the-current-directory-link"><code>Refusing to scaffold through a link or outside the current directory: link</code><a class="headerlink" href="#refusing-to-scaffold-through-a-link-or-outside-the-current-directory-link" title="Permanent link">&para;</a></h3>
38553888
<p>The name resolves somewhere other than a directory directly inside the
38563889
current one, so <code>pn init</code> stops rather than writing through it. A symlink

‎search/search_index.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL