Bug 1906490 - Review Request: python-setuptools-rust - Setuptools Rust extension plugin
Summary: Review Request: python-setuptools-rust - Setuptools Rust extension plugin
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Fabio Valentini
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-10 16:12 UTC by Christian Heimes
Modified: 2021-01-14 20:19 UTC (History)
3 users (show)

Fixed In Version: python-setuptools-rust-0.11.6-1.fc34
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-01-14 20:19:50 UTC
Type: ---
Embargoed:
decathorpe: fedora-review+


Attachments (Terms of Use)

Description Christian Heimes 2020-12-10 16:12:03 UTC
Spec URL: https://cheimes.fedorapeople.org/python-setuptools-rust/python-setuptools-rust.spec
SRPM URL: https://cheimes.fedorapeople.org/python-setuptools-rust/python-setuptools-rust-0.11.5-1.fc32.src.rpm
Description: Setuptools helpers for Rust Python extensions. Compile and distribute Python extensions written in Rust as easily as if they were written in C.
Fedora Account System Username: cheimes

Comment 1 Christian Heimes 2020-12-10 16:14:10 UTC
The upcoming release 3.4 of python-cryptography is going to depend on Rust components. The project uses https://pypi.org/project/setuptools-rust/ and PyO3 to build a Rust Python extension.

Comment 2 Christian Heimes 2020-12-11 10:33:18 UTC
I have updated the spec file after getting feedback from Petr Viktorin.

* I have replaced 0001-setupcfg-version.patch with "sed -i '/\[metadata\]/a version = %{version}' setup.cfg" in %prep section
* Use "%{pypi_source setuptools-rust}" instead of "%{pypi_source}" with implicit use of "%{pypi_name}"
* Specfile now hard codes "setuptools-rust" instead of using %{pypi_name}

Comment 3 Fabio Valentini 2020-12-11 11:22:44 UTC
I think you'll need to patch at least some of the setuptools-rust code to make it work with Rust packages on fedora, primarily the functions that wrap cargo calls. Otherwise those won't be able to see / use system-installed rust libraries (including PyO3).

Comment 4 Christian Heimes 2020-12-11 12:18:04 UTC
The updated package builds successfully on F33 and rawhide, https://copr.fedorainfracloud.org/coprs/cheimes/python-cryptography-rust/

Some packages on Fedora 32 are too old to build setuptools-rust correctly. setuptools and setuptools_scm are outdated. That's ok. I'm planning to update and support Fedora 32 any way.

Comment 5 Christian Heimes 2020-12-11 13:06:31 UTC
(In reply to Fabio Valentini from comment #3)
> I think you'll need to patch at least some of the setuptools-rust code to
> make it work with Rust packages on fedora, primarily the functions that wrap
> cargo calls. Otherwise those won't be able to see / use system-installed
> rust libraries (including PyO3).

That is hard to test without a PyO3 RPM. I would prefer to figure out modifications after python-setuptools-rust and PyO3 crate have been packaged for Fedora. Consumers of python-setuptools-rust may need to use /usr/lib/rpm/macros.d/macros.cargo.

Comment 6 Fabio Valentini 2021-01-13 13:18:01 UTC
rust-pyo3 and rust-cpython (the two backends supported by setuptools-rust) are now both packaged for rawhide / f34+.

Comment 7 Fabio Valentini 2021-01-14 09:53:14 UTC
Several comments I'd like to make before a final / formal review:

1) please update to 0.11.6, it was released a month ago

2) Version 0.11.6 apparently requires setuptools >= 46.1, adapt the version in your BRs and Requires.

3) These explicit Requires are not necessary:
Requires:       python3-semantic_version >= 2.6.0
Requires:       python3-toml >= 0.9.0

They are 1:1 encoded by the python package metadata like this, so the dependency generator will automatically add those for you.
(See /usr/lib/python3.9/site-packages/setuptools_rust-0.11.5-py3.9.egg-info/requires.txt in the built RPM.)

3) If you expect users of this package to have to use %cargo macros from fedora, you could just add "Requires: rust-packaging".
rust-packaging automatically pulls in cargo, rustc, and the package containing Rust macros.

4) Add trailing slashes to the directories listed in %files:

%{python3_sitelib}/setuptools_rust/
%{python3_sitelib}/setuptools_rust-%{version}-py%{python3_version}.egg-info/

This prevents issues should those ever be changed to files (or vice-versa).

Comment 8 Christian Heimes 2021-01-14 11:41:01 UTC
Thanks for the review! I have addressed your comments and updated the spec and source file. The new SRPM is https://cheimes.fedorapeople.org/python-setuptools-rust/python-setuptools-rust-0.11.6-1.fc33.src.rpm

$ rpm -qR python3-setuptools-rust-0.11.6-1.fc33.noarch.rpm
python(abi) = 3.9
python3.9dist(semantic-version) >= 2.6
python3.9dist(toml) >= 0.9
python3dist(setuptools) >= 46.1
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsZstd) <= 5.4.18-1
rust-packaging

Comment 9 Fabio Valentini 2021-01-14 17:15:24 UTC
Ok, a few minor issues / suggestions are left:

0) Rust is only available on a "limited" set of architectures, where "limited"
means that it currently supports all officially supported arches, but not more. :)

You could add "ExclusiveArch:  %{rust_arches}" below "BuildArch:      noarch" to encode this,
but I don't think that this will really be necessary. Your call.

1) bogus date in changelog: Thu Jan 10 2021 (probably a typo, should be Thu Jan 14)

2) If setuptools is really required at runtime, can this be added upstream?
I see imports from setuptools in the code, so it seems likely that it's actually a dependency at runtime.
Probably "setuptools>=46.1" should be added to "install_requires" options in "setup.cfg",
then it would also be automatically added as a dependency by the RPM dep generator.

3) %python_provide is deprecated:
https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_the_py_provides_macro

For Fedora 33+, you should be able to just drop his line entirely.
(I only verified this on rawhide.)

4) You can drop the comment about setuptools < 42, >= 46.1 is required now anyway.

5) You could add "CHANGELOG.md" to the %doc line in %files.
While this is not required, I always find it nice to have this included in packages for "offline" use.

6) You can remove the comment about the .spec file being generated by pyp2rpm.
With all the modifications you had to make, it's hardly worth mentioning ...


With those issues fixed (or suggestions considered), I will approve the package.

Full fedora-review output / template below.


==============
Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated
[ ] = Manual review needed



===== MUST items =====

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: License field in the package spec file matches the actual license.
[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[-]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Package is not known to require an ExcludeArch tag.
[-]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[x]: Package requires other packages for directories it uses.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

Python:
[x]: Python eggs must not download any dependencies during the build
     process.
[x]: A package which is used by another package via an egg interface should
     provide egg info.
[x]: Package meets the Packaging Guidelines::Python
[x]: Package contains BR: python2-devel or python3-devel
[x]: Packages MUST NOT have dependencies (either build-time or runtime) on
     packages named with the unversioned python- prefix unless no properly
     versioned package exists. Dependencies on Python packages instead MUST
     use names beginning with python2- or python3- as appropriate.
[x]: Python packages must not contain %{pythonX_site(lib|arch)}/* in %files
[x]: Binary eggs must be removed in %prep

===== SHOULD items =====

Generic:
[-]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[?]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
[-]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[?]: Package should compile and build into binary rpms on all supported
     architectures.
[-]: %check is present and all tests pass.
[x]: Packages should try to preserve timestamps of original installed
     files.
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on all installed packages.
     Note: No rpmlint messages.
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: python3-setuptools-rust-0.11.6-1.fc34.noarch.rpm
          python-setuptools-rust-0.11.6-1.fc34.src.rpm
python-setuptools-rust.src: E: specfile-error warning: bogus date in %changelog: Thu Jan 10 2021 Christian Heimes <cheimes> - 0.11.6-1
2 packages and 0 specfiles checked; 1 errors, 0 warnings.




Rpmlint (installed packages)
----------------------------
1 packages and 0 specfiles checked; 0 errors, 0 warnings.



Source checksums
----------------
https://files.pythonhosted.org/packages/source/s/setuptools-rust/setuptools-rust-0.11.6.tar.gz :
  CHECKSUM(SHA256) this package     : a5b5954909cbc5d66b914ee6763f81fa2610916041c7266105a469f504a7c4ca
  CHECKSUM(SHA256) upstream package : a5b5954909cbc5d66b914ee6763f81fa2610916041c7266105a469f504a7c4ca


Requires
--------
python3-setuptools-rust (rpmlib, GLIBC filtered):
    python(abi)
    python3.9dist(semantic-version)
    python3.9dist(toml)
    python3dist(setuptools)
    rust-packaging



Provides
--------
python3-setuptools-rust:
    python-setuptools-rust
    python3-setuptools-rust
    python3.9-setuptools-rust
    python3.9dist(setuptools-rust)
    python3dist(setuptools-rust)



Generated by fedora-review 0.7.6 (b083f91) last change: 2020-11-10
Command line :/usr/bin/fedora-review -n python-setuptools-rust -m fedora-rawhide-x86_64
Buildroot used: fedora-rawhide-x86_64
Active plugins: Shell-api, Python, Generic
Disabled plugins: Perl, R, Haskell, SugarActivity, PHP, C/C++, fonts, Ocaml, Java
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 10 Christian Heimes 2021-01-14 17:53:25 UTC
0) Let's do it right from the beginning. I have added "BuildRequires:  rust-packaging" and "ExclusiveArch:  %{rust_arches}".

1) Fixed the the typo in changelog date.

2) I have opened https://github.com/PyO3/setuptools-rust/pull/102 . In the mean time let's keep the manual requirement. I'll remove it when there is a version of setuptools_rust with the fix available.

3) I didn't know that %python_provide is deprecated. I have replaced it with %py_provides

4) The comment is gone.

5) Good idea, CHANGELOG.md is now included.

6) pyp2rpm comment is gone


https://cheimes.fedorapeople.org/python-setuptools-rust/ contains updated spec file and SRPM.

Comment 11 Fabio Valentini 2021-01-14 18:02:45 UTC
Thanks for opening the upstream PR!

ad 3), you can drop the "%py_provides" call as well.
It's only required if you want to tweak the automatic behaviour for backwards compatibility, according to the docs:
https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_the_py_provides_macro

Other than that, looks good now. Package approved :stamp:

Comment 12 Gwyn Ciesla 2021-01-14 20:00:45 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/python-setuptools-rust


Note You need to log in before you can comment on or make changes to this bug.