Support for build-and-run-time dependencies

When you say “via pep517”, do you mean specifically this python package?

I think for recent setuptools, if you put a requirement in setup_requires, and you’re using a PEP 517-aware frontend (like the pep517 package, or recent pip), then anything in setup_requires gets converted into get_requires_for_build_wheel. So… if I’m right, then either setup_requires should work for your use case, or else, if it doesn’t, then that might mean that you actually do need the expensive packages already installed before you can call hooks.get_requires_for_build_wheel().

1 Like

only at build-time or also at run-time?

I also need it at runtime but there install_requires works so that’s not an issue

So… if I’m right, then either setup_requires should work for your use case

setup_requires is fundamentally incompatible with Cython because it uses easy_install, and easy_install’s sandbox breaks the Cython compiler. (it makes assumptions about module unloading & reloading that don’t hold true for native code modules like Cython and mess up global state) Unless someone decides to undeprecate and actually fix it, it’s sadly not an option. edit: some more info on the setup_requires issue: https://github.com/cython/cython/issues/2730

edit2: unless that changed in recent setuptools of course. but hasn’t setup_requires been deprecated? what’s the alternative for the future? I’ve always been pointed back to build-system.requires when I asked about that

edit3: I actually made a setuptools ticket for this https://github.com/pypa/setuptools/issues/1742 but closed it because build-system.requires was suggested as an alternative and at the time I didn’t know that it had this metadata analysis duration issue. so maybe I should just reopen that ticket

That’s what I thought, too.

That specific statement is about setuptools. I don’t know what the setuptools project’s plans are for setup_requires, but the comment at the top of the build_meta code mentions it, so maybe they intend to (or already do) handle it in a more PEP 517 compatible way somehow.

Is setup_requires deprecated? I couldn’t see any mention of that in the setuptools documentation. As to fixing it, that’s something that would need to be raised on the setuptools tracker.

Overall, I think your issues here sound like they would be better explored on the setuptools tracker. If there’s something that needs a standards-level change, then that’s something that should be raised here, but I’d prefer it if the setuptools maintainers were able to confirm that they weren’t able to handle your requirements within the build tool before we escalated the discussion to standards that all build tools would be required to add support for.

1 Like

Is setup_requires deprecated?

So far, that appears to be the plan: https://github.com/pypa/setuptools/issues/1320#issuecomment-380093653 in favor of build-system.requires. I have now brought this up here in the hopes that this is reconsidered: https://github.com/pypa/setuptools/issues/1742#issuecomment-501609619

Overall, I think your issues here sound like they would be better explored on the setuptools tracker.

I agree, I kind of forgot setup_requires is even an option due to its deprecation. But it seems it might most sense to figure out if maybe it shouldn’t be deprecated on the setuptools issue tracker, or if there’s some other alternative I’m not aware of. Will let you know how things turn out

edit: corrected wrong link

Ok then, let’s move any further discussion on @jtt’s issue to https://github.com/pypa/setuptools/issues/1742.