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

generate dist-info for Python bindings #447

Merged

Conversation

nitzmahone
Copy link
Contributor

@nitzmahone nitzmahone commented Apr 12, 2023

fixes #446

Note that python3-rpm and python3-gpg are already doing something similar (just using the older and largely deprecated egg-info metadata instead of dist-info).

After build/install with this change:

(dnf5) [root@690bb604ca02 build]# pip list
Package     Version
----------- -------
libdnf5     5.0.7
libdnf5_cli 5.0.7
pip         22.2.2
setuptools  62.6.0

I've also reserved libdnf5 and libdnf5_cli on PyPI, just in case someone decides to try and include one of these in a requirements/freeze file- it would work properly with this change if the OS-packaged libs are present, but don't want to let a malicious party grab those projects and get people installing who-knows-what in the case where they're not installed. Regardless if they're ever used to publish working versions of these (would be nice, hint hint 😉), I'm happy to hand the keys to those PyPI packages over to a maintainer if desired.

* ensures that `libdnf5` and `libdnf5_cli` Python bindings include minimal distribution metadata (per https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata). This makes the presence of the binding and its version visible to standard Python tools like `pip`.
@nitzmahone nitzmahone force-pushed the python_binding_distinfo branch from 8ce551b to 4ffe2e2 Compare April 12, 2023 16:43
@@ -376,6 +376,7 @@ Python 3 bindings for the libdnf library.

%files -n python3-libdnf5
%{python3_sitearch}/libdnf5
%{python3_sitearch}/libdnf5-*.dist-info
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 suppose this could also use the global project major/minor/patch vars to avoid the wildcard- can update that to do so if desired.

@m-blaha m-blaha self-assigned this Apr 13, 2023
@m-blaha
Copy link
Member

m-blaha commented Apr 13, 2023

Thanks for the contribution, much appreciated!

@m-blaha m-blaha merged commit 3f1bf19 into rpm-software-management:main Apr 13, 2023
evan-goode pushed a commit to evan-goode/dnf that referenced this pull request Oct 3, 2023
This is the DNF 4 cousin to this patch [0] for DNF 5.

Per [1], Python packages should include some minimal distribution
metadata, e.g. to make the package appear in `pip list`.

Perhaps the "proper way" to generate this dist-info metadata would be to
write a pyproject.toml and use a conventional Python build system like
Poetry to build `python3-dnf` rather than doing it with CMake, but this
is a way to do it with minimal changes to the build process.

[0] rpm-software-management/dnf5#447
[1] https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata,
evan-goode pushed a commit to evan-goode/dnf that referenced this pull request Oct 3, 2023
This is the DNF 4 cousin to this patch [0] for DNF 5.

Per [1], Python packages should include some minimal distribution
metadata, e.g. to make the package appear in `pip list`.

Perhaps the "proper way" to generate this dist-info metadata would be to
write a pyproject.toml and use a conventional Python build system like
Poetry to build `python3-dnf` rather than doing it with CMake, but this
is a way to do it with minimal changes to the build process.

Closes RhBug:2239323 [2]

[0] rpm-software-management/dnf5#447
[1] https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata,
[2] https://bugzilla.redhat.com/show_bug.cgi?id=2239323

= changelog =
msg: Add metadata for `dnf` Python package
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2239323
evan-goode pushed a commit to evan-goode/dnf that referenced this pull request Oct 6, 2023
This is the DNF 4 cousin to this patch [0] for DNF 5.

Per [1], Python packages should include some minimal distribution
metadata, e.g. to make the package appear in `pip list`.

Perhaps the "proper way" to generate this dist-info metadata would be to
write a pyproject.toml and use a conventional Python build system like
Poetry to build `python3-dnf` rather than doing it with CMake, but this
is a way to do it with minimal changes to the build process.

Closes RhBug:2239323 [2]

[0] rpm-software-management/dnf5#447
[1] https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata,
[2] https://bugzilla.redhat.com/show_bug.cgi?id=2239323

= changelog =
msg: Add metadata for `dnf` Python package
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2239323
jan-kolarik pushed a commit to rpm-software-management/dnf that referenced this pull request Oct 9, 2023
This is the DNF 4 cousin to this patch [0] for DNF 5.

Per [1], Python packages should include some minimal distribution
metadata, e.g. to make the package appear in `pip list`.

Perhaps the "proper way" to generate this dist-info metadata would be to
write a pyproject.toml and use a conventional Python build system like
Poetry to build `python3-dnf` rather than doing it with CMake, but this
is a way to do it with minimal changes to the build process.

Closes RhBug:2239323 [2]

[0] rpm-software-management/dnf5#447
[1] https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata,
[2] https://bugzilla.redhat.com/show_bug.cgi?id=2239323

= changelog =
msg: Add metadata for `dnf` Python package
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2239323
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.

Missing distribution info for Python bindings
2 participants