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] Using PyPI with GitHub repository Poetry pyproject.toml results in 'NoneType' object error for format_dependencies #500

Closed
d33bs opened this issue Oct 4, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@d33bs
Copy link

d33bs commented Oct 4, 2023

Describe the bug

Thank you for the great efforts with this project! I noticed a bug which appears to be reoccurring or occurring similarly to #455 and #461. The error occurs when attempting to use Grayskull from a GitHub repository which leverages pyproject.toml files. Specifically (and maybe differently from the earlier issues) I'm seeing this occur with pyproject.toml files of the Poetry variety.

Please don't hesitate to let me know if I've done something out of alignment with what Grayskull expects or supports (I may just be doing things completely wrong!).

To Reproduce
Steps to reproduce the behavior:

I created a simple demonstration repository which may be found here and is referenced below: https://github.com/d33bs/test-grayskull .

  1. Attempt to run grayskull pypi https://github.com/d33bs/test-grayskull
  2. Witness the error:
...
File ".../python3.9/site-packages/grayskull/utils.py", line 165, in format_dependencies
    if deps_name.replace("-", "_") == name.replace("-", "_"):
AttributeError: 'NoneType' object has no attribute 'replace

Expected behavior

I'd suggest some combination of the following possible solutions:

  • A more descriptive error (mentioning what is required from the project metadata).
  • Documentation covering the expected fields within pyproject.toml files (if this is where the error stems from).
  • A successful build based on these types of pyproject.toml files.

Environment:

  • MacOS
  • Python 3.9
  • Poetry 1.6.1
  • Grayskull 2.5.0
@d33bs d33bs added the bug Something isn't working label Oct 4, 2023
@marcelotrevisani
Copy link
Member

oh ok, that seems to be a bug indeed. Gonna take a further look and add it to my backlog
Thanks for reporting it! :)

@marcelotrevisani marcelotrevisani self-assigned this Oct 4, 2023
@d33bs
Copy link
Author

d33bs commented Oct 4, 2023

Thank you @marcelotrevisani !

@wxicu
Copy link

wxicu commented Oct 15, 2023

Hi all,
I am having the same error now. Is there any update so far? Thank you!

@marcelotrevisani
Copy link
Member

Hey, I am in the process of fixing this and all of your suggested solutions are great!
I just don't have much time to do it all, but indeed it would be great.

Can I break down your issue into others please?
For instance, I would like to create two more issues for:

  • A more descriptive error (mentioning what is required from the project metadata).
  • Documentation covering the expected fields within pyproject.toml files (if this is where the error stems from).

So, at least, I can keep track of this. The last bit is related to the fix I am doing.

@marcelotrevisani
Copy link
Member

This issue was fixed with #503 as well
I was able to generate

grayskull pypi https://github.com/d33bs/test-grayskull
{% set name = "test-grayskull" %}
{% set version = "0.0.1" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://github.com/d33bs/test-grayskull/archive/v{{ version }}.tar.gz
  sha256: 98d81a0d5d0e2f5c47b113a4083fc5bdab358f0440568d3bd5dd3d6bd4bb2d9f

build:
  noarch: python
  script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
  number: 0

requirements:
  host:
    - python
    - poetry-core
    - pip
  run:
    - python >=3.9,<3.13
    - pandas >=2.1.1,<3.0.0
    - numpy >=1.26.0,<2.0.0

test:
  commands:
    - pip check
  requires:
    - pip

about:
  license: Apache-2.0
  license_file: LICENSE

extra:
  recipe-maintainers:
    - marcelotrevisani

@marcelotrevisani
Copy link
Member

I am generating version 2.5.1 that should have this fix

@d33bs
Copy link
Author

d33bs commented Oct 20, 2023

Thanks @marcelotrevisani ! Does the fix relate to a specific PR?

@marcelotrevisani
Copy link
Member

yup, this one
#503
I fixed another bug and this one as they were simple

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

3 participants