Fluidsim examples3/29/2024 Yes, an environment variable is not sufficient. How do you tag the wheels? How do you tell pip which version you want? How do you declare dependencies on this? For example, I guess it should not be very difficult to reproduce your example (build dependency depending on an environment variable) with get_requires_for_bdist_wheel but how? I find only the PEP on the web (maybe I was just not able to find the good resource) and this part Build backend interface is not simple. It would be good to provide somewhere simple but realistic examples of how to use these things. You mention get_requires_for_bdist_wheel and PEP 517. I would prefer something cleaner than using both requires plus setup_requires. I also read that there are potential problems with setup_requires. I understood pyproject.toml and the isolated builds were used in particular to avoid setup_requires and having to specify build dependencies in the file setup.py. I would definitely love to see support for something equivalent to Recommends-Dist (optional dependencies where the default is some flavor of “install it if you can”), which would make it easier to have a bunch of build variants that are selected either with extras or as a chain of fallbacks, but that’s just my own personal wish list. I don’t think there’s any good solution to the metadata/labeling problem that exists today. The real problems here are not about providing a mechanism to do this (as you can see, such a mechanism already exists), but more about recording metadata about it. X11234 (bdist_wheel): Attrs not imported. Pair it with an appropriate pyproject.toml, and you can use an environment variable to determine whether attrs is present while the wheel is built: (venv) $ pip install. If os.environ.get("BUILD_FLAG", None) = "1": You can already use setuptools to achieve this here’s an example setup.py: from setuptools import setup If you are building from source, what you want to do is available today, because PEP 517 has a mechanism for backends to dynamically provide build dependencies: get_requires_for_bdist_wheel. I don’t think you need any sort of dynamically produced pyproject.toml file. I hope someone here could give me some good advice. I know that it was a problem few months ago to add it in requires, but maybe it’s no longer a problem? Note also that mpi4py does not upload wheels on PyPI (as far as I understand it is for good reasons because mpi4py needs to be recompiled for different MPI implementations). I tried to read PEP 517/518 but I don’t understand how they apply to our needs. It seems to me that currently the brackets in pip install commands are not at all usable for this usage. Pip install fluidsim # wheel without extension and with no MPI support For example, in conda the fftw package ( ) is build as fftw-3.3.8-mpi_openmpi, fftw-3.3.8-mpi_mpich, fftw-3.3.8-nompi, etc.Ĭould it be possible to support things like pip install fluidsim # build with pythran as build dependency (or get the wheel if available) Unfortunately, all examples I see with pyproject.toml are very simple and I don’t see any mechanisms to specify options to build the same package in different ways (potentially with different build dependencies) so that it produce different wheels. However, I feel that soon having a pyproject.toml will be kind of mandatory to stay mainstream and get good behavior with many Python tools. Note that it is similar to how conda works (the package installed by a command depends on what was installed in the environment). Of course, it forbids the use of isolated build and therefore pyproject.toml. The solution we choose was to build differently depending of the result of import mpi4py and import pythran with try/except statements. I don’t enter in the details of why we need this because it’s going to be long to explain (I can do it if it is useful). My motivation is in particular about the fluidfft and fluidsim packages and we need to be able to build with and without Pythran and with and without MPI and mpi4py. For some packages, we really need to have different builds (producing different wheels), with different build dependencies.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |