使用git / github版本化R包? [英] Versioning an R package with git/github?

查看:144
本文介绍了使用git / github版本化R包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法确定更新github上R包的版本号的工作流程,以避免错误地命名为中间版本。这是我现在做的。




  • 提交并推送版本1.0.0,并将版本设置为1.0.0 li>
  • 在不更改DESCRIPTION文件的情况下提交并推送一些错误修复等。最终决定我应该将版本升级到1.0.1,并且所以提交并推送一个更新的描述,然后设置一个新版本。


这个问题是如果有人(比如说我)我做了一些修正之后,但在我碰到版本之前从github下载,他们认为他们的版本是1.0.0(因为这仍然在说明中),但它确实在1.0.0和1.0之间.1。

类似这样的事情似乎在问题
是否可以使用git / github添加版本号,其中但不是特定于R,所以我不能说它是否在谈论相同的事情或不是如何这将是无论如何,它都是为R实现的。



还有一个问题自动化版本增加R包,它有一个自动更新它的答案,虽然在评论中,我们看到哈德利基本上不会自动增加版本的好处( https://github.com/hadley/devtools/issues/501 )。这里的代码还取决于Make,因此不是跨平台的。 我强烈建议遵循 Git Flow 分支模型,其中:


  • master 分支包含最新稳定版本的代码。使用版本格式 x.y.z

  • develop 分支包含正在开发的代码。使用版本格式 xyz-9000



master 是GitHub上的默认签出分支。这样,当用户安装R软件包时,用户总能获得最新版本:

  install_github(owner / repos)

希望安装开发者版本的用户可以使用:

  install_github(owner / repos @ develop)

接下来,如果你的软件包也在CRAN上,请严格执行,并且 master 完全反映CRAN上的内容。这样用户就可以安装相同的软件包版本,不管他们是否使用:

  install.packages(repos)

  install_github(owner / repos)

无论用户访问哪种方式,人们也可以看到相同的信息您的CRAN页面或您的GitHub页面。此外,即使您在更新开发时标记了所有用户也会看到相同的稳定信息/版本(只有精明的用户才会意识到此分支) 。



接下来,当你发布新版本时,你可以用它们的版本号 git tag p>

  git checkout master 
git tag 1.2.3
git push --tags

这样用户可以安装他们想要的任何版本,例如

 install_github(owner/repos@1.2.3)

为此的工具? git flow 扩展名是一个很棒的工具来编排上述内容,例如

  git checkout develop 
git flow release start 1.2.4
emacs说明##更新版本xyz-9000 - > xyz + 1
R CMD build ...
R CMD check ...
git flow release finish 1.2.4
git checkout master
git push
git push --tags
git checkout开发
emacs描述## Bump version to xy(z + 1)-9000
git commit -amBump develop version [ci skip]
git push

我在日常生活中使用了上述两年 - 我无法想象不会使用它。


I'm having trouble determining a workflow for updating the version number of my R packages on github to avoid incorrectly named "in-between" versions. Here's what I do now.

  • commit and push, say, version 1.0.0, and set the release to be 1.0.0
  • commit and push some bug fixes, etc, without changing the DESCRIPTION file
  • eventually decide I should bump the version to, say, 1.0.1, and so commit and push an updated DESCRIPTION, then set a new release.

The problem with this is that if someone (say, me) downloads from github after I've made some fixes but before I've bumped the version, the version they think they have is 1.0.0 (because that's what's still in the DESCRIPTION) but it's really got something in between 1.0.0 and 1.0.1.

Something like this seems to be discussed at the question "Is it possible to add a version number using git / github", where but is not specific to R and so I can't tell if it's talking about the same thing or not or how that would be implemented for R, anyway.

There's also the question "Automating version increase of R packages" which has an answer which automatically updates it, though in the comments, we see that Hadley is "basically not sold on the benefits of incrementing version automatically" (https://github.com/hadley/devtools/issues/501). The code there also depends on Make so isn't cross-platform.

解决方案

I highly recommend to follow the Git Flow branching model, where:

  • the master branch contains code of the latest stable release. Use version format x.y.z
  • the develop branch contains code under development. Use version format x.y.z-9000

Let master be the default checkout branch on GitHub. That way users will always get the latest release, when they install R packages using:

install_github("owner/repos")

Users who wish to install the developers version, can use:

install_github("owner/repos@develop")

Next, if you're package is also on CRAN, be strict and have master reflect exactly what is on CRAN. That way the user install the same identical package version regardless whether they use:

install.packages("repos")

or

install_github("owner/repos")

This way people also see the same info regardless of they visit your CRAN page or your GitHub page. Moreover, you can rest assure that all users will see the same stable information / version, even if you tag along updating the develop (only savvy users will be aware of this branch).

Next, when you release new versions, you can git tag them with their version number, e.g.

git checkout master
git tag 1.2.3
git push --tags

That way users can install whatever version they'd like, e.g.

install_github("owner/repos@1.2.3")

Tools for this? The git flow extension is an awesome tool to orchestrate the above, e.g.

git checkout develop
git flow release start 1.2.4
emacs DESCRIPTION ## Update version x.y.z-9000 -> x.y.z+1
R CMD build ...
R CMD check ...
git flow release finish 1.2.4
git checkout master
git push
git push --tags
git checkout develop
emacs DESCRIPTION ## Bump version to x.y.(z+1)-9000
git commit -am "Bump develop version [ci skip]"
git push

I've used the above on a daily basis for a good two years - I cannot imagine not using it.

这篇关于使用git / github版本化R包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆