Additional command line options via python -mbuild?

I think nowadays a common suggestion is to use environment variables instead of command line options. Something like:

MY_PROJECT_SETUP_PY_BUNDLE_DLLS=1 python -m build

And in the setup.py:

import os
import setuptools

BUNDLE_DLLS = os.getenv('MY_PROJECT_SETUP_PY_BUNDLE_DLLS')

# Do something with `BUNDLE_DLLS`

setuptools.setup(
    # ...
)

I have not had to deal with something like this personally so I will not risk providing possibly incorrect details. I am quite sure there have been a couple of similar questions on this forum before, maybe they can provide accurate details. Maybe these ones:

1 Like