<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Pip on KK's Blog (fromkk)</title><link>https://fromkk.com/tags/pip/</link><description>Recent content in Pip on KK's Blog (fromkk)</description><generator>Hugo</generator><language>en</language><managingEditor>bebound@gmail.com (KK)</managingEditor><webMaster>bebound@gmail.com (KK)</webMaster><lastBuildDate>Sun, 10 Aug 2025 18:44:06 +0800</lastBuildDate><atom:link href="https://fromkk.com/tags/pip/index.xml" rel="self" type="application/rss+xml"/><item><title>Modern pip build process (–-use-pep517)</title><link>https://fromkk.com/posts/modern-pip-build-process-use-pep517/</link><pubDate>Sun, 24 Nov 2024 20:49:00 +0800</pubDate><author>bebound@gmail.com (KK)</author><guid>https://fromkk.com/posts/modern-pip-build-process-use-pep517/</guid><description>&lt;p&gt;Nowadays, &lt;code&gt;pyproject.toml&lt;/code&gt; becomes the standard configuration file for packaging. Compare with the old &lt;code&gt;setup.py&lt;/code&gt;, it adds two feature pep517 and pep518.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://peps.python.org/pep-0517/" target="_blank" rel="noopener noreffer "&gt;pep517&lt;/a&gt; defines two hooks: &lt;code&gt;build_wheel&lt;/code&gt; and &lt;code&gt;build_sdist&lt;/code&gt;, which is required to build the package from source. Each build backend must implement these two hooks. It makes it possible to create other build backend such as &lt;code&gt;flit&lt;/code&gt; or &lt;code&gt;poetry&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-toml" data-lang="toml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[&lt;span style="color:#a6e22e"&gt;build-system&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Defined by PEP 518:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;requires&lt;/span&gt; = [&lt;span style="color:#e6db74"&gt;&amp;#34;flit&amp;#34;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Defined by this PEP:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;build-backend&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#34;local_backend&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;backend-path&lt;/span&gt; = [&lt;span style="color:#e6db74"&gt;&amp;#34;backend&amp;#34;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Besides &lt;code&gt;setuptools&lt;/code&gt;, there are some other build back-end such as &lt;code&gt;hatchling&lt;/code&gt; and &lt;code&gt;flit&lt;/code&gt;. You can find the example here: &lt;a href="https://packaging.python.org/en/latest/tutorials/packaging-projects/#choosing-a-build-backend" target="_blank" rel="noopener noreffer "&gt;Python Packaging Uer Guide - Choosing a build backend&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>