grayskull icon indicating copy to clipboard operation
grayskull copied to clipboard

[BUG] Grayskull allows recipes with _ when name should have -

Open maresb opened this issue 3 years ago • 15 comments

Describe the bug

Underscores vs. dashes:

Running

grayskull pypi slack_sdk

generates a recipe named slack_sdk, even though the PyPi package name is slack-sdk.

Expected behavior

An error message that the name slack_sdk doesn't correspond to a PyPi package.

Outputs

{% set name = "slack_sdk" %}
{% set version = "3.6.0" %}
...

Environment:

  • grayskull --version 0.8.5

Additional context

I suspect that grayskull is following the PyPi redirect to remove underscores.

This issue led to unintentionally create a duplicate feedstock:

https://github.com/conda-forge/slack-sdk-feedstock/issues/10#issuecomment-860884130

maresb avatar Jun 14 '21 18:06 maresb

Hi @maresb ,

I believe the "fix" in this case is to just give an warning to the user that the package already exist on conda-forge.

marcelotrevisani avatar Jun 17 '21 08:06 marcelotrevisani

cc @ForgottenProgramme

marcelotrevisani avatar Jun 17 '21 08:06 marcelotrevisani

@marcelotrevisani or to not follow redirects on PyPi?

maresb avatar Jun 17 '21 08:06 maresb

The project name is slack_sdk, https://github.com/slackapi/python-slack-sdk/blob/d3615007df2b2f7fd9da1d7afbcd88fe873a3590/setup.py#L250

It is mimicking the pypi behaviour as it is generating the recipes looking for pypi I think grayskull should follow the name of the project, so it should be slack_sdk then

marcelotrevisani avatar Jun 17 '21 09:06 marcelotrevisani

Ah! Very good point. I guess PyPi is blindly converting underscores to dashes?

It seems not so easy to search for duplicates: exponentially many possibilities in the number of underscores plus dashes

I wish there was clear guidance for a standard on conda-forge. I have been searching and asking for a while with no answers.

maresb avatar Jun 17 '21 09:06 maresb

@maresb

I guess PyPi is blindly converting underscores to dashes?

Yes.

ForgottenProgramme avatar Jun 17 '21 09:06 ForgottenProgramme

Also, @maresb, when you say this:

It seems not so easy to search for duplicates: exponentially many possibilities in the number of underscores plus dashes

You mean searching for duplicates on conda-forge, right? Because if PyPI converts all underscores to hyphens, it's not possible to have duplicates. Isn't it?

ForgottenProgramme avatar Jun 17 '21 10:06 ForgottenProgramme

@ForgottenProgramme, exactly.

For the PyPi name very-very-long-package-name there are 16 possible package names to check on conda-forge. But it's not a serious difficulty, just an annoyance.

maresb avatar Jun 17 '21 10:06 maresb

Hey, @maresb, @marcelotrevisani and @jaimergp ! I'm going to try and solve this issue. I'm writing down below what I've understood till now. Please correct me if I am wrong.

Suppose I create a python package called apples_bananas and I put it on conda-forge (not using grayskull). Suppose a different package called apples-bananas is there on PyPI (not there on conda-forge).

Now, grayskull in it's present state would work like this: if a user types in grayskull pypi apples_bananas, grayskull would look up that package on pypi (underscores converted to hyphens) and create a recipe with the name of the package as typed in by the user (apples_bananas). So now there will be two packages on conda-forge named apples_bananas , but these will be two different packages.

ForgottenProgramme avatar Jun 18 '21 07:06 ForgottenProgramme

So, we would like grayskull to give a warning if a package with the same name as entered by the user in the grayskull pypi <package_name> command, already exists on conda-forge.

ForgottenProgramme avatar Jun 18 '21 07:06 ForgottenProgramme

Yeap, that would be really useful

marcelotrevisani avatar Jun 18 '21 07:06 marcelotrevisani

do you want me to assign this issue to you then?

marcelotrevisani avatar Jun 18 '21 07:06 marcelotrevisani

Yes, please! :)

ForgottenProgramme avatar Jun 18 '21 07:06 ForgottenProgramme

Do we have a gitter room for grayskull, @marcelotrevisani ?

ForgottenProgramme avatar Jun 18 '21 07:06 ForgottenProgramme

Do we have a gitter room for grayskull, @marcelotrevisani ?

Yes, we already have one: https://gitter.im/conda_grayskull/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge

marcelotrevisani avatar Jun 18 '21 07:06 marcelotrevisani