setup_requires with Cython?

Starting from 18.0 release of setuptools (released on 2015-06-23) it is possible to specify Cython in setup_requires and pass *.pyx modules sources for regular setuptools.Extension: from setuptools import setup, Extension setup( # … setup_requires=[ # Setuptools 18.0 properly handles Cython extensions. ‘setuptools>=18.0’, ‘cython’, ], ext_modules=[ Extension( ‘mylib’, sources=[‘src/mylib.pyx’], ), ], )

How to build a source distribution without using setup.py file?

This is a somewhat controversial topic, and the answer for the moment is that there is no one single tool that everyone agrees is the “right way” to build source distributions, nor what that tool would be. You can see a long thread about it on the Python Packaging discourse. I hesitate to give too … Read more

What keyword arguments does setuptools.setup() accept?

setuptools.setup() calls distutils.core.setup() and passes it’s own **kwargs as the only parameter, so any keywords that distutils accepts will also be accepted by setuptools. If we go look at distutils setup_keywords = (‘distclass’, ‘script_name’, ‘script_args’, ‘options’, ‘name’, ‘version’, ‘author’, ‘author_email’, ‘maintainer’, ‘maintainer_email’, ‘url’, ‘license’, ‘description’, ‘long_description’, ‘keywords’, ‘platforms’, ‘classifiers’, ‘download_url’, ‘requires’, ‘provides’, ‘obsoletes’, ) Most … Read more

How can I add post-install scripts to easy_install / setuptools / distutils?

It depends on how the user installs your package. If the user actually runs “setup.py install”, it’s fairly easy: Just add another subcommand to the install command (say, install_vim), whose run() method will copy the files you want in the places where you want them. You can add your subcommand to install.sub_commands, and pass the … Read more

How to obtain arguments passed to setup.py from pip with ‘–install-option’?

You need to extend the install command with a custom command of your own. In the run method you can expose the value of the option to setup.py (in my example I use a global variable). from setuptools.command.install import install class InstallCommand(install): user_options = install.user_options + [ (‘someopt’, None, None), # a ‘flag’ option #(‘someval=”, … Read more

What is the purpose of Python setuptools?

setuptools is a package used by many other packages to handle their installation from source code (and tasks related to it). It is generally used extensively for non-pure-Python packages, which need some compilation/installation step before being usable (think packages containing extensions written in C); setuptools factors away some of the most common operations used in … Read more

How to reference a requirements.txt in the pyproject.toml of a setuptools project?

Use dynamic metadata: [project] dynamic = [“dependencies”] [tool.setuptools.dynamic] dependencies = {file = [“requirements.txt”]} Note that this will use a requirements.txt–like syntax; each line must conform to PEP 508, so flags like -r, -c, and -e are not supported inside this requirements.txt. Additionally: If you are using an old version of setuptools, you might need to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)