<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class=""><div dir="ltr" style="color: rgb(33, 33, 33); font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; line-height: 19.5px; widows: 1; background-color: rgb(255, 255, 255);" class=""><div style="font-family: 'helvetica neue', helvetica, arial, sans-serif;" class="">This ties into what I've been working on to fix <a href="https://github.com/pypa/pip/issues/988" style="color: rgb(126, 87, 194); z-index: 0; position: relative;" class="">the package dependency conflict resolution problem for pip</a>, actually:</div><div style="font-family: 'helvetica neue', helvetica, arial, sans-serif;" class=""><br class=""></div><div class=""><font face="helvetica neue, helvetica, arial, sans-serif" class="">You may be able to use a tool I wrote to </font><span style="font-family: 'helvetica neue', helvetica, arial, sans-serif; line-height: 1.5;" class="">automatically extract requirements from setup.py, without installing (knowing that setup.py is arbitrary code and that dependencies are not strictly static). I</span><span class=""> opted to go with an admittedly drastic method of patching pip 8 to extract dependency data from each source distribution it touches in download mode when called by my dependency scraper. I decided that in the absence of static requirements for source distributions, the best I could really do in practice was to parse requirements exactly the way pip does. If you want, you can run the scraper from my project, which is here (project itself still a WIP). In particular, if you install it and run <font face="Courier" class="">'</font></span><font face="Courier" class=""><span class="">python depresolve/scrape_deps_and_detect_conflicts.py "some-package-name(1.0.0)"</span><span class="">'</span></font><span style="font-family: 'helvetica neue', helvetica, arial, sans-serif; line-height: 1.5;" class="">, it'll spit out the dependencies to a json file for the sdist for version 1.0.0 of some-package-name (more instructions <a href="https://github.com/awwad/depresolve#instructions-for-use-scraper" style="color: rgb(126, 87, 194); z-index: 0; position: relative;" class="">here</a> - it can also operate with local sdists or indexes).</span></div><div style="font-family: 'helvetica neue', helvetica, arial, sans-serif;" class=""><span style="line-height: 1.5;" class=""><br class=""></span></div><font face="helvetica neue, helvetica, arial, sans-serif" class="">In my case, for pypa/pip:issue988, I needed to harvest mass dependency info to test a few different dependency conflict resolvers on. I'm working on writing up some of what I've learned and will probably end up recommending a basic integrated backtracking resolver within pip - probably an updated version of </font><a href="https://github.com/pypa/pip/pull/2716" style="font-family: 'helvetica neue', helvetica, arial, sans-serif; color: rgb(126, 87, 194); z-index: 0; position: relative;" class="">rbtcollins' backtracking resolver pip patches</a><font face="helvetica neue, helvetica, arial, sans-serif" class=""> (which I'd be happy to rework and send a PR to pip on, if Robert doesn't have the bandwidth for it).</font></div></span><span class=""><div dir="ltr" style="color: rgb(33, 33, 33); font-family: 'helvetica neue', helvetica, arial, sans-serif; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; line-height: 19.5px; widows: 1; background-color: rgb(255, 255, 255);" class=""><br class=""></div></span><div style="color: rgb(33, 33, 33); font-family: 'helvetica neue', helvetica, arial, sans-serif; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; line-height: 19.5px; widows: 1; background-color: rgb(255, 255, 255);" class="">Sebastien</div><div style="color: rgb(33, 33, 33); font-family: 'helvetica neue', helvetica, arial, sans-serif; font-size: 13px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; line-height: 19.5px; widows: 1; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Jun 3, 2016, at 09:58, Daniel Holth <<a href="mailto:dholth@gmail.com" class="">dholth@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Here is how you can write setup_requires and test_requires to a file, by adding a plugin to egg_info.writers in setuptools.</div><div class=""><br class=""></div><div class=""><a href="https://gist.github.com/dholth/59e4c8a0c0d963b019d81e18bf0a89e3" class="">https://gist.github.com/dholth/59e4c8a0c0d963b019d81e18bf0a89e3</a><br class=""></div><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Fri, Jun 3, 2016 at 9:29 AM Paul Moore <<a href="mailto:p.f.moore@gmail.com" target="_blank" class="">p.f.moore@gmail.com</a>> wrote:<br class=""></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" class="gmail_quote">On 3 June 2016 at 14:24, Christopher Baines <<a href="mailto:mail@cbaines.net" target="_blank" class="">mail@cbaines.net</a>> wrote:<br class="">
> On 03/06/16 14:19, Paul Moore wrote:<br class="">
>> On 3 June 2016 at 13:20, Christopher Baines <<a href="mailto:mail@cbaines.net" target="_blank" class="">mail@cbaines.net</a>> wrote:<br class="">
>>> I'm trying to write a script to get information about a source<br class="">
>>> distributions requirements (from the source distribution), but I'm not<br class="">
>>> sure how to access the tests_require and setup_requires that can<br class="">
>>> sometimes be found in the setup.py?<br class="">
>>><br class="">
>>> Apologies if this is really simple, and I've just missed the answer, but<br class="">
>>> I've searched for it a few times now, and not come up with anything.<br class="">
>><br class="">
>> If I understand what you're trying to achieve, the only way of getting<br class="">
>> the "final" information (i.e, what will actually get used to install)<br class="">
>> is by running the setup.py script. That's basically the key issue with<br class="">
>> the executable setup.py format - there's no way to know the<br class="">
>> information without running the script.<br class="">
>><br class="">
>> You may be able to get the information without doing a full install by<br class="">
>> using the "setup.py egg_info" subcommand provided by setuptools.<br class="">
>> That's what pip uses, for example (but pip doesn't look at<br class="">
>> tests_require or setup_requires, so you'd have to check if that<br class="">
>> information was available by that route).<br class="">
><br class="">
> As far as I can see (I checked setuptools and flake8), neither<br class="">
> tests_require or setup_requires are present in the egg_info metadata<br class="">
> directory.<br class="">
><br class="">
> Is there no way of getting setuptools to write the data out to a file?<br class="">
<br class="">
Maybe you could write your own command class? Or monkeypatch<br class="">
setuptools.setup() to write its arguments to a file?<br class="">
<br class="">
I don't know of any non-ugly way, though, sorry...<br class="">
Paul<br class="">
_______________________________________________<br class="">
Distutils-SIG maillist  -  <a href="mailto:Distutils-SIG@python.org" target="_blank" class="">Distutils-SIG@python.org</a><br class="">
<a href="https://mail.python.org/mailman/listinfo/distutils-sig" rel="noreferrer" target="_blank" class="">https://mail.python.org/mailman/listinfo/distutils-sig</a><br class="">
</blockquote></div></div></div>
_______________________________________________<br class="">Distutils-SIG maillist  -  <a href="mailto:Distutils-SIG@python.org" class="">Distutils-SIG@python.org</a><br class=""><a href="https://mail.python.org/mailman/listinfo/distutils-sig" class="">https://mail.python.org/mailman/listinfo/distutils-sig</a><br class=""></div></blockquote></div><br class=""></body></html>