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

Add vers support in index_packages endpoint #170

Merged
merged 5 commits into from
Aug 28, 2023

Conversation

keshav-space
Copy link
Member

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! this is looking good, but I would prefer we find a way to avoid code copy from VulnerableCode. How could we share this code?
And if we go ahead and merge this, what's the plan to remove this duplication?

@keshav-space
Copy link
Member Author

How could we share this code?
And if we go ahead and merge this, what's the plan to remove this duplication?

As discussed earlier, we will move this piece of code to the fetchcode.
Also, IMO this would right time to do some refactoring like:

@tdruez
Copy link
Contributor

tdruez commented Aug 25, 2023

This PR is a blocker for aboutcode-org/scancode.io#836 (comment)
@keshav-space @pombredanne what's the status here?

@keshav-space
Copy link
Member Author

This PR is a blocker for nexB/scancode.io#836 (comment) @keshav-space @pombredanne what's the status here?

@tdruez waiting for review from @pombredanne and @JonoYang

Copy link
Member

@JonoYang JonoYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keshav-space Thanks for the PR! I've left some comments for your consideration.

]
"""
latest_date = None
for download in downloads:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its more Pythonic to sort the list of downloads by the upload time, then popping the latest download entry from the list.

Suggested change
for download in downloads:
# Sort `downloads` from earliest "upload_time_iso_8601" to latest
downloads = downloads.sort(key=lambda x: x["upload_time_iso_8601"])
# Pop the latest download entry from `downloads`
latest_download = downloads.pop()
latest_date = latest_download.get("upload_time_iso_8601")
if latest_date:
latest_date = dateparser.parse(latest_date)
return latest_date

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JonoYang I was trying to keep package_managers code untouched and refactor it while migrating to fetchcode.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keshav-space Ah, I see.

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks... some nits for your consideration.

Signed-off-by: Keshav Priyadarshi <[email protected]>
Signed-off-by: Keshav Priyadarshi <[email protected]>
@JonoYang JonoYang self-requested a review August 28, 2023 18:32
Copy link
Member

@JonoYang JonoYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keshav-space LGTM!

@pombredanne Is there anything else you see that needs to be updated?

@JonoYang
Copy link
Member

@keshav-space

Merging, thanks for the contribution!

@JonoYang JonoYang merged commit 15ca27f into main Aug 28, 2023
@keshav-space keshav-space deleted the 155-vers-support-in-index-package branch August 29, 2023 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support vers in index_packages endpoint
4 participants