-
Notifications
You must be signed in to change notification settings - Fork 285
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
namespace vs standalone #1853
Comments
@lionel- as the main designer/implementer of the standalone file system, do you care to weigh in? Happy to get suggestions for things we should refine in usethis code or docs. |
I think this should have been fixed by #1789? Do you have the latest version of usethis @jonthegeek? |
Yes, I tried both latest dev and CRAN, but they're currently the same anyway I believe 😊. It adds rlang to Imports (in description), but that isn't enough; rlang needs to be added as a full |
oh I thought it'd do that automatically in the usethis imports section. |
I'll take another look, thanks for the report |
I think ideally we'd solve this by leveraging roxygen2 and adding Now I remember that I already tried this but ran into the issue that roxygen2 adds an @hadley Would it be reasonable to change roxygen2 so it ignores such self-import directives? |
I think we should just document this. I don't think it's worth putting a bunch of effort into |
Documentation would have covered my original issue. I wasn't sure if I was misunderstanding something, so telling me I was right would have covered it. |
# roxygen2 7.3.0 ## New features * `@docType package` now works more like documenting `"_PACKAGE"`, creating a `{packagename}-package` alias and clearly suggesting that you should switch to `"_PACKAGE"` instead (#1491). * `_PACKAGE` will no longer generate an alias for your package name if a function of the same name exists (#1160). * The NAMESPACE roclet now reports if you have S3 methods that are missing an `@export` tag. All S3 methods need to be `@export`ed (which confusingly really registers the method) even if the generic is not. This avoids rare, but hard to debug, problems (#1175). You can suppress the warning with `@exportS3Method NULL` (#1550). * The `NAMESPACE` roclet once again regenerates imports _before_ loading package code and parsing roxygen blocks. This has been the goal for a long time (#372), but we accidentally broke it when adding support for code execution in markdown blocks. This resolves a family of problems where you somehow bork your `NAMESPACE` and can't easily get out of it because you can't re-document the package because your code doesn't reload. ## Minor improvements and bug fixes * If you document a function from another package it is automatically imported. Additionally, if you set `@rdname` or `@name` you can opt out of the default `reexports` topic generation and provide your own docs (#1408). * Generate correct usage for S4 methods with non-syntactic class names. * The `ROXYGEN_PKG` env var provides the name of the package being documented (#1517). * `@describeIn foo` now suggests that you might want `@rdname` instead (#1493). It also gives a more informative warning if you use it with an unsupported type (#1490). * In `DESCRIPTION`, URLs containing escapes in `URL` and `BugReports` are now correctly handled (@HenningLorenzen-ext-bayer, #1415). Authors can now have multiple email addresses (@jmbarbone, #1487). * `escape_examples()` is now exported (#1450). * `@exportS3Method` provides the needed metadata to generate correct usage for S3 methods, just like `@method` (#1202). * `is_s3_generic()` now ignores non-function objects when looking for a candidate function. I believe this is closer to how R operates. * `@import` and friends are now ignored if they try to import from the package being documented. This is useful to add self-dependencies in standalone files meant to be used in other packages (r-lib/usethis#1853). * `@importFrom` throws a friendlier error if you try and import a non-existing functions (@MichaelChirico, #1409). * `@include` now gives an informative warning if you use a path that doesn't exist (#1497). * `@inherit` can now also inherit from `@format` (#1293).
I'm not certain if this is a usethis issue, or an rlang issue, or neither and I'm just not understanding something.
I'm experimenting with the new
use_standalone()
, and I immediately ran into confusion. Here's a ~reprex (it's package-creation-level so not really a fully independent reprex) to see what I'm seeing:Don't all the rlang functions in there either need to be namespaced or imported? I see that you're using that standalone in usethis, but I also see that you have
import(rlang)
in your NAMESPACE, so maybe that's masking this requirement? I also see that the namespacing was removed in rlang to avoid issues, maybe that helped to mask this issue?To avoid the loop of errors that the namespacing caused in rlang, does the
# imports: rlang (>= 1.1.0)
directive need to be taken as "add@import IMPORTPKGNAME
to PKGNAME-package.R"?If there's a simpler solution that I'm not seeing, please let me know!
The text was updated successfully, but these errors were encountered: