[SYSTEMDS-3529] codecov badge + PyPI downloads badge #2029
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SYSTEMDS-3529
The task was to add to the repository two badges:
PyPI badge
I decided to include two separate badges to indicate download activity:
Another consideration was clarifying that the badges specifically refer to PyPI downloads, since systemd can be installed through various methods. To avoid misleading users, the badge text explicitly mentions 'PyPI downloads'.
I evaluated several methods for adding the PyPI download badges to the repository and chose the one that fits the best.
shields.io pypi badge
✅ Simple REST API to access the badge
✅ Reach customization options
✅ Static badge, no need for ci/cd pipeline to update it
✅ Direct REST API to get the badge
✅ Open source project
✅ Does let you to change the text on the left side of the badge
❌ Can show downloads for last month/week/day, cannot show total downloads
Shields.io uses another API to actually get the value of downloads → it serves as a wrapper.
I still needed the total number of badges, so I decided to take a look at the API that is used inside of shields.io badge in case it has more functionality than shields.io shows
PyPi stats API
✅ Simple REST API to access the data
✅ Reach customization options
✅ Open source project
❌ No API to retrieve the badge, only shields.io is available
❌ Can show downloads for last month/week/day, cannot show total downloads
PyPi stats API does not allow getting total downloads, therefore I did not want to use it.
Pepy.tech
✅ Simple REST API to access the data
✅ Reach customization options
✅ Static badge, no need for ci/cd pipeline to update it
✅ Open source project
✅ Does let you change the text on the left side of the badge
✅ Direct REST API to get the badge
✅ Can show total and monthly PyPI downloads
This solution showed itself the best, as the API allows me to create two badges that I was looking for. The only downside is that
personalized-badge
API is not well documented, and I had to read some of the source code to understand which customization options I actually had.I decided to stay with the default gray and blue badge, as I think it nicely contrasts with other badges and hints that this data is about python.
This comment helped me find different solutions and understand different ways to count the downloads.
Codecov badge
For test coverage badge, I looked at how apache spark created their badge and decided to try replicating the approach.
How to codecov?
Configure
Settings
→Secrets and Variables
→Actions
Warnings! Read before merging⚠️ ⚠️ ⚠️
Currently, the badge might show unknown instead of percent of test coverage as it looks into the main branch of my forked repository.
This is how it should look like, but this badge is configured to my draft feature branch in fork, instead of original main repo as I do not have such access.
You have to reconfigure the badge before the merge! Current state is not intended to be in the main branch of systemds.