Bug 2164882 - Review Request: python-pyrate-limiter - The request rate limiter using Leaky-bucket algorithm
Summary: Review Request: python-pyrate-limiter - The request rate limiter using Leaky-...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Ben Beasley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-26 19:47 UTC by Steve Cossette
Modified: 2023-02-06 15:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-02-06 15:30:50 UTC
Type: ---
Embargoed:
code: fedora-review+


Attachments (Terms of Use)

Description Steve Cossette 2023-01-26 19:47:41 UTC
Spec URL: https://api.nicehomeservices.com/images/temp/python-pyrate-limiter.spec
SRPM URL: https://api.nicehomeservices.com/images/temp/python-pyrate-limiter-2.8.5-1.fc37.src.rpm
Description: The request rate limiter using Leaky-bucket algorithm.
Fedora Account System Username: farchord

Comment 1 Steve Cossette 2023-01-26 19:49:37 UTC
By the way there's an upstream issue with this package. They do have a github, but the github has a setup.py-less release as the latest. And, pypi has a newer version that has the setup.py in it. So for now I used that as a source, but as the URLs for releases on pypi seem to be hashed, I can't (to my knowledge) make a "macro" in my spec file for it. I submitted a request upstream to have this and future versions uploaded to github for ease of management, but until then, I was thinking this probably wasn't a big enough deal not to release.

Comment 2 Ben Beasley 2023-01-27 15:52:16 UTC
Preliminary requests:

- Port to “new Python guidelines”: https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/

- See if you can run any of the tests, or if they all need network/database servers/etc.; since the PyPI sdist lacks tests, you would need to package from a GitHub archive. It would be nice if upstream could tag the last few releases, but it seems straightforward enough to identify the commits corresponding to the PyPI releases in this case, e.g. https://github.com/vutran1710/PyrateLimiter/archive/cbdd3c6544d50319f183c86dcdaa20803cbfa878/PyrateLimiter-cbdd3c6544d50319f183c86dcdaa20803cbfa878.tar.gz is the source for 2.8.5.

I’m happy to help if you run into obstacles or it’s not obvious what to do for any of these.

Comment 3 Ben Beasley 2023-01-27 15:54:10 UTC
If you haven’t investigated rpmautospec, take a look at it. You might or might not find it useful. I like it, but some people don’t. Its use is not mandatory, and won’t become mandatory in the near future.

https://docs.pagure.org/Fedora-Infra.rpmautospec/

Comment 4 Steve Cossette 2023-01-27 16:38:59 UTC
Updated the spec and source rpm. Pointed to a lower version currently posted on github. I'll update the package once it's posted on github at a future date.

And I'll check rpmautospec, thanks!

Comment 5 Ben Beasley 2023-01-28 15:07:35 UTC
Package Review
==============

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

===== Issues =====

- This is not needed and should be removed:

    BuildRequires:  python3-setuptools

- The Summary should not end with a period:

    Summary:        The request rate limiter using Leaky-bucket algorithm. 

  This is flagged by rpmlint:

    python-pyrate_limiter.src: W: summary-ended-with-dot The request rate limiter using Leaky-bucket algorithm.
    python3-PyrateLimiter.noarch: W: summary-ended-with-dot The request rate limiter using Leaky-bucket algorithm.

- The LICENSE file installed directly in site-packages is an upstream packaging
  error and should be removed. Try:

    %install
    %pyproject_install
    %pyproject_save_files pyrate_limiter
    # LICENSE file is installed directly in site-packages
    # https://github.com/vutran1710/PyrateLimiter/issues/92
    rm '%{buildroot}%{python3_sitelib}/LICENSE'

  and omit from %files:

    %{python3_sitelib}/LICENSE

- You should add:

    %doc CHANGELOG.md

- A nicer source URL would be:

    Source0:        https://github.com/vutran1710/PyrateLimiter/archive/v%{version}/PyrateLimiter-%{version}.tar.gz

  which, if you liked, you could shorten to:

    Source0:        %{url}/archive/v%{version}/PyrateLimiter-%{version}.tar.gz

- The package SHOULD be named using the canonical project name:

    https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_library_naming

  In this case, that means the base package really ought to be
  python-pyrate-limiter instead of python-pyrate_limiter, and the subpackage
  for the binary RPM should be python3-pyrate-limiter instead of
  python3-PyrateLimiter.

- Wherever possible, you should have metapackages for the Extras:

    https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#Extras

  You would use:

    %pyproject_buildrequires -x all

  and add:

    %pyproject_extras_subpkg -n python3-pyrate-limiter all

  However, in this case redis is pinned to an old version and redis-py-cluster
  is not packaged, so you don’t actually need to change anything. At most, you
  might add a comment about the dependency problem.

    Problem 1: nothing provides requested (python3dist(redis) < 4~~ with python3dist(redis) >= 3.3)
    Problem 2: nothing provides requested (python3dist(redis-py-cluster) < 3~~ with python3dist(redis-py-cluster) >= 2.1.3)

- We can run the upstream tests.

  I added:

    # Test dependencies, taken from [tool.poetry.dev-dependencies]:
    
    # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
    # Don’t BR: coverage, flake8_polyfill, pre-commit, pytest-cov.
    #
    # We use pytest directly, so we don’t need: nox, nox-poetry
    #
    # Upstream runs tests in parallel, but we find there are race conditions;
    # therefore, we do not need: pytest-xdist
    #
    # These appear to be unused: logzero, PyYAML, schedule
    
    # Since we can only work with what’s packaged, let’s convert SemVer pins to
    # lower bounds for test dependencies, dealing with possible future test
    # failures if and when they happen.
    
    # Django = "^3.2.8"
    BuildRequires:  %{py3_dist Django} >= 3.2.8
    # django-redis = "^5.0.0"
    # Currently too old:
    # https://bugzilla.redhat.com/show_bug.cgi?id=1445556
    # BuildRequires:  %%{py3_dist django-redis} >= 5
    # fakeredis = "^1.1.0"
    # Not yet packaged:
    # BuildRequires:  %%{py3_dist fakeredis} >= 1.1
    # pytest = "^6.2"
    BuildRequires:  %{py3_dist pytest} >= 6.2
    # pytest-asyncio = "^0.12"
    BuildRequires:  %{py3_dist pytest-asyncio} >= 0.12

  Then I replaced:

    %pyproject_check_import pyrate_limiter

  with:

    # Needs python3dist(fakeredis)
    ignore="${ignore-} --ignore=tests/test_02.py"
    # Needs python3dist(django-redis)
    ignore="${ignore-} --ignore=tests/test_with_django.py"
    %pytest -v ${ignore-}

   I also needed a patch:

     # Allow for sleep to be called more times than expected
     # https://github.com/vutran1710/PyrateLimiter/pull/93
     Patch:          %{url}/pull/93.patch

  https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_tests

- You can package the latest version even without the git tag:

    Version:        2.8.5
    Release:        1%{?dist}

  and

    # Missing git tag:
    #   Build on pypi is not on github?
    #   https://github.com/vutran1710/PyrateLimiter/issues/91
    # It is clear which commit corresponds to the PyPI release. We eschew the
    # snapinfo field that would normally be needed for packaging from a particular
    # commit, since this is equivalent to packaging from the missing tag.
    %global commit 103252ca8d5336dc19b69fda6b65798eac932fd2
    Source0:        %{url}/archive/%{commit}/PyrateLimiter-%{commit}.tar.gz

  and

    %autosetup -p1 -n PyrateLimiter-%{commit}

===== 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.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "Unknown or generated", "MIT License". 32 files have unknown
     license. Detailed output of licensecheck in
     /home/ben/Downloads/2164882-python-pyrate_limiter/licensecheck.txt

     Confirmed the LICENSE file matches SPDX MIT.

[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.
     Note: Documentation size is 20480 bytes in 1 files.
[x]: Package complies to the Packaging Guidelines

     (unless otherwise mentioned)

[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).
[x]: Package functions as described.

     (When I add tests, they pass.)

[!]: Latest version is packaged.

     Adequately justified due to missing git tags, but packaging from the
     commit should be possible.

[x]: Package does not include license text files separate from upstream.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[x]: Package should compile and build into binary rpms on all supported
     architectures.
[x]: %check is present and all tests pass.

     However, we should run the upstream tests.

[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: There are rpmlint messages (see attachment).
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: python3-PyrateLimiter-2.8.2-1.fc38.noarch.rpm
          python-pyrate_limiter-2.8.2-1.fc38.src.rpm
=========================================== rpmlint session starts ===========================================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
rpmlintrc: [PosixPath('/tmp/tmpzlyy_2ej')]
checks: 31, packages: 2

python-pyrate_limiter.src: W: summary-ended-with-dot The request rate limiter using Leaky-bucket algorithm.
python3-PyrateLimiter.noarch: W: summary-ended-with-dot The request rate limiter using Leaky-bucket algorithm.
============ 2 packages and 0 specfiles checked; 0 errors, 2 warnings, 0 badness; has taken 0.7 s ============




Rpmlint (installed packages)
----------------------------
============================ rpmlint session starts ============================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 31, packages: 1

python3-PyrateLimiter.noarch: W: summary-ended-with-dot The request rate limiter using Leaky-bucket algorithm.
 1 packages and 0 specfiles checked; 0 errors, 1 warnings, 0 badness; has taken 0.0 s 



Source checksums
----------------
https://github.com/vutran1710/PyrateLimiter/archive/refs/tags/v2.8.2.tar.gz :
  CHECKSUM(SHA256) this package     : f027a43952e9f121647969e8ef67549d31c6f645cc2bd109a63d77997595ae33
  CHECKSUM(SHA256) upstream package : f027a43952e9f121647969e8ef67549d31c6f645cc2bd109a63d77997595ae33


Requires
--------
python3-PyrateLimiter (rpmlib, GLIBC filtered):
    python(abi)



Provides
--------
python3-PyrateLimiter:
    python-PyrateLimiter
    python3-PyrateLimiter
    python3.11-PyrateLimiter
    python3.11dist(pyrate-limiter)
    python3dist(pyrate-limiter)



Generated by fedora-review 0.9.0 (6761b6c) last change: 2022-08-23
Command line :/usr/bin/fedora-review -b 2164882 -o --no-cleanup-after --no-clean --enablerepo=local
Buildroot used: fedora-rawhide-x86_64
Active plugins: Python, Generic, Shell-api
Disabled plugins: fonts, Perl, Ocaml, SugarActivity, R, Java, Haskell, PHP, C/C++
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 6 Steve Cossette 2023-01-28 18:32:04 UTC
Thanks for all the work, I'm guessing it wasn't easy to investigate all of this. I'm still new to packaging python packages.

I applied all your changes and refreshed the sources. Building on f37 works, but when I build on rawhide using fedora-review, python tests fail with this:

=================================== FAILURES ===================================
______________ test_concurrency[ProcessPoolExecutor-SQLiteBucket] ______________
concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib64/python3.11/concurrent/futures/process.py", line 256, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/concurrent/futures/process.py", line 205, in _process_chunk
    return [fn(*args) for args in chunk]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/concurrent/futures/process.py", line 205, in <listcomp>
    return [fn(*args) for args in chunk]
            ^^^^^^^^^
  File "/builddir/build/BUILD/PyrateLimiter-103252ca8d5336dc19b69fda6b65798eac932fd2/tests/test_concurrency.py", line 75, in _send_request
    with limiter.ratelimit(*bucket_ids, delay=True):
  File "/builddir/build/BUILD/PyrateLimiter-103252ca8d5336dc19b69fda6b65798eac932fd2/pyrate_limiter/limit_context_decorator.py", line 66, in __enter__
    self.delayed_acquire()
  File "/builddir/build/BUILD/PyrateLimiter-103252ca8d5336dc19b69fda6b65798eac932fd2/pyrate_limiter/limit_context_decorator.py", line 82, in delayed_acquire
    self.try_acquire()
  File "/builddir/build/BUILD/PyrateLimiter-103252ca8d5336dc19b69fda6b65798eac932fd2/pyrate_limiter/limiter.py", line 92, in try_acquire
    volume = bucket.size()
             ^^^^^^^^^^^^^
  File "/builddir/build/BUILD/PyrateLimiter-103252ca8d5336dc19b69fda6b65798eac932fd2/pyrate_limiter/sqlite_bucket.py", line 95, in size
    self._size = self._query_size()
                 ^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/PyrateLimiter-103252ca8d5336dc19b69fda6b65798eac932fd2/pyrate_limiter/sqlite_bucket.py", line 100, in _query_size
    return self.connection.execute(f"SELECT COUNT(*) FROM {self.table}").fetchone()[0]
           ^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/PyrateLimiter-103252ca8d5336dc19b69fda6b65798eac932fd2/pyrate_limiter/sqlite_bucket.py", line 73, in connection
    self._connection.execute(
sqlite3.OperationalError: database is locked
"""
The above exception was the direct cause of the following exception:
executor_class = <class 'concurrent.futures.process.ProcessPoolExecutor'>
bucket_class = <class 'pyrate_limiter.sqlite_bucket.SQLiteBucket'>
    @pytest.mark.parametrize("bucket_class", [SQLiteBucket])
    @pytest.mark.parametrize("executor_class", [ThreadPoolExecutor, ProcessPoolExecutor])
    def test_concurrency(executor_class, bucket_class):
        """Make a fixed number of concurrent requests using a shared Limiter, and check the total time
        they take to run
        """
        logger.info(f"Testing {bucket_class.__name__} with {executor_class.__name__}")
    
        # Set up limiter
        bucket_kwargs = {
            "path": join(gettempdir(), f"test_{executor_class.__name__}.sqlite"),
        }
        limiter = Limiter(
            RequestRate(LIMIT_REQUESTS_PER_SECOND, Duration.SECOND),
            bucket_class=bucket_class,
            bucket_kwargs=bucket_kwargs,
        )
    
        # Set up request function
        bucket_ids = [f"{executor_class.__name__}_bucket_{i}" for i in range(N_BUCKETS)]
        start_time = perf_counter()
        request_func = partial(_send_request, limiter, bucket_ids, start_time)
    
        # Distribute requests across workers
        with executor_class(max_workers=N_WORKERS) as executor:
>           list(executor.map(request_func, range(N_REQUESTS), timeout=300))
tests/test_concurrency.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.11/concurrent/futures/process.py:597: in _chain_from_iterable_of_lists
    for element in iterable:
/usr/lib64/python3.11/concurrent/futures/_base.py:621: in result_iterator
    yield _result_or_cancel(fs.pop(), end_time - time.monotonic())
/usr/lib64/python3.11/concurrent/futures/_base.py:317: in _result_or_cancel
    return fut.result(timeout)
/usr/lib64/python3.11/concurrent/futures/_base.py:449: in result
    return self.__get_result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = None
    def __get_result(self):
        if self._exception:
            try:
>               raise self._exception
E               sqlite3.OperationalError: database is locked
/usr/lib64/python3.11/concurrent/futures/_base.py:401: OperationalError
----------------------------- Captured stderr call -----------------------------
INFO:pyrate_limiter.tests:Testing SQLiteBucket with ProcessPoolExecutor
------------------------------ Captured log call -------------------------------
INFO     pyrate_limiter.tests:test_concurrency.py:38 Testing SQLiteBucket with ProcessPoolExecutor
=========================== short test summary info ============================
FAILED tests/test_concurrency.py::test_concurrency[ProcessPoolExecutor-SQLiteBucket]
=================== 1 failed, 54 passed in 209.79s (0:03:29) ===================

This doesn't happen on f37 though so I'm not even sure what database it's talking about

Thanks again for your help!

Comment 7 Ben Beasley 2023-01-29 16:33:28 UTC
This is why I didn’t run the tests in parallel:

# Upstream runs tests in parallel, but we find there are race conditions;
# therefore, we do not need: pytest-xdist

I thought that fixed it, but based on what you’re seeing, there’s a real upstream bug that this test is revealing.

I thought about reporting it upstream, but there were dependency issues in PyPI land and I couldn’t run the tests the way uptstream does. It seems like that’s fixed today, and I can try it outside of the RPM build.

For now, I would say you can remove

  #
  # Upstream runs tests in parallel, but we find there are race conditions;
  # therefore, we do not need: pytest-xdist

and add

  # pytest-xdist = "^2.5.0"
  BuildRequires:  %{py3_dist pytest-xdist} >= 0.12

and change

  %pytest -v ${ignore-}

to

  # Flaky failures in test_concurrency
  # https://github.com/vutran1710/PyrateLimiter/issues/94
  k="${k-}${k+ and }not test_concurrency[ProcessPoolExecutor-SQLiteBucket]
  %pytest -v -n auto ${ignore-} -k "${k-}"

Comment 8 Steve Cossette 2023-01-29 21:49:57 UTC
Done, updated the spec and srpm. I modified your instructions only slightly, the "k=" line didn't end with a closing " which caused an error.

Both mock and fedora-review generated the package successfully.

Comment 9 Ben Beasley 2023-02-03 20:48:13 UTC
Edited the title to precisely match the base package name and summary (without trailing “.”).

Comment 10 Ben Beasley 2023-02-03 20:53:47 UTC
Looks good to me! The package is APPROVED.

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

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



===== 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.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "Unknown or generated", "MIT License". 32 files have unknown
     license. Detailed output of licensecheck in
     /home/ben/Downloads/2164882-python-
     pyrate_limiter/20220202/2164882-python-pyrate-limiter/licensecheck.txt

     Licesne text is (SPDX) MIT.

[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.
     Note: Documentation size is 30720 bytes in 2 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: No rpmlint messages.
[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).
[x]: Package functions as described.

     (based on tests passing)

[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[x]: Patches link to upstream bugs/comments/lists or are otherwise
     justified.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[x]: Package should compile and build into binary rpms on all supported
     architectures.
[x]: %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-pyrate-limiter-2.8.5-1.fc38.noarch.rpm
          python-pyrate-limiter-2.8.5-1.fc38.src.rpm
=============================================== rpmlint session starts ===============================================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
rpmlintrc: [PosixPath('/tmp/tmpdijwzqkw')]
checks: 31, packages: 2

================ 2 packages and 0 specfiles checked; 0 errors, 0 warnings, 0 badness; has taken 0.6 s ================




Rpmlint (installed packages)
----------------------------
============================ rpmlint session starts ============================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 31, packages: 1

 1 packages and 0 specfiles checked; 0 errors, 0 warnings, 0 badness; has taken 0.0 s 



Source checksums
----------------
https://github.com/vutran1710/PyrateLimiter/archive/103252ca8d5336dc19b69fda6b65798eac932fd2/PyrateLimiter-103252ca8d5336dc19b69fda6b65798eac932fd2.tar.gz :
  CHECKSUM(SHA256) this package     : 0f4a6fb31943317556e3b65477cbd7cde46e829268f433280c1cc8fff1ea559d
  CHECKSUM(SHA256) upstream package : 0f4a6fb31943317556e3b65477cbd7cde46e829268f433280c1cc8fff1ea559d


Requires
--------
python3-pyrate-limiter (rpmlib, GLIBC filtered):
    python(abi)



Provides
--------
python3-pyrate-limiter:
    python-pyrate-limiter
    python3-pyrate-limiter
    python3.11-pyrate-limiter
    python3.11dist(pyrate-limiter)
    python3dist(pyrate-limiter)



Generated by fedora-review 0.9.0 (6761b6c) last change: 2022-08-23
Command line :/usr/bin/fedora-review -b 2164882
Buildroot used: fedora-rawhide-x86_64
Active plugins: Generic, Shell-api, Python
Disabled plugins: Perl, Java, SugarActivity, C/C++, Ocaml, R, PHP, Haskell, fonts
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 11 Fedora Admin user for bugzilla script actions 2023-02-05 21:45:02 UTC
The Pagure repository was created at https://src.fedoraproject.org/rpms/python-pyrate-limiter

Comment 12 Steve Cossette 2023-02-05 22:12:56 UTC
So, building for f36/f37/rawhide worked. Epel9 didn't though:

DEBUG util.py:443:  No matches found for the following disable plugin patterns: local, spacewalk, versionlock
DEBUG util.py:443:  No matching package to install: 'python3dist(django) >= 3.2.8'
DEBUG util.py:443:  Not all dependencies satisfied
DEBUG util.py:443:  Error: Some packages could not be found.

Seems this may be related:
https://bugzilla.redhat.com/show_bug.cgi?id=2033064
Though that bug seems to be stale. Does this sound right?

Comment 13 Ben Beasley 2023-02-06 13:23:44 UTC
(In reply to Steve Cossette from comment #12)
> So, building for f36/f37/rawhide worked. Epel9 didn't though:
> 
> DEBUG util.py:443:  No matches found for the following disable plugin
> patterns: local, spacewalk, versionlock
> DEBUG util.py:443:  No matching package to install: 'python3dist(django) >=
> 3.2.8'
> DEBUG util.py:443:  Not all dependencies satisfied
> DEBUG util.py:443:  Error: Some packages could not be found.
> 
> Seems this may be related:
> https://bugzilla.redhat.com/show_bug.cgi?id=2033064
> Though that bug seems to be stale. Does this sound right?

The Django dependency is only for integration tests in tests/test_with_django.py. Right now you can’t run those because even Rawhide has a too-old version of django-redis. So you should just omit the Django BuildRequires using a conditional or as a change to the EPEL9 branch only, e.g.:

diff --git a/python-pyrate-limiter.spec b/python-pyrate-limiter.spec
index f4fdc46..27095de 100644
--- a/python-pyrate-limiter.spec
+++ b/python-pyrate-limiter.spec
@@ -32,8 +32,11 @@ BuildRequires:  python3-devel
 # lower bounds for test dependencies, dealing with possible future test
 # failures if and when they happen.
 
+# The version of Django in EPEL9 is too old.
+%if ! 0%{?el9}
 # Django = "^3.2.8"
 BuildRequires:  %{py3_dist Django} >= 3.2.8
+%endif
 # pytest-xdist = "^2.5.0"
 BuildRequires:  %{py3_dist pytest-xdist} >= 0.12
 # django-redis = "^5.0.0"
@@ -86,6 +89,7 @@ rm '%{buildroot}%{python3_sitelib}/LICENSE'
 # Needs python3dist(fakeredis)
 ignore="${ignore-} --ignore=tests/test_02.py"
 # Needs python3dist(django-redis)
+# The version of Django in EPEL9 is too old.
 ignore="${ignore-} --ignore=tests/test_with_django.py"
 # Flaky failures in test_concurrency
 # https://github.com/vutran1710/PyrateLimiter/issues/94

Once you do that, you’ll encounter:

No matching package to install: 'python3dist(poetry) >= 0.12'

This is because pyproject.toml has

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

and (full) poetry is not available in EPEL9. In fact, it should only need:

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

I asked upstream to switch: https://github.com/vutran1710/PyrateLimiter/pull/96

You can therefore fix this with:

# Use poetry-core for build-system instead of full Poetry
# https://github.com/vutran1710/PyrateLimiter/pull/96
Patch:          %{url}/pull/96.patch

I will follow up with a PR.

Comment 15 Steve Cossette 2023-02-06 15:30:50 UTC
All done, thank you!


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