Level Up in Python with Dependency Inversion and Entry Points
<p>Python programmers don’t use Dependency Inversion (DI) enough. There are a number of reasons why not:</p>
<ul>
<li>It’s tricky — it <em>inverts</em> certain intuitive understandings of code flow.</li>
<li>Sometimes people do dependency <em>injection</em> and think they’ve done Dependency Inversion.</li>
<li>The benefits of DI are easily visible in mature codebases, but implementing DI in new code adds a level of abstraction that many programmers feel is cumbersome. It gets YAGN I’d, when it shouldn’t.</li>
</ul>
<p>But dependency Inversion DI could save the code you’re writing today from being obsolete in 2 years.</p>
<p>What’s more, Python has a fantastic native feature called Entry Points (supported by most packaging tools) that allows you to get a lot of extensibility out of Dependency Inversion, <em>easily.</em></p>
<p>So here’s what I plan to cover in this post:</p>
<ul>
<li><strong>What is Dependency Inversion</strong> (and what does it look like in Python)?</li>
<li><strong>What are Python Entry Points</strong>?</li>
<li><strong>How Do These Two Things Go Together?</strong></li>
</ul>
<p>If you’re a Dependency Inversion Champ and feel like you have a SOLID handle on the concept (get it?), feel free to skim down to the Entry Points section.</p>
<h1>What is Dependency Inversion<em>?</em></h1>
<h2>Definitions</h2>
<p>There’s a standard definition of the Dependency Inversion principle. It’s absolutely correct, but when you’re first learning about DI, it feels cryptic. Lets get it out of the way:</p>
<p><a href="https://johndanielraines.medium.com/level-up-in-python-with-dependency-inversion-and-entry-points-c648a1b087ee">Visit Now</a></p>