Skip to content

Commit

Permalink
Raise an error if force-included files are not found (#941)
Browse files Browse the repository at this point in the history
* error if force-include source is not found

* reorder release note

---------

Co-authored-by: Ofek Lev <ofekmeister@gmail.com> b6fb086
  • Loading branch information
ofek committed Nov 26, 2023
1 parent 835b77a commit 7963d09
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 231 deletions.
2 changes: 1 addition & 1 deletion dev/config/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</code></pre></div> </div> <div class=tabbed-block> <div class=highlight><pre><span></span><code><span class=k>[build.targets.wheel.force-include]</span>
<span class=s>&quot;../artifacts&quot;</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=s>&quot;pkg&quot;</span>
<span class=s>&quot;~/lib.h&quot;</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=s>&quot;pkg/lib.h&quot;</span>
</code></pre></div> </div> </div> </div> <div class="admonition note"> <p class=admonition-title>Note</p> <ul> <li>Files must be mapped exactly to their desired paths, not to directories.</li> <li>The contents of directory sources are recursively included.</li> <li>To map directory contents directly to the root use <code>/</code> (a forward slash).</li> <li>Sources that do not exist are silently ignored.</li> </ul> </div> <div class="admonition warning"> <p class=admonition-title>Warning</p> <p>Files included using this option will overwrite any file path that was already included by other file selection options.</p> </div> <h3 id=default-file-selection>Default file selection<a class=headerlink href=#default-file-selection title="Permanent link">&para;</a></h3> <p>If no file selection options are provided, then what gets included is determined by each <a href=#build-targets>build target</a>.</p> <h3 id=excluding-files-outside-packages>Excluding files outside packages<a class=headerlink href=#excluding-files-outside-packages title="Permanent link">&para;</a></h3> <p>If you want to exclude non-<a href=#artifacts>artifact</a> files that do not reside within a Python package, set <code>only-packages</code> to <code>true</code>:</p> <div class="tabbed-set tabbed-alternate" data-tabs=9:2><input checked=checked id=__tabbed_9_1 name=__tabbed_9 type=radio><input id=__tabbed_9_2 name=__tabbed_9 type=radio><div class=tabbed-labels><label for=__tabbed_9_1><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 16 16"><path d="M4 1.75C4 .784 4.784 0 5.75 0h5.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v8.586A1.75 1.75 0 0 1 14.25 15h-9a.75.75 0 0 1 0-1.5h9a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 10 4.25V1.5H5.75a.25.25 0 0 0-.25.25v2.5a.75.75 0 0 1-1.5 0Zm1.72 4.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l1.47-1.47-1.47-1.47a.75.75 0 0 1 0-1.06ZM3.28 7.78 1.81 9.25l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Zm8.22-6.218V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"/></svg></span> pyproject.toml</label><label for=__tabbed_9_2><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 16 16"><path d="M4 1.75C4 .784 4.784 0 5.75 0h5.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v8.586A1.75 1.75 0 0 1 14.25 15h-9a.75.75 0 0 1 0-1.5h9a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 10 4.25V1.5H5.75a.25.25 0 0 0-.25.25v2.5a.75.75 0 0 1-1.5 0Zm1.72 4.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l1.47-1.47-1.47-1.47a.75.75 0 0 1 0-1.06ZM3.28 7.78 1.81 9.25l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Zm8.22-6.218V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"/></svg></span> hatch.toml</label></div> <div class=tabbed-content> <div class=tabbed-block> <div class=highlight><pre><span></span><code><span class=k>[tool.hatch.build]</span>
</code></pre></div> </div> </div> </div> <div class="admonition note"> <p class=admonition-title>Note</p> <ul> <li>Files must be mapped exactly to their desired paths, not to directories.</li> <li>The contents of directory sources are recursively included.</li> <li>To map directory contents directly to the root use <code>/</code> (a forward slash).</li> <li>Sources that do not exist will raise an error.</li> </ul> </div> <div class="admonition warning"> <p class=admonition-title>Warning</p> <p>Files included using this option will overwrite any file path that was already included by other file selection options.</p> </div> <h3 id=default-file-selection>Default file selection<a class=headerlink href=#default-file-selection title="Permanent link">&para;</a></h3> <p>If no file selection options are provided, then what gets included is determined by each <a href=#build-targets>build target</a>.</p> <h3 id=excluding-files-outside-packages>Excluding files outside packages<a class=headerlink href=#excluding-files-outside-packages title="Permanent link">&para;</a></h3> <p>If you want to exclude non-<a href=#artifacts>artifact</a> files that do not reside within a Python package, set <code>only-packages</code> to <code>true</code>:</p> <div class="tabbed-set tabbed-alternate" data-tabs=9:2><input checked=checked id=__tabbed_9_1 name=__tabbed_9 type=radio><input id=__tabbed_9_2 name=__tabbed_9 type=radio><div class=tabbed-labels><label for=__tabbed_9_1><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 16 16"><path d="M4 1.75C4 .784 4.784 0 5.75 0h5.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v8.586A1.75 1.75 0 0 1 14.25 15h-9a.75.75 0 0 1 0-1.5h9a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 10 4.25V1.5H5.75a.25.25 0 0 0-.25.25v2.5a.75.75 0 0 1-1.5 0Zm1.72 4.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l1.47-1.47-1.47-1.47a.75.75 0 0 1 0-1.06ZM3.28 7.78 1.81 9.25l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Zm8.22-6.218V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"/></svg></span> pyproject.toml</label><label for=__tabbed_9_2><span class=twemoji><svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 16 16"><path d="M4 1.75C4 .784 4.784 0 5.75 0h5.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v8.586A1.75 1.75 0 0 1 14.25 15h-9a.75.75 0 0 1 0-1.5h9a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 10 4.25V1.5H5.75a.25.25 0 0 0-.25.25v2.5a.75.75 0 0 1-1.5 0Zm1.72 4.97a.75.75 0 0 1 1.06 0l2 2a.75.75 0 0 1 0 1.06l-2 2a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l1.47-1.47-1.47-1.47a.75.75 0 0 1 0-1.06ZM3.28 7.78 1.81 9.25l1.47 1.47a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-2-2a.75.75 0 0 1 0-1.06l2-2a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Zm8.22-6.218V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"/></svg></span> hatch.toml</label></div> <div class=tabbed-content> <div class=tabbed-block> <div class=highlight><pre><span></span><code><span class=k>[tool.hatch.build]</span>
<span class=n>only-packages</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=kc>true</span>
</code></pre></div> </div> <div class=tabbed-block> <div class=highlight><pre><span></span><code><span class=k>[build]</span>
<span class=n>only-packages</span><span class=w> </span><span class=o>=</span><span class=w> </span><span class=kc>true</span>
Expand Down
2 changes: 1 addition & 1 deletion dev/history/hatchling/index.html

Large diffs are not rendered by default.

Loading

0 comments on commit 7963d09

Please sign in to comment.