Is it possible to express a platform-specific dependency in setup.py without building platform-specific versions of my egg?

For sdist, egg and wheel release from : https://setuptools.readthedocs.io/en/latest/userguide/dependency_management.html#platform-specific-dependencies Sometimes a project might require a dependency to run on a specific platform. This could to a package that back ports a module so that it can be used in older python versions. Or it could be a package that is required to run on a … Read more

Managing resources in a Python project

You may want to use pkg_resources library that comes with setuptools. For example, I’ve made up a quick little package “proj” to illustrate the resource organization scheme I’d use: proj/setup.py proj/proj/__init__.py proj/proj/code.py proj/proj/resources/__init__.py proj/proj/resources/images/__init__.py proj/proj/resources/images/pic1.png proj/proj/resources/images/pic2.png Notice how I keep all resources in a separate subpackage. “code.py” shows how pkg_resources is used to refer to … Read more

Equivalent for `–find-links` in `setup.py`

In a setuptools context the dependency_links option should do what you need. According to setuptools documentation, this option accepts: the URLs of web pages that contain direct download links for example: setuptools.setup( # … dependency_links=[ “http://peak.telecommunity.com/snapshots/”, ], ) Important note regarding pip: Since its version 19.0, released on 2019-01-22, pip ignores the setuptools options dependency_links. … Read more

Add numpy.get_include() argument to setuptools without preinstalled numpy

First question, when is numpy needed? It is needed during the setup (i.e. when build_ext-funcionality is called) and in the installation, when the module is used. That means numpy should be in setup_requires and in install_requires. There are following alternatives to solve the issue for the setup: using PEP 517/518 (which is more straight forward … 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