title: Pip install package prior to setup() in setup.py
body: <p>I have some <code>.proto</code> gRPC files I want to compile as part of the setup.py script. This requires running <code>from grpc_tools import protoc</code> and calling <code>protoc</code> <em>before</em> <code>setup(args)</code>. The goal is to compile and install the pb files from <code>pip install pkgname</code>. </p>
  
  <p>E.g. </p>
  
  <pre class="lang-py prettyprint-override"><code># setup.py
  
  # generate our pb2 files in the temp directory structure
  compile_protobufs(pkgname)
  
  # this will package the generated files and put them in site-packages or .whl
  setup(
      name=pkgname,
      install_requires=['grpcio-tools', ...],
      ...
  )
  </code></pre>
  
  <p>This works as intended, I get the pb files in my site-packages or in the wheel without them having to exist in the source folder. However, this pattern means I cannot naively <code>pip install pkgname</code> from scratch, as the step <code>compile_protobufs</code> depends on <code>grpcio-tools</code>, which does not get installed until <code>setup()</code>. </p>
  
  <p>I could use setup_requires, but <a href="https://www.python.org/dev/peps/pep-0518/" rel="nofollow noreferrer">that is on the chopping block</a>. I could just install the dependencies first (right now I use <code>RUN pip install -r build-require.txt &amp;&amp; pip install pkgname/</code> ), but it still seems like there ought to be a cleaner way. </p>
  
  <p>Am I even going about this pattern correctly or am I missing some packaging idiom? </p>
  
  <p>My criteria: </p>
  
  <ul>
  <li>Generally this is run inside a container, so minimizing external deps</li>
  <li>I want the <code>_pb2.py</code> files regenerated each time I <code>pip install</code></li>
  <li>These files need to also make their way into any <code>.whl</code> or tar. </li>
  </ul>