Level Up in Python with Dependency Inversion and Entry Points

<p>Python programmers don&rsquo;t use Dependency Inversion (DI) enough. There are a number of reasons why not:</p> <ul> <li>It&rsquo;s tricky &mdash; it&nbsp;<em>inverts</em>&nbsp;certain intuitive understandings of code flow.</li> <li>Sometimes people do dependency&nbsp;<em>injection</em>&nbsp;and think they&rsquo;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&nbsp;YAGN I&rsquo;d, when it shouldn&rsquo;t.</li> </ul> <p>But dependency Inversion DI could save the code you&rsquo;re writing today from being obsolete in 2 years.</p> <p>What&rsquo;s more, Python has a fantastic native feature called&nbsp;Entry Points&nbsp;(supported by&nbsp;most&nbsp;packaging&nbsp;tools) that allows you to get a lot of extensibility out of Dependency Inversion,&nbsp;<em>easily.</em></p> <p>So here&rsquo;s what I plan to cover in this post:</p> <ul> <li><strong>What is Dependency Inversion</strong>&nbsp;(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&rsquo;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&rsquo;s a standard definition of the Dependency Inversion principle. It&rsquo;s absolutely correct, but when you&rsquo;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>