Python: How to specify optimization level for entry_points usng setuptools?

Viewed 224

I have a setup.py file which I use to create wheel distribution for my package. The setuptools.setup() function creates an entry_point, which enables the user to run my program directly from the command line.

The setup.py file looks something like this:

import setuptools

setuptools.setup(
    ...
    entry_points={"console_scripts": ["foo = foo.__main__:main"],},
    ...
)

I would also like to specify the optimization level (-O or -OO), so when a user would run the foo command, the program would start in optimized mode (meaning the __debug__ build-in constant would be set to False). Is this even possible to achieve? How?

0 Answers
Related