8000 Add `vers` support in index_packages endpoint by keshav-space · Pull Request #170 · aboutcode-org/purldb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
10000

Add vers support in index_packages endpoint #170

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

Merged
merged 5 commits into from
Aug 28, 2023

Conversation

keshav-space
Copy link
Member

Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
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?

Signed-off-by: Keshav Priyadarshi <git@keshav.space>
@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.

8000
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
@JonoYang JonoYang self-requested a review August 28, 2023 18:32
Cop 8000 y 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
JonoYang added a commit that referenced this pull request Apr 14, 2025
Add `vers` support in index_packages endpoint
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
0