cole-brokamp/automagic

Add required packages to DESCRIPTION

Closed this issue ยท 8 comments

I really like automagic: It's my go-to package when I get random scripts from colleagues and want to get everything running fast. So thank you for your work here!

I wonder if you would consider adding a function that automatically adds/updates required dependencies in the DESCRIPTION file of an R package in ongoing development. I find myself sometimes working on package code and loosing track of the dependencies I use. Then it's useful to have a function that updates the DESCRIPTION accordingly.

I wrote some code for this purpose in rrtools (https://github.com/benmarwick/rrtools/blob/master/R/manage_dependencies.R), but I think it does not really belong there. It would fit better into a management package like automagic where the search for packages is already implemented.

What do you think? Could this feature become part of automagic?

Thanks for the kind words! That's funny you should bring this up, because I have been thinking about it a lot lately. I'm also wanting to move to DESCRIPTION files, rather than the deps.yaml used here. Its probably easier to conform to the R standard then to reinvent the wheel.

However, rather than deprecate the deps.yaml file functions for automagic, I've been working on another package (still not public on GH) that will scan the code for dependencies and add to the DESCRIPTION file. I eventually want to move the code that scans for packages from here to the newer package and leave automagic as is with the deps.yaml file to maintain backwards compatibility.

I'll ping you when its ready for you to take a look. I would love it if you could contribute and/or tell me more about your use cases over there. Stay tuned...

That's excellent news! Thank you very much - I'm looking forward to the result!

Let me just update to issues over at rrtools: 1 2

What about a deps.yaml to DESCRIPTION translator function? I could see that living inside automagic rather than a separate package. I'm a big fan of deps.yaml but I also feel there's some coalescing of agreement in the greater R community around using DESCRIPTION as a standard container for package and project metadata.

I agree 100%, @gadenbuie. I've definitely had the same thoughts. In addition, we could add an option to automagic::automagic() to use a DESCRIPTION file instead of a deps.yaml file, but keep the default set to deps.yaml. I was envisioning a make_desc_file() function for those that want to use the DESCRIPTION file. Any ideas on a function name for the translator function? deps_to_desc()??

I would love to have these functions in automagic!

One important aspect though: In my personal experience more often than not the DESCRIPTION file already exists and I only want to update it with the new dependencies. So I would prefer a update_desc_file() function like the one in rrtools (see my first post). make_desc_file() could be a wrapper around usethis::use_description() and automagic::update_desc_file().

Good point @nevrome -- I think the workflow would be to make or update a DESCRIPTION file, or to translate a DESCRIPTION file to deps.yaml. {usethis} uses {desc} behind the scenes, so it would be a good option for setting up and interacting with the DESCRIPTION file.

Agreed that its important to update a DESCRIPTION, rather than create one. I'm going to move some stuff I've been working on that has to do with this in a new branch and push it up as soon as I get the chance so you all can take a look.

@cole-brokamp Did you have some time to work on this issue? If you share your prepared code we could take a look at it together.