python-fire icon indicating copy to clipboard operation
python-fire copied to clipboard

Use fire without exposing private members

Open BillionsRichard opened this issue 5 years ago • 1 comments

import fire
class Calculator(object):

  def add(self, x, y):
    return x + y

  def multiply(self, x, y):
    return x * y

def _sub(self, x, y):# Privite method
   return x -y 

Now, i dont want to expose _sub method on cli, How can i do this. thanks..

BillionsRichard avatar Aug 28 '20 06:08 BillionsRichard

Private methods are hidden from view by default, but a user can access them by adding the --verbose flag to your CLI. There is not currently a supported way to prevent users from accessing private members altogether. We may support this in a future version, but don't currently.

dbieber avatar Sep 03 '20 03:09 dbieber