Skip to content

[BUG] positional argument cran_packages ignored when --package-indexes argument given to grayskull cran #614

@matthewfeickert

Description

@matthewfeickert

Describe the bug
For grayskull v2.9.1, if you try to generate a recipe for an R package using grayskull cran and pass the optional --package-indexes argument the required positional argument cran_packages is ignored.

To Reproduce
Steps to reproduce the behavior:

$ docker run --rm -ti ghcr.io/prefix-dev/pixi:latest 
root@dd24e7a37c8f:/# pixi global install grayskull
Global environments as specified in '/root/.pixi/manifests/pixi-global.toml'
└── grayskull: 2.9.1 (installed)
    └─ exposes: grayskull, greyskull, conda-grayskull, conda-greyskull
root@dd24e7a37c8f:/# grayskull cran --help
usage: grayskull cran [-h] [--stdout STDOUT] [--list-missing-deps] [--package-indexes PACKAGE_INDEXES [PACKAGE_INDEXES ...]] [--download] [--maintainers MAINTAINERS [MAINTAINERS ...]] [--output OUTPUT]
                      [--strict-conda-forge] [--sections {package,source,build,requirements,test,about,extra} [{package,source,build,requirements,test,about,extra} ...]] [--use-v1-format]
                      cran_packages [cran_packages ...]

positional arguments:
  cran_packages         Specify the CRAN packages name.

options:
  -h, --help            show this help message and exit
  --stdout STDOUT       Disable or enable stdout, if it is False, Grayskull will disable the prints. Default is True
  --list-missing-deps   After the execution Grayskull will print all the missing dependencies.
  --package-indexes PACKAGE_INDEXES [PACKAGE_INDEXES ...]
                        List of package indexes to check for existing packages. Can be channel names (e.g., conda-forge) or full URLs (e.g., https://internal-conda.example.com). For custom API
                        structures, use the {pkg_name} placeholder (e.g., https://internal-conda.example.com/api/{pkg_name}/available). Default is conda-forge.",
  --download, -d        Download the sdist package and PyPI information in the same folder the recipe is located.
  --maintainers MAINTAINERS [MAINTAINERS ...], -m MAINTAINERS [MAINTAINERS ...]
                        List of maintainers which will be added to the recipe.
  --output OUTPUT, -o OUTPUT
                        Path to where the recipe will be created
  --strict-conda-forge  It will generate the recipes strict for the conda-forge channel.
  --sections {package,source,build,requirements,test,about,extra} [{package,source,build,requirements,test,about,extra} ...], -s {package,source,build,requirements,test,about,extra} [{package,source,build,requirements,test,about,extra} ...]
                        If sections are specified, grayskull will populate just the sections informed.
  --use-v1-format, -u   Returns a recipe file in the V1 format, used by rattler-build. NOTE: This is experimental.
root@dd24e7a37c8f:/# grayskull cran --package-indexes https://carpentries.r-universe.dev/api/packages/{pkg_name}/ varnish
usage: grayskull cran [-h] [--stdout STDOUT] [--list-missing-deps] [--package-indexes PACKAGE_INDEXES [PACKAGE_INDEXES ...]] [--download] [--maintainers MAINTAINERS [MAINTAINERS ...]] [--output OUTPUT]
                      [--strict-conda-forge] [--sections {package,source,build,requirements,test,about,extra} [{package,source,build,requirements,test,about,extra} ...]] [--use-v1-format]
                      cran_packages [cran_packages ...]
grayskull cran: error: the following arguments are required: cran_packages
root@dd24e7a37c8f:/# grayskull cran --package-indexes conda-forge tinkr
usage: grayskull cran [-h] [--stdout STDOUT] [--list-missing-deps] [--package-indexes PACKAGE_INDEXES [PACKAGE_INDEXES ...]] [--download] [--maintainers MAINTAINERS [MAINTAINERS ...]] [--output OUTPUT]
                      [--strict-conda-forge] [--sections {package,source,build,requirements,test,about,extra} [{package,source,build,requirements,test,about,extra} ...]] [--use-v1-format]
                      cran_packages [cran_packages ...]
grayskull cran: error: the following arguments are required: cran_packages

Expected behavior

Run successfully, checking for the package on another package index other than CRAN.

Outputs
If applicable, add the output to help explain your problem.

Environment:

root@dd24e7a37c8f:/# pixi global list
Global environments as specified in '/root/.pixi/manifests/pixi-global.toml'
└── grayskull: 2.9.1 
    └─ exposes: grayskull, greyskull, conda-grayskull, conda-greyskull
root@dd24e7a37c8f:/# grayskull --version
2.9.1

Additional context
Add any other context about the problem here.

Similar to Issue #532, it would be very useful to be able to target GitHub as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions