Contributing to duckplyr
Source:.github/CONTRIBUTING.md
This outlines how to propose a change to duckplyr. For a detailed discussion on contributing to this and other tidyverse packages, please see the development contributing guide and our code review principles.
Fixing typos
You can fix typos, spelling mistakes, or grammatical errors in the documentation directly using the GitHub web interface, as long as the changes are made in the source file. This generally means you’ll need to edit roxygen2 comments in an .R
, not a .Rd
file. You can find the .R
file that generates the .Rd
by reading the comment in the first line.
Bigger changes
If you want to make a bigger change, it’s a good idea to first file an issue and make sure someone from the team agrees that it’s needed. If you’ve found a bug, please file an issue that illustrates the bug with a minimal reprex (this will also help you write a unit test, if needed). See our guide on how to create a great issue for more advice.
Pull request process
Fork the package and clone onto your computer. If you haven’t done this before, we recommend using
usethis::create_from_github("tidyverse/duckplyr", fork = TRUE)
.Install all development dependencies with
devtools::install_dev_deps()
, and then make sure the package passes R CMD check by runningdevtools::check()
. If R CMD check doesn’t pass cleanly, it’s a good idea to ask for help before continuing.Create a Git branch for your pull request (PR). We recommend using
usethis::pr_init("brief-description-of-change")
.Make your changes, commit to git, and then create a PR by running
usethis::pr_push()
, and following the prompts in your browser. The title of your PR should briefly describe the change. The body of your PR should containFixes #issue-number
.Please do not edit
NEWS.md
.
Code style
New code should follow the tidyverse style guide. You can use the styler package to apply these styles, but please don’t restyle code that has nothing to do with your PR.
We use roxygen2, with Markdown syntax, for documentation.
We use testthat for unit tests. Contributions with test cases included are easier to accept.
New translations for functions
For all functions used in dplyr verbs, translations must be provided. The code lives in translate.R
. New translations must change code in two places:
The
switch()
inrel_find_call()
needs a new entry, together with the package that is home to the function. The top 60 functions, ranked by importance, are already part of thatswitch()
, as a comment if they are not implemented yet.The actual translation must be implemented in
rel_translate_lang()
. This is easy for some functions that have similar functions that are already translated, but harder for others. This part of the code is not very clear yet, in particular, argument matching by name is only available for a few functions but should be generalized.-
Test your implementation in the console with code of the form:
rel_translate(quo(a + 1), data.frame(a = 1)) |> constructive::construct()
Add a test for the new translation to the
mutate =
section oftest_extra_arg_map
in00-funs.R
. (At some point we want to have more specific tests for the translations, for now, this is what it is.)Run
03-tests.R
, commit the changes to the generated code to version control.
Support more options for verbs
All verbs wrap the code in a rel_try({})
call and fall back to dplyr in the case of failure. The rel_try()
function takes named arguments that describe conditions for an early drop-out, and the corresponding error message. To add support for a condition for which a drop-out is being defined, roughly the following steps are necessary:
- Remove the drop-out condition.
- Run the tests, take note of the failures.
- Provide an implementation that fixes the failures.
- Add a test that the verb works with
DUCKPLYR_FORCE = TRUE
under the new conditions. - Run
02-duckplyr_df-methods.R
to update the corresponding patch file.
Code of Conduct
Please note that the duckplyr project is released with a Contributor Code of Conduct. By contributing to this project you agree to abide by its terms.