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

Adding chapter Packaging of Python RPMs #51

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

Daskyleia
Copy link
Contributor

@Daskyleia Daskyleia commented Jun 7, 2018

Resolving BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1429422

This chapter is WIP. Please add any comments to help me make this chapter more informative.

@Daskyleia Daskyleia self-assigned this Jun 7, 2018
@Daskyleia Daskyleia requested a review from pmkovar June 7, 2018 15:18
Copy link
Contributor

@hroncok hroncok left a comment

Choose a reason for hiding this comment

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

I don't see a benefit of this guide. It has Fedora specific links, a RHEL 6/7 specfile example without explanation and that's it.

[id="Converting-PyPI-package-to-an-RPM"]
==== Converting PyPI package to an RPM

Pyp2rpm is a tool which automatically converts PyPI packages to an RPM spec file. Simple tutorial can be found on this page link:https://github.com/fedora-python/pyp2rpm[pyp2rpm].
Copy link
Contributor

Choose a reason for hiding this comment

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

But the tool doesn't support RHEL 7 specfiles. Only Fedora or EPEL.

Copy link

Choose a reason for hiding this comment

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

@hroncok what is the difference between epel and rhel then?

Copy link
Contributor

Choose a reason for hiding this comment

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

Backported Fedora macros. Python 3.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It does support epel. pyp2rpm -o epel6 and similary for epel7

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. But not plain RHEL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can write this in conditionals to make it visible only in community version of the guide, not in the RHEL one.

[id="Common-macros-for-Python-RPM-packages"]
==== Common macros for Python RPM packages

All Python specific RPM macros can be found on this page link:https://fedoraproject.org/wiki/Packaging:Python#Macros[Python packaging macros].
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, the spec file above is RHEL 6/7, but the link is for Fedora. That is very different currently and rather confusing.

Copy link

Choose a reason for hiding this comment

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

Are there at least some macros the same?
Anyway, we might pick at least the macros from the example, and either use the description from Fedora, or write a new one. I don't think we need as comprehensive guide for RHEL, as we have for Fedora, a simple variant should work.
Another thought regarding this is that Fedora macros will be relevant for the next major version of RHEL, so it's also question what RHEL version this guide is focused on..

Copy link
Contributor

Choose a reason for hiding this comment

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

Not really. They all got python version number in Fedora.

Copy link
Contributor

Choose a reason for hiding this comment

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

What RHEL version we target has never been answered to me.

Copy link
Contributor Author

@Daskyleia Daskyleia Jun 11, 2018

Choose a reason for hiding this comment

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

It is written for RHEL7 (RHEL version) and for Fedora (community version) under conditionals. Other versions of RHEL might be written in different paragraphs stating for which version they are written in their headings. The above link to macros was only WIP. I would like to see several most used and useful macros for RHEL7 and for Fedora. We do not need to document them all. Can you please suggest the most used macros for RHEL7 and for Fedora (separately)?

Copy link

@hhorak hhorak left a comment

Choose a reason for hiding this comment

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

Actually I like it is short, and using links to other sources looks like a good way to me. I just added small comments, but generally I think this could be good enough.

[id="Benefits-of-packaging-Python-packages-as-RPMs"]
==== Benefits of packaging Python packages as RPMs

Benefits of packaging Python packages as RPMs are the same as for any other RPM package. More can be found in the chapter xref:Why-Package-Software-with-RPM[].
Copy link

Choose a reason for hiding this comment

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

I'd maybe add some thinking about comparison with working with native python packages, like:
In comparison to native python packages from Python Package Index, RPM allows to specify dependencies on other RPMs, that are not necessary Python packages, RPM also allows to use cryptographic signing to verify content, and deliver packages that are integrated and tested ahead with the rest of the system. On the other hand RPM does not allow users to install Python software as a non-root user or to an arbitrary location.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, good idea.

[id="Converting-PyPI-package-to-an-RPM"]
==== Converting PyPI package to an RPM

Pyp2rpm is a tool which automatically converts PyPI packages to an RPM spec file. Simple tutorial can be found on this page link:https://github.com/fedora-python/pyp2rpm[pyp2rpm].
Copy link

Choose a reason for hiding this comment

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

I'd just add a note that some manual corrections may be necessary, to not set too high expectations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Pyp2rpm is still in development. Some manual corrections might be necessary."

[id="Differences-in-RPM-packages-for-Python-as-a-Software-Collection"]
==== Differences in RPM packages for Python as a Software Collection

Those differences are documented in link:https://www.softwarecollections.org/en/docs/guide/#sect-Enabling_the_Software_Collection[Software Collections].
Copy link

Choose a reason for hiding this comment

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

Internally, we also have this Packaging guide available as part of the RHSCL documentation, so internally we should like there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will be done.

FlowerJustice and others added 9 commits June 11, 2018 15:11

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Link to Python packaging macros added in community ifdef. Python packaging macros for ifdef rhel needs to be added.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Callouts added to "Typical Python RPM package spec file description". Adding table to Common macros for Python RPM packages.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

|python_sitelib
|/usr/lib/python.X.Y/site-packages
|Where pure python modules are installed
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you please make a suggestion what are those modules and what does "pure" means?

Copy link
Contributor

Choose a reason for hiding this comment

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

python modules https://docs.python.org/2/tutorial/modules.html

pure python - written only in Python (as opposed to extension modules compiled from languages like C, C++ or Fortran)

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@xsuchy
Copy link
Collaborator

xsuchy commented May 27, 2020

This seems to be stuck. Can you please rebase it? And make it up to date (python3)?

@xsuchy
Copy link
Collaborator

xsuchy commented Sep 2, 2021

@Daskyleia ping

@hroncok
Copy link
Contributor

hroncok commented Sep 2, 2021

@xsuchy I think that @Daskyleia has left Red Hat years ago and never used GitHub since, the profile page shows no activity after this PR.

@xsuchy
Copy link
Collaborator

xsuchy commented Sep 3, 2021

@hroncok thank you. Is someone from the python team willing to finish it, or is it doomed to be closed?

@hroncok
Copy link
Contributor

hroncok commented Sep 3, 2021

I am afraid I still don't understand the purpose of this guide. Do we still need a guide for packaging for RHEL 7? Or is it RHEL 8 now? Or even RHEL 9? Those guides would be different. Essentially this repo says in the README:

Many of the guides I have found around the internet are ... simply showing their age and contain old, incorrect or outdated information.

Yet the pello.spec example would not even build on anything newer than RHEL 7.

What is the purpose of this guide? Who is the target audience and what type of Python software do they package for what distributions?

@xsuchy
Copy link
Collaborator

xsuchy commented Sep 3, 2021

My ultimate goal was to hopefully get rid of RPM Max one day. Which we still have to reference because it is only source for some parts.
The more noble goal is to provide a guide for someone who starts with packaging from scratch.

The guide can generate artifacts for upstream and for RHEL. E.g., see https://github.com/redhat-developer/rpm-packaging-guide/blame/master/source/advanced-topics.adoc#L611

The guide should be introductory and is meant for beginners. Speaking of python I would keep it as minimal as possible and reference the Python section from Fedora Packaging Guidelines.

@hroncok
Copy link
Contributor

hroncok commented Sep 3, 2021

I have no idea what RPM Max is and I was unable to Google it, as it seems to be the name of some kind of a dagger 🗡️

The Python section from Fedora Packaging Guidelines is not present-RHEL compatible. If you target RHEL 9+ only, feel free to do so, but in the next years, it might not be RHEL9 compatible either.

There is also https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_201x/ which is more or less compatible with EPEL 8, but not entirely and not with pure RHEL 8. It is extremely incompatible with RHEL 7.

The more noble goal is to provide a guide for someone who starts with packaging from scratch.

Something like this? https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/

The guide can generate artifacts for upstream and for RHEL...

An if RHEL knob is certainly nice for small differences, but for Python, it would essentially be:

if RHEL 7:
  here be a guide
elif RHEL 8:
  here be a different guide
elif RHEL 9 or Fedora:
  here be a link to Fedora's Python packaging guidelines
endif

I'd like to help here, but I still don't understand what kind of a guide you are looking for (and I didn't understand that 3 years ago either). Back to my question:

Who is the target audience and what type of Python software do they package for what distributions?

You said they are beginners. But what are they trying to accomplish? I cannot imagine a simple "beginners' guide to packaging Python RPM packages" because the topic is too wide. There might be "simple" guides for straightforward tasks, e.g.:

  • taking a Python library package from PyPI (or an internal Python package index) and turning it into an RPM package for RHEL 8
  • taking a Python 3 application package from PyPI and turning it into an RPM package for Fedora 33+
  • taking a standalone Python 2 script and packaging it into an RPM package for RHEL 7 (that's more or less what pello.spec does now, in a weird but hopefully functional way)

@hroncok
Copy link
Contributor

hroncok commented Sep 3, 2021

I have no idea what RPM Max is and I was unable to Google it, as it seems to be the name of some kind of a dagger dagger

Oh, http://ftp.rpm.org/max-rpm/

@pmkovar
Copy link
Collaborator

pmkovar commented Sep 3, 2021 via email

@xsuchy
Copy link
Collaborator

xsuchy commented Sep 3, 2021

Something like this? https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/

Yes. But more verbose :)

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.

None yet

6 participants