Skip to content

Commit

Permalink
Deploying to main from @ pyprojectx/pyprojectx@2c94ab0 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
houbie committed Nov 13, 2024
1 parent 2523035 commit 86c64ae
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 18 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


<link rel="icon" href="/assets/px.svg">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">



Expand Down
2 changes: 1 addition & 1 deletion config/aliases/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../../assets/px.svg">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">



Expand Down
2 changes: 1 addition & 1 deletion config/defaults/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../../assets/px.svg">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">



Expand Down
15 changes: 12 additions & 3 deletions config/scripts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../../assets/px.svg">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">



Expand Down Expand Up @@ -490,12 +490,21 @@ <h1 id="run-python-scripts">Run Python scripts<a class="headerlink" href="#run-p
<p>Logic that is too complex to embed in <em>pyproject.toml</em> can be written in Python scripts in the <em>bin</em> directory.
These can be called from aliases or from the command line with <code>pw &lt;script-name&gt;</code>.</p>
<p>The scripts run by default in the main tool context and hence can use all libraries installed in the main tool context.</p>
<p>To run a script in a different tool context, you need to define an alias:</p>
<p>To run a script in a different tool context, you either:</p>
<ul>
<li>define an alias:</li>
</ul>
<div class="highlight"><pre><span></span><code><span class="k">[tool.pyprojectx.aliases]</span>
<span class="c1"># run the generate-data script in the &#39;jupyter&#39; tool context</span>
<span class="n">generate-data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">cmd</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s1">&#39;generate-data&#39;</span><span class="p">,</span><span class="w"> </span><span class="n">ctx</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s1">&#39;jupyter&#39;</span><span class="w"> </span><span class="p">}</span>
</code></pre></div>
<p>The script directory can be changed with the <code>scripts_dir</code> option in <em>pyproject.toml</em>:</p>
<ul>
<li>or specify the <code>scripts_ctx</code> in <em>pyproject.toml</em> (see <a href="/recipes/#run-scripts-that-use-the-projects-packages">recipes</a>) :</li>
</ul>
<div class="highlight"><pre><span></span><code><span class="k">[tool.pyprojectx]</span>
<span class="n">scripts_ctx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">&quot;scripts&quot;</span>
</code></pre></div>
<p>The default script directory can be changed by specifying the <code>scripts_dir</code> in <em>pyproject.toml</em>:</p>
<div class="highlight"><pre><span></span><code><span class="k">[tool.pyprojectx]</span>
<span class="n">scripts_dir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">&quot;scripts&quot;</span>
</code></pre></div>
Expand Down
2 changes: 1 addition & 1 deletion config/tools/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../../assets/px.svg">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">



Expand Down
2 changes: 1 addition & 1 deletion dev-dependencies/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../assets/px.svg">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">



Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


<link rel="icon" href="assets/px.svg">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">



Expand Down
41 changes: 34 additions & 7 deletions recipes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


<link rel="icon" href="../assets/px.svg">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">



Expand Down Expand Up @@ -498,7 +498,16 @@
<li class="md-nav__item">
<a href="#github-actions" class="md-nav__link">
<span class="md-ellipsis">
Github actions
GitHub actions
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#run-scripts-that-use-the-projects-packages" class="md-nav__link">
<span class="md-ellipsis">
Run scripts that use the project's packages
</span>
</a>

Expand Down Expand Up @@ -577,7 +586,16 @@
<li class="md-nav__item">
<a href="#github-actions" class="md-nav__link">
<span class="md-ellipsis">
Github actions
GitHub actions
</span>
</a>

</li>

<li class="md-nav__item">
<a href="#run-scripts-that-use-the-projects-packages" class="md-nav__link">
<span class="md-ellipsis">
Run scripts that use the project's packages
</span>
</a>

Expand Down Expand Up @@ -757,11 +775,11 @@ <h2 id="build-scripts">Build scripts<a class="headerlink" href="#build-scripts"
This makes Poetry create a <code>.venv</code> in your project directory instead of somewhere in your home directory.
It makes it easier to locate files and to keep your system clean when removing the project.</p>
</div>
<h2 id="github-actions">Github actions<a class="headerlink" href="#github-actions" title="Permanent link">#</a></h2>
<p>By using the <code>pw</code> wrapper script, you can simplify your github actions:</p>
<h2 id="github-actions">GitHub actions<a class="headerlink" href="#github-actions" title="Permanent link">#</a></h2>
<p>By using the <code>pw</code> wrapper script, you can simplify your GitHub actions:</p>
<ul>
<li>no explicitly tool installations or docker images (for Python tools)</li>
<li>use the same commands and scripts in github actions as on your laptop</li>
<li>use the same commands and scripts in GitHub actions as on your laptop</li>
</ul>
<p>Some tips:</p>
<ul>
Expand Down Expand Up @@ -790,10 +808,19 @@ <h2 id="github-actions">Github actions<a class="headerlink" href="#github-action
</code></pre></div>
See Pyprojectx own <a href="https://github.com/pyprojectx/pyprojectx/blob/main/.github/workflows/build.yml">build</a>
and <a href="https://github.com/pyprojectx/pyprojectx/blob/main/.github/workflows/release.yml">release</a> workflows for a full example.</p>
<h2 id="run-scripts-that-use-the-projects-packages">Run scripts that use the project's packages<a class="headerlink" href="#run-scripts-that-use-the-projects-packages" title="Permanent link">#</a></h2>
<p>You can set up a tool context that includes the project code and dependencies by using an editable install.
Then you can make that context the default one for running scripts.</p>
<p><div class="highlight"><pre><span></span><code><span class="k">[tool.pyprojectx]</span>
<span class="n">scripts_ctx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">&quot;project&quot;</span>
<span class="c1"># install the current project in editable mode; this requires that your project is installable</span>
<span class="n">project</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;-e .&quot;</span><span class="p">]</span><span class="w"> </span><span class="c1"># you can add more dependencies here but editable installs are not locked (see note below)</span>
</code></pre></div>
Having a script <code>my-script.py</code> in the scripts directory, you can just run <code>px my-script</code> or even <code>px mS</code>.</p>
<h2 id="experiment-with-your-project-in-a-jupyter-notebook">Experiment with your project in a Jupyter notebook<a class="headerlink" href="#experiment-with-your-project-in-a-jupyter-notebook" title="Permanent link">#</a></h2>
<p>You can launch a notebook that has access to your project packages without the need to install anything upfront.</p>
<p><div class="highlight"><pre><span></span><code><span class="k">[tool.pyprojectx]</span>
<span class="c1"># install the current project in editable mode, together with jupyter</span>
<span class="c1"># install the current project in editable mode, together with jupyter; this requires that your project is installable</span>
<span class="n">jupyter</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;jupyterlab&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;-e .&quot;</span><span class="p">]</span>

<span class="k">[tool.pyprojectx.aliases]</span>
Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

Binary file modified sitemap.xml.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion usage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


<link rel="icon" href="../assets/px.svg">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.43">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.44">



Expand Down

0 comments on commit 86c64ae

Please sign in to comment.