For setting up a development environment with specific package, specifically the ones cloned from git repo. the suggested method of installation maybe like the following:
Is the first command meant to be python setup.py develop instead? I have never seen anyone recommend installing with build_ext, and I don’t believe it does install.
python setup.py build_ext -i will build extension modules (ie modules written in C or C++, and Cython) in-place. This allows Python to import the package with those modules, as long as the package is already installed (via pip install -e DIR or python setup.py develop) or is available in Python’s path (sys.path or PYTHONPATH). This technically means that build_ext doesn’t actually install the package, but is one part of the build process
pip install -e DIR will use PIP to install the package as editable, which will build any extension modules (setup.py build_ext), perform any other build requirements, then install the package symbolically (setup.py develop) including its dependencies
But I’ve also noted that the python setup.py develop also will invoke the python setup.py build_ext instead of python setup.py build_ext -i. So, it seems that pip install -e DIR and python setup.py develop are equivalent in the final results for setting up the develop environment workflow – they both will create easy-install.pth files in the current python interpreter’s site-package directory which pointing to the DIR of the python package we want to installed here.
I will note that while they are basically equivalent, all direct invocations of python setup.py will be deprecated and/or removed as we add replacements for them, so you should definitely move to using pip install -e . and in general find replacements for any python setup.py invocations you find yourself making.
I think that is not the same as setup.py build for c-extension modules since the build directory is then part of the, by default, isolated build. Since the isolated build is done in a temporary directory it makes debugging more difficult than setup.py build install. Is there a way to use pyproject.yaml to avoid the default behaviour?
But it seems that the pip command cannot set the -j option for using the
python parallel build capability, which can be done with the python setup.py as following:
It is possible to pass command options to the setup function call (e.g. setup(name="...", options={"build_ext": {"inplace": True, "j": 24}})), or have the options in a setup.cfg file (section [build_ext] with lines inplace = true and j = 24). The problem is that these options are desirable for local dev, but they would also apply for anyone building from the sdist, which could be unwanted depending on the case.