Open triper1022 opened 3 years ago
Hey, thank you for your PR!
Please describe the use case a little bit more in detail. E.g. do you add the "from keras.layers import LSTM, Dropout, Dense" to your personal pyforest imports? What is the behavior of pyforest before your PR and after? Also, we would need some tests for the PR.
Hi~ Thanks for your reply.
E.g. do you add the "from keras.layers import LSTM, Dropout, Dense" to your personal pyforest imports? Yes, I did. I knew that in original project, the normal accepted formats are "import matplotlib.pyplot as plt" or "from sklearn.ensemble import GradientBoostingRegressor"
However, I know that we often would like to make the lines shorter, we usually write imports in one line with comma if they are in the same module. We don't write "from keras.layers import LSTM", "from keras.layers import Dropout", "from keras.layers import Dense" repeatedly. The similar situation also happens when using Python built-in modules. E.g., "import sys, os, re"
My PR is to split the string, "from keras.layers import LSTM, Dropout, Dense", and create 3 LazyImport instances as the original project, LSTM = LazyImport("from keras.layers import LSTM"), Dropout = LazyImport("from keras.layers import Dropout"), Dense = LazyImport("from keras.layers import Dense"), but users still can add their common use imports in ~/.pyforest/user_imports.py, like "from keras.layers import LSTM, Dropout, Dense" in one line.
Besides, I created 2 small personal features in my forked repo. If you have interest, welcome to glance at them. I wrote short description in readme file.
I think this project is useful for the users who often change their workplaces in different local machines, cloud IDEs, or projects. Thank you very much!
Thank you for your reply. Please also describe the behavior/spec of pyforest before and after your PR.
Hi @triper1022,
So you mentioned that your PR allows writing import statements like from keras.layers import LSTM, Dropout, Dense
to your personal pyforest imports.
Now, I'm wondering: If you open a fresh Notebook (with no imports written yet) and start using keras.layers.Dropout
for example (but not LSTM or Dense), what import statement will be added to the top of the Notebook?
Will it be
from keras.layers import LSTM, Dropout, Dense
from keras.layers import Dropout
Can you describe any other behavioural changes of pyforest coming with your PR?
Hi~
I found we often make multiple imports in one line like below from keras.layers import LSTM, Dropout, Dense.
Therefore, I rewrote the func., def _assign_imports_to_globals() to make this work. If you are free, please check it out.