<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jaime Olivares</title>
    <description>The latest articles on DEV Community by Jaime Olivares (@jaime_olivares).</description>
    <link>https://dev.to/jaime_olivares</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4227441%2F3664114e-d250-4d28-9fb8-fb17745f46cf.png</url>
      <title>DEV Community: Jaime Olivares</title>
      <link>https://dev.to/jaime_olivares</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jaime_olivares"/>
    <language>en</language>
    <item>
      <title>How to Manage Python Dependencies Natively inside C# Build Pipelines</title>
      <dc:creator>Jaime Olivares</dc:creator>
      <pubDate>Thu, 05 Nov 2026 02:02:50 +0000</pubDate>
      <link>https://dev.to/jaime_olivares/how-to-manage-python-dependencies-natively-inside-c-build-pipelines-5865</link>
      <guid>https://dev.to/jaime_olivares/how-to-manage-python-dependencies-natively-inside-c-build-pipelines-5865</guid>
      <description>&lt;p&gt;Python has a massive ecosystem of AI, machine learning, and data science libraries like PyTorch, NumPy, and Transformers. While libraries like PythonNET allow us to call Python from C#, managing the underlying environment setup can be tedious:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installing CPython runtimes across different target environments&lt;/li&gt;
&lt;li&gt;Restoring &lt;code&gt;pip&lt;/code&gt; packages and virtual environments&lt;/li&gt;
&lt;li&gt;Managing module search paths (&lt;code&gt;sys.path&lt;/code&gt;) and native &lt;code&gt;.dll&lt;/code&gt;/&lt;code&gt;.so&lt;/code&gt; binaries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To streamline this workflow, I built &lt;strong&gt;DotNetPip&lt;/strong&gt;, an open-source MSBuild integration that handles Python dependency resolution directly inside your standard &lt;code&gt;.csproj&lt;/code&gt; build target.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;Instead of running external environment setup scripts, you declare your Python packages directly inside your project file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ItemGroup&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;PythonPackage&lt;/span&gt; &lt;span class="na"&gt;Include=&lt;/span&gt;&lt;span class="s"&gt;"numpy"&lt;/span&gt; &lt;span class="na"&gt;Version=&lt;/span&gt;&lt;span class="s"&gt;"1.26.4"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;PythonPackage&lt;/span&gt; &lt;span class="na"&gt;Include=&lt;/span&gt;&lt;span class="s"&gt;"transformers"&lt;/span&gt; &lt;span class="na"&gt;Version=&lt;/span&gt;&lt;span class="s"&gt;"4.38.0"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/ItemGroup&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you run dotnet build, custom MSBuild tasks trigger behind the scenes to:&lt;br&gt;
Ensure the Python environment and pip dependencies are restored.&lt;br&gt;
Expose the environment in-process to your C# runtime.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Add the DotNetPip package from NuGet: &lt;code&gt;dotnet add package DotNetPip&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Declare your required Python dependencies in your .csproj.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;dotnet build&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The goal is to make using Python's AI/ML ecosystem feel like a first-class citizen inside the .NET toolchain without manual sidecar scripts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links &amp;amp; Resources
&lt;/h2&gt;

&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/jaime-olivares/DotNetPip" rel="noopener noreferrer"&gt;https://github.com/jaime-olivares/DotNetPip&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feedback, edge cases, and contributions are welcome!&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>python</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
