0

These lines in setup.cfg setup leads to the creation of a script mydemo that will execute the run function of the module __main__:

[options.entry_points]
console_scripts =
    mydemo = mypackage.__main__:run

I would like mydemo to execute run with disabled asserts. Is there a way of doing this ?

Vince
  • 3,979
  • 10
  • 41
  • 69
  • `python -O` is the only way to disable asserts. See https://stackoverflow.com/a/56078190/7976758 Found in https://stackoverflow.com/search?q=%5Bpython%5D+disable+asserts – phd Mar 16 '22 at 11:53
  • @phd you may be correct, but I find it strange: in practice, this makes assert almost unusable for packaged python software. – Vince Mar 22 '22 at 13:18
  • @phd and also, ```python -0``` could be called by the ```mydemo``` script generated by the setuptools. I would not be crazy to imagine that this has been thought of. – Vince Mar 22 '22 at 13:20
  • That explains why `assert`s have so little usage. BTW it's letter `O` (from the word "optimize"), not digit `0`. – phd Mar 22 '22 at 13:38

0 Answers0