Releases: yjunechoe/ggtrace
ggtrace 0.3.4
Breaking changes
- The
.print
argument toggtrace()
is renamed toprint_output
to make its functionality more transparent.
New features
Several options for finer control over printing and formatting of output from ggtrace()
, in addition to the existing .print
argument:
-
ggtrace()
gets ause_names
argument. WhenTRUE
, it uses the names of the list of expressions passed totrace_exprs
as the names for the tracedump set tolast_ggtrace()
and added toglobal_ggtrace()
. -
ggtrace()
gets averbose
argument. WhenFALSE
, it suppresses the display of all non-message()
information, including information about which expression is evaluated where, as well as the output of those expressions when evaluated (which can be selectively suppressed with.print
for finer control).verbose
isTRUE
by default. -
Setting
options(ggtrace.suppressMessages = TRUE)
will also suppressmessages()
s about what method is being traced, whether a trace has been triggered on a method, whether there exists a persistent trace, etc. This information is very important so using this option is not recommended, but it has been made available. This option is set toFALSE
on package load. -
Setting
options(ggtrace.as_tibble = TRUE)
will return evaluated expressions as tibbles if the output is a data frame. Using this option may be convenient for interactive inspections but it is not recommended for testing or debugging (see related {ggplot2} Github issue). This option is set toFALSE
on package load.
Improvements
-
Tracedumps accumulated in
global_ggtrace()
are named after the method (+ hexadecimal ID) for ease of searching. (#31) -
Triggering of a trace is now informed via
message()
instead ofcat()
(#29)
Bug Fixes
ggtrace()
correctly throws an error whentrace_steps
is not ordered. This is checked after the negative index conversion, so something liketrace_steps = c(1, -1)
still works fine).
ggtrace 0.3.3
New features
-
New function
global_ggtrace()
which returns accumulated tracedumps fromggtrace()
. This is useful in conjunction withggtrace(once = FALSE)
for tracing a method that you expect will be called multiple times (ex:Stat$compute_group
gets triggered the same number of times as the number of groups in a panel). -
New function
clear_global_ggtrace()
which clearsglobal_ggtrace()
by setting it toNULL
.
Improvements
Bug Fixes
- Fixed a bug where the number of expressions passed to
trace_exprs
were allowed to be different from the number oftrace_steps
, causingggtrace()
to silently fail. This now throws an error.
ggtrace 0.3.2
Improvements
-
trace_exprs
argument can now take a named list of expressions -
Improved documentation for
ggbody()
-
More informative messages for
ggtrace()
andgguntrace()
Bug fixes
- No longer errors on exit when creating a persistence trace with
once = FALSE
ggtrace v0.3.1
Improvements
-
The unary functions
ggedit()
andgguntrace()
gain dynamic dots...
as the second argument, which gets ignored. This now makes it easy to call these function by modifying the call to an earlier{ggtrace}
function from the console or in other interactive contexts. -
Significant re-write of
ggbody()
for better error handling (#23)-
Aborts if method is not a call or is not of the accepted form, with specific error messages for each.
-
If a method doesn't exist in a parent, directs users to call
ggbody(, inherit = TRUE)
-
If the recursive search with
inherit = TRUE
fails, directs users to load all relevant packages -
Notifies if
inherit = TRUE
but method is defined for the object, not inherited
-
-
Better error handling for
gguntrace()
when the method is no longer being traced (#24)-
Uses the re-written
ggbody()
to validate the method -
Unlike
base::untrace()
, no longer errors if given a method not currently being traced. It now prints a message saying so instead
-
-
Standardization of messages printed by all
{ggtrace}
functions. Messages are now more informative and refer to the ggproto method in the callable formatggproto$method
.
ggtrace v0.3.0
Breaking changes
-
The
obj
argument is completely removed from all functions in the package. This introduces a constraint on
supplying methods as expressions, forcing users to be intentional about tracing ggproto methods, which
is desirable for safety reasons. This in turn also allows the functions to return more informative
messages, which was the main motivation for this breaking change.- Because the
obj
argument was only designed for compatibility with the
get("method", ggproto)
syntax for retrieving the function body of ggproto
methods, it should not affect interactive workflows. In fact, the shortform
method = ggproto$method
is more convenient and has always been recommended
for passing a ggproto method to{ggtrace}
functions.
- Because the
-
As a reminder, all functions that take the ggproto method in the
method
argument expects an
expression in the following forms (this part hasn't changed):ggproto$method
namespace::ggproto$method
namespace:::ggproto$method
Improvements
-
Accurate string conversion for ggproto objects (#9), made possible by the breaking change.
-
trace_steps
argument can now take negative indices (#22) and has better error handling for
out of range indices. -
Better deparsing for the internal function
split_ggproto_method()
. -
Added a Tips & Tricks section to the documentation for
ggtrace()
.
Bug fixes
- Internal variable
.store
renamed to.ggtrace_storage
to prevent overridingggplot2::.store
(#18)
ggtrace v0.2.0
Breaking changes
-
The
~line
keyword forggtrace()
is renamed to~step
for consistency with the argument nametrace_steps
(#14) -
For safety reasons, the
~step
keyword will now only be substituted for the expression at the current step only if~step
is by itself (i.e., is an exact match) (#16, #11).-
For example, `~step` will not be substituted if `quote(head(~step))` is passed to `trace_exprs`. Users are encouraged to return the method's environment with `quote(environment())` or interactively debug with `ggedit()` if they want to manipulate the expression.
-
-
The position of the
obj
argument ofggtrace()
has been moved from second to fourth, to allow for shortcuts likeggtrace(method = ..., 2:3, quote(data))
, which will evaluate and store the output of thedata
variable at the second and third steps of the method body. (#15)
New features
-
trace_exprs
argument ofggtrace()
is now optional. If not provided, defaults to~step
(#13) -
You can now tell
ggbody()
to (recursively) search for the method from its parents withinherit = TRUE
(#12)
Improvements
- Documentation for some of the functions now contain a Gotchas section for explanations of / solutions to common problems (#10)
ggtrace v0.1.2
New features
-
New function
gguntrace()
with the same syntax for specifying the ggproto method. -
ggtrace()
gains aonce = TRUE
argument, which can be set toFALSE
for persistent tracing
Bug fixes
- Fix bug in
ggtrace()
wherestep_deparsed
was being returned as a multi-length vector
ggtrace v0.1.1
New features
- New function
ggedit()
for interactive debugging via directly editing the source code.
Improvements
-
Refactored
ggtrace()
. The package now only depends on{rlang}
. -
Significant re-write to the readme / documentation