4 ms·
The thing i have yet to reliably figure out is this (i live in the science part of python): without a setup.py, how do I: from Cython.Build import cythonize
by hprotagonist 7y ago
The thing i have yet to reliably figure out is this (i live in the science part of python):
without a setup.py, how do I:
from Cython.Build import cythonize
import numpy as np
import versioneer
setup(...,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
ext_modules=cythonize(extensions),
include_dirs=[np.get_include()],
...)
I'm 100% on board with not having executable configuration files, except that we've been happily abusing them for years now and there are a lot of edge cases that i rely on now.
- pdonis 7y agoAll of those setup options are now setup.cfg options: https://docs.python.org/3/distutils/configfile.html https://docs.python.org/3/distutils/configfile.html At least, that's supposed to be the case; I am not 100% certain that it always is. However, even so, AFAIK setup.cfg does not directly support using third-party libraries to compute the setup options, as your setup.py does. The only workaround I'm aware of for that if you want to get rid of setup.py is to have a separate script that generates setup.cfg using whatever libraries you need. However, I don't think that's the vision of the Python developers.
- hprotagonist 7y agoI get the idea -- but, how do I tell Cython "it's time to compile things now" from a file I can't execute?
- pdonis 7y ago> how do I tell Cython "it's time to compile things now" from a file I can't execute? It looks like there are ways to specify which build tools your package requires; I would assume Cython would be one of the tools that can be specified since it's been around a while and gets a lot of usage, but I don't know for sure.
- kevin_thibedeau 7y agoThere are lot that of options that setup.cfg doesn't support. "use_2to3" is one.
- takeda 7y agoI never needed it, but I see 2to3 options there [1], are they not working? [1] https://setuptools.readthedocs.io/en/latest/setuptools.html#options https://setuptools.readthedocs.io/en/latest/setuptools.html#...
- maxnoe 7y agopyproject.toml and setup.cfg can in some cases make a setup.py unnecessary. That does not mean you should not use it anymore if you have a good reason to use it. The ones you listed are examples. How ever, as explained in the article, you should still add the pyproject.toml