Closed awong234 closed 2 years ago
Thanks for the contribution. I've started a unit check run. On the whole, it seems like a useful enhancement, provided there are no regressions. A few questions:
Hello @torfason ! Thanks for the review -- I definitely consider this a draft at this point and will address your points.
Thanks!
I put a test package in the test_import directory, and added a line in test_from that installs the package to a tempdir, and then tries to reference the function inside using import::from
. All the tests pass locally on my end, let me know if there's anything I should revise. Thanks!
OK, I see build failures on Ubuntu, which is a bummer. Seems like it might be an intermittent issue with the rcmdcheck package on that platform. We can check again in a few days before doing more.
If the build checks get resolved, I'm leaning towards accepting this into the development edition (which is on the master branch), where it can get a bit of exposure to the real world. If nothing comes up it would then be included in an eventual 1.3 release to CRAN. @smbache do you have thoughts on this addition?
If we move forwards, I'd also like to see that the test package works with the unit tests, and to put in one or two tests for this use case.
Closing to trigger new check.
Close and reopen to trigger new check
I checked this out locally, all tests pass and look pretty good overall.
.gitignore
– and could it perhaps be installed in a different folder from the test files themselves? (the file is .../import/tests/test_import/packageToTest_0.1.0.tar.gz
)I've rebased it onto the tip of torfason/import, to include fixes to the GitHub check actions, and the check now passes there, see branch https://github.com/torfason/import/tree/prx/awong234-getNamespaceExports
Thoughts?
✓ | F W S OK | Context
✓ | 1 | Setting up custom test harness
✓ | 1 | test_basetemplate.R [0.7s]
⠏ | 0 | test_from.R
* installing *source* package ‘packageToTest’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (packageToTest)
✓ | 1 | test_from.R [2.6s]
✓ | 1 | test_into_and_here.R [1.0s]
✓ | 1 | test_module_directories.R [1.0s]
✓ | 1 | test_module_recursive.R [1.1s]
⠏ | 0 | List any skipped tests
On closer inspection:
test_import
dir (modules and such). One extra file is no problem.quiet=TRUE
in install.packages()
. I just did that minor change myself.Current state is in: https://github.com/torfason/import/tree/prx/awong234-getNamespaceExports
Great fix!
Fix has been applied to dev
branch (https://github.com/torfason/import/tree/dev)
These changes should now all be in the dev branch rticulate/import@dev (was manually merged), so I'm closing this PR.
Thanks so much for the contribution! (and holler if anything seems missing)
Issue
Assume:
data.table
is installed to this 'lib' directory.import
to load functions from data.table.Data.table was selected as a candidate because it has no dependencies.
import::from(.from = data.table, .library = 'lib', .all = TRUE)
does not load functions.Expected behavior
import::from(.from = data.table, .library = 'lib', .all = TRUE)
should load all of data.table's functions.Actual behavior
import::from(.from = data.table, .library = 'lib', .all = TRUE)
returns an errorError Details
Error traceback:
The antecedents to
loadNamespace
in the call stack do not allow library locations as arguments; when loadNamespace is called,lib.loc
can therefore only beNULL
.Solution
Move the call to
getNamespaceExports
afterloadNamespace
, so that the namespace is available at that time.Reprexes
Failure reprex
Created on 2021-11-29 by the reprex package (v2.0.1)
Success reprex
Created on 2021-11-29 by the reprex package (v2.0.1)
The installation of
import_1.2.1
is of course from my fork here.