-
-
Notifications
You must be signed in to change notification settings - Fork 25
Add API function for using cleanly as a library #39 #66
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
Conversation
@TG1999 You For example:
ValueError:
I need a function that, provided a requirements file, returns directly the json as a python object. |
6266e68
to
ca9eeb0
Compare
f43e112
to
1e04ecf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! See some feedback for your review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TG1999 I'm getting an error when using this requirements file as input:
https://github.com/nexB/scancode-toolkit/blob/develop/requirements.txt
>>> inspector_output = resolver_api(requirement_files=['requirements.txt'])
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Volumes/nexB/repos/scancode.io/lib/python3.9/site-packages/python_inspector/resolve_cli.py", line 446, in resolver_api
resolved_dependencies, purls = resolve(
File "/Volumes/nexB/repos/scancode.io/lib/python3.9/site-packages/python_inspector/resolve_cli.py", line 542, in resolve
resolved_dependencies, packages = get_resolved_dependencies(
TypeError: cannot unpack non-iterable NoneType object
2 more issues:
Using this input that contains only 1 package entry: reqs.txt
from python_inspector.resolve_cli import resolver_api
>>> resolver_api(requirement_files=["reqs.txt"])
>>> packages = inspector_output.get("packages")
>>> len(packages)
2
>>> packages[0].get("purl")
'pkg:pypi/[email protected]'
>>> packages[1].get("purl")
'pkg:pypi/[email protected]'
>>> packages[0]['parties']
[{'type': 'person', 'role': 'author', 'name': 'William Pearson', 'email': '[email protected]', 'url': None},
{'type': 'person', 'role': 'maintainer', 'name': '', 'email': '', 'url': None}]
-
There should be only 1 entry for that package in the resolve packages.
-
One of the 2
parties
entry is empty, no name, no email, no URL.
@tdruez Re:
We have one download_url per package, that's why the purl for both of these are same. |
@tdruez Re:
I got this error while using this req file :
I will suggest you to use this |
Could you expend a bit your explanation? |
Could you explain why this issue is occurring? What is the specific part of this requirements file that cause thew issue? |
@tdruez rdflib causes this issue, https://github.com/RDFLib/rdflib/blob/main/setup.py |
db7f6e4
to
52c8f7b
Compare
@TG1999 why "force pushing" into a single commit again? I makes impossible to track the progress made... |
@tdruez we pushed some commits in between that were only for verifying the content of the flaky tests in the CI. And since the verification is now done I squashed the intermediate commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TG1999 looks good. Can you push a release after the merge?
src/python_inspector/api.py
Outdated
} | ||
|
||
|
||
def resolver_api( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a better name IMHO:
def resolver_api( | |
def resolve_dependencies( |
Signed-off-by: Tushar Goel <[email protected]>
Signed-off-by: Tushar Goel <[email protected]>
Currently if there is no direct dependencies provided in a manifest file we raise exception and don't process it anymore, but this is incorrect we should provide metadata in manifest files instead of failing altogether Signed-off-by: Tushar Goel <[email protected]>
Signed-off-by: Tushar Goel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks!
Reference: #39
Signed-off-by: Tushar Goel [email protected]