[12:17:15] <frankier> Does anyone know how in a setup.py I'd require django-formtools if Django>=1.8, otherwise not require it?
[12:17:37] <frankier> Does setuptools allow for these type of requirements? Or is there another way I can deal with this issue?
[12:20:58] <mgedmin> you can't express such a dependency
[12:21:10] <mgedmin> will anything break if django-formtools is installed with django < 1.8?
[12:21:19] <ronny> frankier: no, thats not yet possible, its questionable if it would be supported anytime soon
[12:21:21] <mgedmin> you could conditionally not-import it or something
[12:22:52] <frankier> mgedmin, The problem is then Django < 1.7 can't be supported since formtools requires a newer version in its setup.py. I think I can work around it by shelling out, or just drop compatibility with older versions. Good to know there's not a better way.
[13:09:46] <frankier> pjdelport, Actually, it involves the test suite really, since it's just to test interoperability, but you saying that makes me realise I can just put it in tox.ini/the docs. Way less hassle about than importing pip and messing with importlib.
[13:10:16] <pjdelport> Ah, yes, that's definitely the kind of thing that belongs in tox.ini, for the relevant env definitions.
[15:57:33] <evanton> eww, nobody in #python told me about this channel
[15:57:55] <evanton> trying to setup nosetests setuptools command in a virtualenv. this is my setup.ini: https://dpaste.de/q09Q nose is installed in the virtualenv, 'nosetests' works, but 'python setup.py nosetests' says invalid command. what am I missing?
[16:17:58] <ronny> evanton: did you add a setup command class for nosetest?
[16:18:15] <ronny> evanton: also note, that for nose one usually uses a colector class plus setup.py test
[16:18:40] <ronny> personally i discourage people from nose (note that im a py.test contributor)
[16:18:45] <evanton> ronny: what do you mean by "setup command class"? I am not familiar, just been following the nose docs
[16:19:00] <evanton> well, I have heard good things about py.test, I've tried it, but I like nose more
[16:19:29] <ronny> evanton: to have a setup.py command you need to register it in some way
[16:19:41] <ronny> evanton: there is no default/builtin nosetest command
[16:20:07] <evanton> ronny: I am following https://nose.readthedocs.org/en/latest/api/commands.html
[16:20:08] <ronny> evanton: at least not without a setup_requires
[16:20:37] <evanton> it suggests having a [nosetests] section in setup.ini, which I did, as the pastebin link in my question shows
[16:20:57] <ronny> evanton: do you run setup.py with the system python or the virtualenv python?
[16:21:16] <ronny> evanton: also what version of nose did you install
[16:22:20] <Wooble> evanton: you can check with "which python"
[16:22:38] <evanton> Wooble: thanks, it's the virtualenv python
[16:24:48] <Wooble> evanton: does python -m nose.core do anything?
[16:25:57] <Wooble> evanton: also, do you really have a setup.ini instead of setup.cfg?
[16:27:36] <evanton> Wooble: my apologies. nose docs say setup.cfg, I have a setup.cfg. what I said above about setup.ini was a typo. this whole thing has got me dizzy, sorry
[16:28:10] <evanton> Wooble: python -m nose.core runs the tests, as well as nosetests
[16:29:39] <Wooble> evanton: what version of setuptools do you have?
[16:30:44] <evanton> if I do pip list inside the virtualenv, it tells me setuptools 18.0.1
[16:31:11] <Wooble> Huh. Well... I'm out of suggestions :(
[16:31:59] <evanton> I found this https://stackoverflow.com/questions/14969173/why-do-i-get-the-error-invalid-command-nosetests-when-i-run-nosetests-from-my
[16:32:02] <Wooble> Your setup.py is actually using setuptools and not distutils, right?
[16:32:06] <evanton> and the answers there just scared me
[16:33:11] <evanton> Wooble: I have "from distutils.core import setup" there, so I assume the answer is "no"?
[16:34:08] <Wooble> if you want setuptools, you need to import setup from setuptools instead...
[16:34:34] <evanton> Wooble: IIRC I used the python docs to teach myself how to write setup.py, can you suggest me a link to read more about using setuptools?
[16:35:28] <evanton> thanks for your patience, I'll read that, then try to switch to setup from setuptools and will be back if it still won't work
[16:42:21] <evanton> Wooble: my tests are running now, thank you!
[16:44:04] <Wooble> no problem. Sorry I didn't suggest that first (seemed too obvious :) )
[16:45:37] <evanton> and I had absolutely no reasons to suspect that was the problem, before I only used setup from distutils and it used to build tarballs just fine. I never ran tests with it and never used a virtualenv
[17:35:22] <evanton> setuptools question: I have a setup_requires line in setup.py, it tries to fetch requirements from pypi. how do I tell it to not go to pypi at all, but instead fetch stuff from a custom location that I provide?
[17:40:14] <pjdelport> evanton: Give "pip install" a different --index-url, or use a combination of --no-index and --find-links
[17:41:09] <pjdelport> If you really want to put it in your setup.py, you can do roughly the same thing as --find-links with dependency_links and --process-dependency-links
[17:41:13] <pjdelport> But that's kinda deprecated
[17:41:40] <evanton> pjdelport: here is a bit more context. all this happens inside a virtualenv. I have a pip.conf there that looks like https://dpaste.de/BefW
[17:41:54] <evanton> when I invoke pip directly - it goes to this custom location for stuff
[17:42:17] <evanton> yet when setup_requires gets processed - it still goes to pypi
[17:42:56] <pjdelport> Ah, yes, that happens at the setuptools level, before pip and virtualenv really.
[17:43:10] <pjdelport> (Because setuptools in general can't depend on them.)
[17:43:30] <evanton> well, I don't know the internals, I've just started to use this voodoo
[17:43:40] <pjdelport> The easiest way to deal with that in my experience is to manually pre-install the setup_requires dependencies into the virtualenv first, with pip.
[17:43:49] <pjdelport> Then setuptools will just use it.
[17:44:43] <pjdelport> Assuming you have a small and static set of setup_requires, that should remain pretty manageable.
[17:59:07] <evanton> pjdelport: bah, pip install coverage still works, even if I don't have it in my local pypi repo. how do I tell pip to not fall back to pypi at all? isn't having just a custom global index_url in pip.conf enough?
[18:12:08] <evanton> pjdelport: oh, I think I found the problem, it's my local pypiserver instance that is doing the fallback. I see it has an explicit command line option to disable it