-
-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to submodule are not reflected when reloading #165
Comments
See #39; unfortunately this is a long-standing bug that should hopefully be fixed at some point — unfortunately doing so is not trivial. |
Okay thanks. My understanding is that having the super/submodule setup is the only way to have more than one .r file in the same module. Is that correct? |
In general that’s correct, though your
|
Thank you. |
Apologies - I wanted to add one more question: What is your suggested workflow of developing 2 modules that work together?
If I work on A, and then need to fix something in B: Is the only way right now to reflect those changes in A to restart the R session? |
Ah, yes, I should probably have mentioned this above: You can manually flush the internal module cache. I wouldn’t generally recommend this, since it’s modifying implementation details; but it can serve as a workaround while the present bug exists. Internally, the package keeps track of loaded modules in an un-exported environment, [1] "/full/path/to/a/__init__.r" "/full/path/to/a/foo.r" You can manually delete the internal/nested module, and then reload the outer module: rm(list = '/full/path/to/a/foo.r', envir = modules:::loaded_modules)
modules::reload(a) Or you can choose the “nuclear” option and clear the entire list of loaded modules: rm(list = ls(modules:::loaded_modules), envir = modules:::loaded_modules)
a = modules::import('a') Beware that the latter option will break |
Thank you! |
Hi - I'm revisiting this package (it has come a very long way since we talked). I wanted to ask whether reloading submodules is still an issue or whether I'm doing something wrong with the new syntax. Like in your example in the documentation I have 3 files: (See code below.) ` b.R c.R ` |
Apologies, this is indeed still in the works, because a fix isn’t at all trivial. If you’re keen, you could try out PR #195, which is the draft implementation; the following should work for an installation from source: devtools::install_github('klmr/box@feature-reload-submodules') This should work with many (most?) scenarios, though it isn’t well tested yet. The major limitation is that reloading modules with native code might cause crashes under specific circumstances (but then, native code is not explicitly supported anyway). I should probably merge the PR quite soon so that people can experiment with it. Worst case, a subsequent release will roll it back. |
Thanks! I actually tried out your old suggestion with the nuclear option (and subsequent reload) Are there any new side-effects of doing this besides what you already mentioned to me? |
There are two other side effects:
|
Okay thanks! |
Hi,
I'm going through the utils-submodule example from the current documentation.
When changing the seq.R file and then reloading with either reload() or just rerunning import, the changes to the submodule are not reflected.
Is that the expected behavior? If so, how can I reload it?
(I can provide an example but literally all I did was to add one function to seq.R.)
The text was updated successfully, but these errors were encountered: