-
Notifications
You must be signed in to change notification settings - Fork 25
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 a page for RPM Python API #55
base: master
Are you sure you want to change the base?
Add a page for RPM Python API #55
Conversation
I couldn't figure out how to build the website locally so I am not sure if the render will look pretty. But the markdown is IMHO valid. |
10456db
to
bf5da15
Compare
Having a separate page of our own for Python and linking to the examples is fine, but showing output of those examples there makes no sense - somebody looking for rpm python API docs isn't interested in example program output but actual API documentation, and its examples. |
Thank you for the review @pmatilai,
I agree, that's why my original idea was to put those examples directly into the documentation website. But I only partially agree with the "not being interested in the example program output" ... If I am completely new, I want to know what the API can do and seeing what kinds of information can be printed by the API and how it looks like before diving into reading any code is definitely helpful. Almost all my usages of the RPM Python API went the same way.
Easily finding in the documentation that there is an example Python script, which prints the same information as
But the examples aside, I talked with @xsuchy and we agreed that those web archive links used to be useful back in the day when they were up-to-date. What if took them, fixed any outdated information and put hem into the |
Sample output is meaningful when it's next to the actual code, but it doesn't work when linking to some far-away thing. The problem here starts right at the bottom: API documentation needs to be where the code is, otherwise it'll fall out of sync. That's one of the reasons I prefer examples in the codebase itself too. I think what you're making here is more like a tutorial, which is a little different again. What the Python API really needs is
I'm certainly not expecting you to do all that, just thinking out loud as to what sort of structure we'd want/need here. |
a68348d
to
80e84f9
Compare
I converted the whole "Chapter 16. Programming RPM with Python" from this archive Can you please let me know how to build the rpm.org page locally? I want to make sure the markdown renders as expected. |
OK, this is only mentioned in the main RPM repository: https://github.com/rpm-software-management/rpm/tree/master/docs https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll explains how to do that. On Fedora I use |
OK; added a README file for this repo. |
@ffesti thank you very much. I did not realize that this is a jekyll project. I successfully built it through |
Well, it is and it isn't. It's a GitHub pages project. GH pages uses something not completely unlike Jekyll - maybe. |
This is almost unchanged text from the "Programming RPM with Python from Fedora RPM Guide" archive. I only did some formatting changes such as displaying some symbols as code.
At the time of this update, we have F41, Python 3.13, and RPM 4.20
7196b0b
to
28c0195
Compare
I did my best to modernize the original "Chapter 16. Programming RPM with Python" documentation from It's not perfect but IMHO it is good enough. There are two FIXME entries that I would like to fix before merging but I couldn't figure out how it should be done. Can you please take a look? |
|
||
## Dependency Comparisons | ||
|
||
FIXME code examples in this chapter are outdated |
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.
The code uses file_h.dsOfHeader()
, I don't know what should be done instead. I know a syntax like rpm.ds(h, rpm.RPMTAG_PROVIDENAME)
but it takes an argument, the original example doesn't. I was thinking of rpm.ds(h, rpm.RPMTAG_EVR)
but then .EVR()
on it returns nothing. So I don't know.
# FIXME | ||
# if resolved: | ||
# # ts.addIntall(h, h, 'i') | ||
# return -1 |
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.
The original example used this undefined resolved
variable. I have no clue how it should be set so that the example makes sense.
# FIXME | ||
# if resolved: | ||
# # ts.addIntall(h, h, 'i') | ||
# return -1 |
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 the same undefined resolved
variable but in a full script example
We agreed that having examples as scripts in the RPM git repository would be ideal (syntax highlighting, the possibility to run them, etc) but for better discoverability, I would like to mention them even from the RPM website. This way they may be easier to find for people searching on Google or the website itself.