Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ideas for allowing usage without setup.py #32

Closed
astrofrog opened this issue Oct 27, 2021 · 4 comments
Closed

Ideas for allowing usage without setup.py #32

astrofrog opened this issue Oct 27, 2021 · 4 comments

Comments

@astrofrog
Copy link
Member

I've been thinking into whether we can try and make it so that using setup.py is not required - one possible option to investigate would be to make use of https://setuptools.pypa.io/en/latest/userguide/extension.html#customizing-distribution-options to add extensions to the Distribution object. Since all that extension-helpers really does is:

from extension_helpers import get_extensions
...
setup(..., ext_modules=get_extensions())

why not simply use the entry point above and assign Distribution.ext_modules?

@embray
Copy link
Member

embray commented Oct 29, 2021

That sounds feasible. setuptools.finalize_distribution_options is new I think (at least to me).

I also supplied this proposal some time ago, but haven't had a chance to act on it: pypa/setuptools#2220

However, that may not be sufficient for some extension modules that need some programmatic configuration. There's no generic standard, e.g. for getting things like the path to numpy includes.

@astrofrog
Copy link
Member Author

astrofrog commented Oct 29, 2021

I was also thinking about how we might define extensions in e.g. setup.cfg or another file - and stumbled on the same conceptual problem of not being sure how to deal with numpy.get_include_path but then I realised that if it's too difficult to implement in setuptools, there's no reason extension-helpers can't have its own way of defining extension modules in setup.cfg or another file and have e.g. a numpy_include=true/false option (since it's up to us what options to define in extension-helpers and we can be more opinionated than setuotools). This would allow us to be able to get rid of the setup_package.py files in a number of packages I believe (it might be a stretch for astropy though).

@Cadair
Copy link
Member

Cadair commented Nov 2, 2021

I think with this approach extension_helpers could have as many or as few setup.cfg sections as we want, so I see no reason why we couldn't come up with a scheme which works?

@astrofrog
Copy link
Member Author

#33 has been merged and supports enabling extension-helpers via setup.cfg with no changes required to setup_package.py files!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants