bgruening / conda_r_skeleton_helper

Cleaning up Conda r-packages
MIT License
47 stars 32 forks source link

Archived CRAN R package can be compatible for conda R skeleton helper? #55

Closed yvanlebras closed 1 year ago

yvanlebras commented 2 years ago

Hey wonder Björn !

Is there a way to use your amazing conda R skeleton helper to create conda recipe from an archived CRAN R package? @Marie59 is trying to create new conda recipes (and having some trouble..) https://github.com/conda-forge/staged-recipes/pull/18967

Cheers !!!

yvanlebras commented 2 years ago

@bgruening any idea on this? We, in fact @Marie59 ;) , are working on a R package with a dependent R package who is archived.... Marie is hesitating between 1/ waiting that the appropriate version is on the CRAN 2/ use an old version 3/ make the conda recipe "by hand"

bgruening commented 2 years ago

https://github.com/conda-forge/staged-recipes/pull/18967

why have you closed that?

bgruening commented 2 years ago

This script here just uses the conda skeleton tool and cleans up a bit of mess. https://github.com/bgruening/conda_r_skeleton_helper/blob/master/run.py#L88

Conda skeleton has those options:

bag@bag:~$ conda skeleton cran --help
usage: conda-skeleton cran [-h] [--output-dir OUTPUT_DIR] [--output-suffix OUTPUT_SUFFIX] [--add-maintainer ADD_MAINTAINER] [--version VERSION] [--git-tag GIT_TAG] [--all-urls] [--cran-url CRAN_URL]
                           [--r-interp R_INTERP] [--use-binaries-ver USE_BINARIES_VER] [--use-when-no-binary {src,old,src-old,old-src,error}] [--use-noarch-generic] [--use-rtools-win] [--recursive]
                           [--no-recursive] [--no-archive] [--allow-archived] [--version-compare] [--update-policy {error,skip-up-to-date,skip-existing,overwrite,merge-keep-build-num,merge-incr-build-num}]
                           [-m VARIANT_CONFIG_FILES] [--add-cross-r-base] [--no-comments]
                           packages [packages ...]

positional arguments:
  packages              CRAN packages to create recipe skeletons for.

optional arguments:
  -h, --help            Show this help message and exit.
  --output-dir OUTPUT_DIR
                        Directory to write recipes to (default: .).
  --output-suffix OUTPUT_SUFFIX
                        Suffix to add to recipe dir, can contain other dirs (eg: -feedstock/recipe). (default: )
  --add-maintainer ADD_MAINTAINER
                        Add this github username as a maintainer if not already present. (default: None)
  --version VERSION     Version to use. Applies to all packages. (default: None)
  --git-tag GIT_TAG     Git tag to use for GitHub recipes. (default: None)
  --all-urls            Look at all URLs, not just source URLs. Use this if it can't find the right URL. (default: False)
  --cran-url CRAN_URL   URL to use for as source package repository (default: None)
  --r-interp R_INTERP   Declare R interpreter package (default: r-base)
  --use-binaries-ver USE_BINARIES_VER
                        Repackage binaries from version provided by argument instead of building from source. (default: None)
  --use-when-no-binary {src,old,src-old,old-src,error}
                        Sometimes binaries are not available at the correct version for a given platform (macOS). You can use this flag to specify what fallback to take, either compiling from source or using
                        an older binary or trying one then the other. (default: src)
  --use-noarch-generic  Mark packages that do not need compilation as `noarch: generic` (default: False)
  --use-rtools-win      Use Rtools when building from source on Windows (default: False)
  --recursive           Create recipes for dependencies if they do not already exist. (default: False)
  --no-recursive        Don't create recipes for dependencies if they do not already exist. (default: True)
  --no-archive          Don't include an Archive download url. (default: True)
  --allow-archived      If the package has been archived, download the latest version. (default: False)
  --version-compare     Compare the package version of the recipe with the one available on CRAN. Exits 1 if a newer version is available and 0 otherwise. (default: False)
  --update-policy {error,skip-up-to-date,skip-existing,overwrite,merge-keep-build-num,merge-incr-build-num}
                        Dictates what to do when existing packages are encountered in the output directory (set by --output-dir). In the present implementation, the merge options avoid overwriting bld.bat and
                        build.sh and only manage copying across patches, and the `build/{number,script_env}` fields. When the version changes, both merge options reset `build/number` to 0. When the version
                        does not change they either keep the old `build/number` or else increase it by one. (default: error)
  -m VARIANT_CONFIG_FILES, --variant-config-files VARIANT_CONFIG_FILES
                        Variant config file to add. These yaml files can contain keys such as `cran_mirror`. Only one can be provided here. (default: None)
  --add-cross-r-base    Add cross-r-base to build requirements for cross compiling (default: False)
  --no-comments         Do not include instructional comments in recipe files (default: False)

So I assume if you change the code that I linked above and use --cran-url to point to the archive URL, that might work?

Marie59 commented 2 years ago

Hi @bgruening ! Happy to finally work a bit with you ! We closed https://github.com/conda-forge/staged-recipes/pull/18967 because I did 3 other seperate PR that worked and the 3 packages are now available on conda.

Thanks a lot ! I will try what you're suggesting for the conda recipe !

Cheers !

jdblischak commented 1 year ago

I think this can be closed now that PR #57 added the flag --allow-archived