grayskull
grayskull copied to clipboard
[BUG] Package name is added to URL
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
- Create new recipe either through CLI or website
- The output includes a link with a hard-coded package name
Expected behavior The placeholder should not be substituted
Outputs If applicable, add the output to help explain your problem.
Example recipe:
{% set name = "requests" %}
{% set version = "2.25.1" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/requests-{{ version }}.tar.gz
sha256: 27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804
build:
number: 0
noarch: python
script: {{ PYTHON }} -m pip install . -vv
requirements:
host:
- pip
- python !=3.0,!=3.1,!=3.2,!=3.3,!=3.4
run:
- certifi >=2017.4.17
- chardet >=3.0.2,<5
- idna >=2.5,<3
- python !=3.0,!=3.1,!=3.2,!=3.3,!=3.4
- urllib3 >=1.21.1,<1.27
test:
imports:
- requests
commands:
- pip check
requires:
- pip
about:
home: https://requests.readthedocs.io
summary: Python HTTP for Humans.
dev_url: https://github.com/psf/requests
license: Apache-2.0
license_file: LICENSE
extra:
recipe-maintainers:
- ADD_YOUR_GITHUB_ID_HERE
Here, the URL is url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/requests-{{ version }}.tar.gz
with a hard-coded requests
in it.
The example meta.yaml
has the URL like so: url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
The only thing where I found the URL with the placeholder to fail is if the package name is upper case but the user entered the name in lower case. Then, the package name will be added in lowercase to the beginning of the YAML but that is not accepted in the URL. Therefore, if that is changed, grayskull would need to make sure that the name is not taken directly form the user input but has its casing verified first.
For example, the package Janome
generates this output, when entering the name in lowercase:
{% set name = "janome" %}
{% set version = "0.4.1" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/Janome-{{ version }}.tar.gz
sha256: 6c2c38d894014d57cb3151265c11146506ead3b3bc290898adc33711711612de
build:
number: 0
noarch: python
script: {{ PYTHON }} -m pip install . -vv
requirements:
host:
- pip
- python
run:
- python
test:
imports:
- janome
- janome.sysdic
commands:
- pip check
requires:
- pip
about:
home: https://mocobeta.github.io/janome/en/
summary: Japanese morphological analysis engine.
license: AAL
license_file: PLEASE_ADD_LICENSE_FILE
extra:
recipe-maintainers:
- ADD_YOUR_GITHUB_ID_HERE
When then substituting the URL as described above, the tests fail, because the name is in lower case.
I don't think the placeholder would be the best solution here. I know that is one of the parts I would like to change on grayskull Because you can ask pypi to get the URL as well, I believe that would be better and just replace the version by the placeholder
That sounds good and yeah, I also disagree with the placeholder, just wasn't sure if that is documented behaviour or not. :)