-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
PyPI version badge doesn't include a link #8291
Comments
The markdown we generate doesn't usually wrap the image in a link for any service (its not just pypi - its the same for all badges).
At the moment we only use this when the badge is a result from the "suggest badges" feature - in that case, the generated markdown (or rst or whatever) will link to the project URL from the 'suggest' search. I always forget this exists until I dig in to the frontend code. |
Why not? Where to see the "suggested badges"? It is not present on the front page. |
So there's 2 questions here..
You're not the first person to suggest this as a feature. This is a dupe of other issues like #7438 , #4726 (and others) but although someone occasionally pops up with a query, nobody has really wanted to push it forward. In principle it would be possible to add a property or method on each badge class that allows us to generate a link based on the badge params to wrap the image (obviously the url we assemble to make an API call for data is a different thing from the URL you might want a user to visit). We've never done it. I don't think I've ever really articulated my thoughts on it, but.. There are some reasons why would be a reasonable thing to do, if someone really wanted to champion it:
There would be a number of considerations for us of maintainers of varying levels of importance:
In the grand scheme of things, I'm on the fence.
If you paste a URL into the search box (instead of just a search term) on https://shields.io/ a button will appear that says "suggest badges". The suggestions may or may not be helpful. It is a bit of a strange legacy "feature" that probably needs to be retired but that feature is the reason why the frontend code has the ability to generate markdown/rst/etc with a link. |
It is not quite obvious that frontend generates badge configuration form from graph LR;
G[get badge] --> backend --> S[service.js:handle]
GB[generate badge] --> frontend --> SE[service.js:examples]
So this is the code that is used for configuration. shields/services/pypi/pypi-version.service.js Lines 10 to 18 in af47032
It is not completely clear if a separate URL field should be added directly to mapping, or to
Not helpful for https://pypi.org/project/hy/ indeed. The code for button generation IMHO deserves to be in a separate class. It could expose prefixes for suggestions and methods for compiling necessary fields for markup. Not every badge needs a link, so it could be optional. The frontend code that generates markup. shields/frontend/components/customizer/customizer.tsx Lines 76 to 81 in af47032
How to pass badge info there? And where frontend actually accesses service |
Chris articulated quite clearly why this feature does not exist today, as well the things that would need to be discussed to determine if this is even a feature we should pursue. It's not clear to me from your comments whether you are simply suggesting a feature/asking a question about the absence of the feature, or if this is now a feature you would like to work on. It would be helpful if you could clarify that. Additionally, even if this is something you'd like to work on, there's still some conversation that needs to happen first to determine whether this is a feature we want to incorporate (taking into account the plans to overhaul the website) before we start diving into any specific implementation details or class/function level structure. |
I'd like to work on adding URL to generated markup. Although my knowledge if React/TypeScript and Gatsby ecosystem is close to zero. Is there an issue with plans about overhauling the website? Quite curious what is wrong with current approach that it is needed. |
I think before anyone starts on an implementation for this one, the key question is: would we as the core team want to take on this feature? The long tail of maintenance would affect every existing badge (4 or 5 hundred, depending on how you count the variants) and every future PR adding a new badge. Do you have any further thoughts beyond the points I've already listed Caleb? |
@chris48s but the URL is not obligatory for each badge. Or do you foresee a lot of people adding URLs to badges? |
If we added this, it would be a feature that could be used for any badge. If we're going to say we use it in some cases but not others, we'd need to clearly state and document when we use it and when we don't. The PyPI version badge is not special in the context of the hundreds of badges we have. We wouldn't add this just for PyPI Version and nothing else. |
Bah sorry, I forgot to hit the comment button the other day. To the question asked, my answer is no. I think you've perfectly laid out the considerations and an approach we can take for moving forward. At the highest level I'll say that I'm ambivalent around the overarching question of whether we should do this. I think it's fair to say that we've a dearth of frontend resources and expertise, and increasingly limited maintainer bandwidth overall, so I'm generally hesitant to expand the frontend footprint feature wise. However, I acknowledge it's not too far a stretch (at least as far as an end user experience capability perspective goes) so I could be convinced this is worthwhile. At a minimum, I feel like the existing feature should be made more prominent as part of the UX redesign (#7815) because it is currently essentially an easter egg. It's one of those "if ya know ya know" deals, but is otherwise completely missed.
@abitrolly - there's been a desire to modernize and evolve the frontend shields.io website for a while, and #7815 (and the issues linked within) contain relevant discussions and considerations. It's fantastic that you're interested in working on markdown enhancement features, it's just that like Chris said, the Shields team needs to first figure out if this is something we should do, and then if so, how this should be surfaced/presented to end users, all prior to deep dive implementation discussions. You're more than welcome to participate in this dialogs too, we just wanted to stress that we're no where near a point where we can start talking about code/class level details |
Oh and I guess another point I'll add is that there are some badges which do arguably have a natural link that could be included, but I've found I actually dislike that link and use another 99% of the time. In such cases I'd be annoyed if I had to cut out part of the generated markdown Shields gave me |
Are you experiencing an issue with...
shields.io
🐞 Description
Generated markup for PyPI version badge doesn't include a link to package repo.
Expected this code.
https://github.com/badges/shields/blob/master/doc/TUTORIAL.md doesn't make it immediately obvious how to pass
target
param from example template to markdown. Maybe add some mermaid diagrams to it?🔗 Link to the badge
/pypi/v
💡 Possible Solution
No response
The text was updated successfully, but these errors were encountered: