Have a look at pip-tools <a href="https:&#x2F;&#x2F;github.com&#x2F;nvie&#x2F;pip-tools" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nvie&#x2F;pip-tools</a> which does basically that and a bit more.