Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] grayskull errors after failing to find name from github repo with pyproject.toml #461

Closed
scottstanie opened this issue Apr 12, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@scottstanie
Copy link
Contributor

scottstanie commented Apr 12, 2023

Describe the bug
grayskull isn't grabbing all the metadata available in the pyproject.toml of a github repo.

To Reproduce
I installed grayskull in a new conda environment, then ran on this github repo:

grayskull pypi https://github.com/opera-adt/dolphin

#### Initializing recipe for https://github.com/opera-adt/dolphin ####

Starting the download of the sdist package dolphin
dolphin 100% ETA:  --:--:--   0.0 s/B|#                                                                                                                                                                                                         |
Checking for pyproject.toml
pyproject.toml found in /var/folders/hw/sj9hl8555s36n00t812twvcr0000gq/T/grayskull-dolphin-4hhoprgf/dolphin-0.1.1/pyproject.toml
Recovering information from setup.py
Executing injected distutils...
Checking >> python 100% |################################################################################################################################################################################################|[Elapsed Time: 0:00:00]
License type: Apache-2.0
License file: ['LICENSE']

Expected behavior
A clear and concise description of what you expected to happen.

Outputs

Traceback (most recent call last):
  File "/Users/staniewi/miniconda3/envs/testgrayskull/bin/grayskull", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/staniewi/miniconda3/envs/testgrayskull/lib/python3.11/site-packages/grayskull/__main__.py", line 276, in main
    generate_recipes_from_list(args.pypi_packages, args)
  File "/Users/staniewi/miniconda3/envs/testgrayskull/lib/python3.11/site-packages/grayskull/__main__.py", line 299, in generate_recipes_from_list
    recipe, config = create_python_recipe(
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/staniewi/miniconda3/envs/testgrayskull/lib/python3.11/site-packages/grayskull/__main__.py", line 334, in create_python_recipe
    GrayskullFactory.create_recipe(
  File "/Users/staniewi/miniconda3/envs/testgrayskull/lib/python3.11/site-packages/grayskull/base/factory.py", line 46, in create_recipe
    GrayskullFactory.REGISTERED_STRATEGY[repo_type.lower()].fetch_data(
  File "/Users/staniewi/miniconda3/envs/testgrayskull/lib/python3.11/site-packages/grayskull/strategy/pypi.py", line 60, in fetch_data
    update_recipe(recipe, config, sections or ALL_SECTIONS)
  File "/Users/staniewi/miniconda3/envs/testgrayskull/lib/python3.11/site-packages/grayskull/strategy/pypi.py", line 485, in update_recipe
    metadata = get_metadata(recipe, config)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/staniewi/miniconda3/envs/testgrayskull/lib/python3.11/site-packages/grayskull/strategy/pypi.py", line 383, in get_metadata
    requirements_section = extract_requirements(metadata, config, recipe)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/staniewi/miniconda3/envs/testgrayskull/lib/python3.11/site-packages/grayskull/strategy/pypi.py", line 521, in extract_requirements
    requires_dist = format_dependencies(metadata.get("requires_dist", []), name)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/staniewi/miniconda3/envs/testgrayskull/lib/python3.11/site-packages/grayskull/utils.py", line 165, in format_dependencies
    if deps_name.replace("-", "_") == name.replace("-", "_"):
                                      ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'

Environment:

(testgrayskull) staniewi:conda-dolphin$ conda list
# packages in environment at /Users/staniewi/miniconda3/envs/testgrayskull:
#
# Name                    Version                   Build  Channel
beautifulsoup4            4.12.2             pyha770c72_0    conda-forge
brotlipy                  0.7.0           py311he2be06e_1005    conda-forge
bzip2                     1.0.8                h3422bc3_4    conda-forge
ca-certificates           2022.12.7            h4653dfc_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py311hae827db_3    conda-forge
charset-normalizer        3.1.0              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda-souschef            2.2.3              pyhd8ed1ab_0    conda-forge
cryptography              40.0.1          py311h507f6e9_0    conda-forge
grayskull                 2.3.0              pyhd8ed1ab_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
libblas                   3.9.0           16_osxarm64_openblas    conda-forge
libcblas                  3.9.0           16_osxarm64_openblas    conda-forge
libcxx                    16.0.1               h75e25f2_0    conda-forge
libexpat                  2.5.0                hb7217d7_1    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgfortran               5.0.0           12_2_0_hd922786_31    conda-forge
libgfortran5              12.2.0              h0eea778_31    conda-forge
liblapack                 3.9.0           16_osxarm64_openblas    conda-forge
libopenblas               0.3.21          openmp_hc731615_3    conda-forge
libsqlite                 3.40.0               h76d750c_0    conda-forge
libzlib                   1.2.13               h03a7124_4    conda-forge
llvm-openmp               16.0.1               h7cfbb63_0    conda-forge
ncurses                   6.3                  h07bb92c_1    conda-forge
numpy                     1.24.2          py311h60f8152_0    conda-forge
openssl                   3.1.0                h03a7124_0    conda-forge
packaging                 23.1               pyhd8ed1ab_0    conda-forge
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
pkginfo                   1.9.6              pyhd8ed1ab_0    conda-forge
progressbar2              4.2.0              pyhd8ed1ab_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyopenssl                 23.1.1             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.11.3          h1456518_0_cpython    conda-forge
python-utils              3.5.2              pyhd8ed1ab_0    conda-forge
python_abi                3.11                    3_cp311    conda-forge
rapidfuzz                 2.15.0          py311ha397e9f_0    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
requests                  2.28.2             pyhd8ed1ab_1    conda-forge
ruamel.yaml               0.17.21         py311he2be06e_3    conda-forge
ruamel.yaml.clib          0.2.7           py311he2be06e_1    conda-forge
ruamel.yaml.jinja2        0.2.4                      py_1    conda-forge
semver                    3.0.0              pyhd8ed1ab_0    conda-forge
setuptools                67.6.1             pyhd8ed1ab_0    conda-forge
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
stdlib-list               0.8.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               he1e0b03_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tomli-w                   1.0.0              pyhd8ed1ab_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
urllib3                   1.26.15            pyhd8ed1ab_0    conda-forge
wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
(testgrayskull) staniewi:conda-dolphin$ pip list
Package            Version
------------------ -----------
beautifulsoup4     4.12.2
brotlipy           0.7.0
certifi            2022.12.7
cffi               1.15.1
charset-normalizer 3.1.0
colorama           0.4.6
conda-souschef     2.2.3
cryptography       40.0.1
grayskull          2.3.0
idna               3.4
numpy              1.24.2
packaging          23.1
pip                23.0.1
pkginfo            1.9.6
progressbar2       4.2.0
pycparser          2.21
pyOpenSSL          23.1.1
PySocks            1.7.1
python-utils       3.5.2
rapidfuzz          2.15.0
requests           2.28.2
ruamel.yaml        0.17.21
ruamel.yaml.clib   0.2.7
ruamel.yaml.jinja2 0.2.4
semver             3.0.0
setuptools         67.6.1
soupsieve          2.3.2.post1
stdlib-list        0.8.0
tomli              2.0.1
tomli_w            1.0.0
urllib3            1.26.15
wheel              0.40.0
(testgrayskull) staniewi:conda-dolphin$ grayskull --version
2.3.0
@scottstanie scottstanie added the bug Something isn't working label Apr 12, 2023
@scottstanie
Copy link
Contributor Author

It works If I add two name entries in some of the metadata dicts, like here: main...scottstanie:grayskull:pyproject-missing-name

I don't know if that is the best way to fix this. If it's fine, I can submit that PR

@marcelotrevisani
Copy link
Member

sure, let me take a closer look at this.
Please feel free to open PRs :)

Sorry for my delay, I have been quite busy :/

@marcelotrevisani
Copy link
Member

Thanks for reporting and for the suggested fix. I am closing this now, but if you find any other bug in the future please let me know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants