AguaClara / aguaclara

An open-source Python package for designing and performing research on AguaClara water treatment plants.
https://aguaclara.github.io/aguaclara/
MIT License
24 stars 13 forks source link

Create an error message when using deprecated names such as expert_inputs.py instead of constants.py #30

Closed fletchapin closed 6 years ago

fletchapin commented 6 years ago

expert_inputs.py has become constants.py

added: optional_inputs.py

Need to write code that allows exp_inputs to be used if called (by making the current constants.py available to it, but send error messages to let the user know that the exp_inputs it is deprecated.

zoemaisel commented 6 years ago

@ethan92429 Where should we be writing this code? Should it be added to play.py or somewhere else to make sure that the warning is triggered correctly?

eak24 commented 6 years ago

@AguaClara/aide_design to warn when something is imported that shouldn't be, you need to put in a deprecation warning. Here's a little tutorial on it. Basically, just add this code whenever you want to push a warning:

import warnings
warnings.warn(This is the deprecation method",DeprecationWarning )

Now put this at the top of the expert_inputs.py, or whatever file you are deprecating.

zoemaisel commented 6 years ago

We added the warning to expert_inputs with an explanation that constants.py and optional_inputs.py will be used instead. This was tested and when the aide_design.play package imports (or when just expert_inputs is imported), the error message is shown.