Bug 1812857

Summary: Review Request: python-ws4py - WebSocket client and server library
Product: [Fedora] Fedora Reporter: Fabien Boucher <fboucher>
Component: Package ReviewAssignee: Miro Hrončok <mhroncok>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: mhroncok, package-review
Target Milestone: ---Flags: mhroncok: fedora-review+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-05 13:45:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fabien Boucher 2020-03-12 10:56:50 UTC
Spec URL: https://fbo.fedorapeople.org/python-ws4py/python-ws4py.spec
SRPM URL: https://fbo.fedorapeople.org/python-ws4py/python-ws4py-0.5.1-2.fc33.src.rpm
Description: WebSocket client and server library
Fedora Account System Username: fbo

Comment 1 Fabien Boucher 2020-03-12 10:57:24 UTC
Scratch build https://koji.fedoraproject.org/koji/taskinfo?taskID=42428949

Comment 2 Miro Hrončok 2020-03-12 12:01:01 UTC
  %build
  %{__python3} setup.py build
  
  %install
  %{__python3} setup.py install -O1 --skip-build --root %{buildroot}


This should nowdays be:


  %build
  %py3_build
  
  %install
  %py3_install


--------------------------

  Requires:       python3-setuptools
  Requires:       python3-cherrypy
  Requires:       python3-tornado
  Requires:       python3-greenlet
  Requires:       python3-gevent

This should use the automatic dependencies instead (possibly by not deleting the requirements.txt file?)

--------------------------

  Requires:       Cython

Same as above + this should be python3-Cython + why there is a runtime dependency on Cython?

--------------------------

  Patch01:        0001-Python-3.7-and-3.8-compat.patch 

This is quite hidden. Could it be moved to the source please? Is there an upstream PR link?

--------------------------

  %defattr(644,root,root,755)

Why is this needed?

--------------------------

  %{python3_sitelib}/*

This is explicitly discouraged in the guidelines. https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_files_to_include

--------------------------


The two "initial packaging" changelog entries are confusing.

Comment 3 Fabien Boucher 2020-03-12 14:30:37 UTC
(In reply to Miro Hrončok from comment #2)
>   %build
>   %{__python3} setup.py build
>   
>   %install
>   %{__python3} setup.py install -O1 --skip-build --root %{buildroot}
> 
> 
> This should nowdays be:
> 
> 
>   %build
>   %py3_build
>   
>   %install
>   %py3_install
> 

fixed.

> --------------------------
> 
>   Requires:       python3-setuptools
>   Requires:       python3-cherrypy
>   Requires:       python3-tornado
>   Requires:       python3-greenlet
>   Requires:       python3-gevent
> 
> This should use the automatic dependencies instead (possibly by not deleting
> the requirements.txt file?)

Upstream requirements are kept in a directory, https://github.com/Lawouach/WebSocket-for-Python/tree/master/requirements and not sure setup.py is using them. So I just refine the Requires.

> --------------------------
> 
>   Requires:       Cython
> 
> Same as above + this should be python3-Cython + why there is a runtime
> dependency on Cython?

I move it to a BuildRequirements. Is it part of the upstream requirements. But everything seems to work w/o it too.

> 
> --------------------------
> 
>   Patch01:        0001-Python-3.7-and-3.8-compat.patch 
> 
> This is quite hidden. Could it be moved to the source please? Is there an
> upstream PR link?

fixed.

> --------------------------
> 
>   %defattr(644,root,root,755)
> 
> Why is this needed?

Removed.

> --------------------------
> 
>   %{python3_sitelib}/*
> 
> This is explicitly discouraged in the guidelines.
> https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/
> #_files_to_include

Ok good to know. Fixed.

> --------------------------
> 
> 
> The two "initial packaging" changelog entries are confusing.

Fixed.

Comment 5 Miro Hrončok 2020-03-12 15:44:45 UTC
> not sure setup.py is using them

Sounds like a fix for upstream?



> I move (Cython) to a BuildRequirements

Why not drop it if it is not used? It seems like it is either a test only requirement, or a leftover.



> %check
> %{__python3} -c "import ws4py"

Have you tired running the tests with pytest? https://github.com/Lawouach/WebSocket-for-Python/blob/master/.travis.yml

Comment 6 Fabien Boucher 2020-03-13 09:26:55 UTC
(In reply to Miro Hrončok from comment #5)
> > not sure setup.py is using them
> 
> Sounds like a fix for upstream?
> 

Yes, I'll see how upstream is responsive with the Compat 3.7 3.8 patch first.

> 
> > I move (Cython) to a BuildRequirements
> 
> Why not drop it if it is not used? It seems like it is either a test only
> requirement, or a leftover.
> 

I've dropped it even in unit tests it seems not used.

> 
> > %check
> > %{__python3} -c "import ws4py"
> 
> Have you tired running the tests with pytest?
> https://github.com/Lawouach/WebSocket-for-Python/blob/master/.travis.yml

I've added the unit tests run in %check.

https://koji.fedoraproject.org/koji/taskinfo?taskID=42444154

Comment 7 Miro Hrončok 2020-03-13 11:51:54 UTC
Thanks. I'm running automated checks now.


Two more nitpicks:

> touch test/__init__.py

Why is this needed?


> %{__python3} setup.py test

Upstream uses pytest here, why not use it directly? The build.log says:

+ /usr/bin/python3 setup.py test
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. 


Also, you can (should?) use %{python3} over %{__python3}.

Comment 8 Miro Hrončok 2020-03-13 12:16:15 UTC
ws4py-0.5.1/ws4py/utf8validator.py seem to be bundled and not BSD licensed, please add the appropriate bundled() provides and change the license to BSD and ASL 2.0 with a comment that explains this.

Also, please add:

%files -n python3-%{srcname}
%license LICENSE
%doc README.md

Comment 9 Fabien Boucher 2020-03-13 14:51:27 UTC
(In reply to Miro Hrončok from comment #7)
> Thanks. I'm running automated checks now.

What tool are you using for that ?

> 
> Two more nitpicks:
> 
> > touch test/__init__.py
> 
> Why is this needed?
> 

The Pypi archive does not include that file. It is needed to run unitests.

[root@fedora31-packaging python-ws4py]# tar -tzf ws4py-0.5.1.tar.gz | grep test
ws4py-0.5.1/test/
ws4py-0.5.1/test/test_client.py
ws4py-0.5.1/test/test_frame.py
ws4py-0.5.1/test/test_cherrypy.py
ws4py-0.5.1/test/test_messaging.py
ws4py-0.5.1/test/test_websocket.py
ws4py-0.5.1/test/test_utils.py
ws4py-0.5.1/test/test_logger.py
ws4py-0.5.1/test/test_stream.py
ws4py-0.5.1/test/test_manager.py


> > %{__python3} setup.py test
> 
> Upstream uses pytest here, why not use it directly? The build.log says:
> 
> + /usr/bin/python3 setup.py test
> running test
> WARNING: Testing via this command is deprecated and will be removed in a
> future version. 
> 
> 
> Also, you can (should?) use %{python3} over %{__python3}.

Using pytest now.

Comment 10 Fabien Boucher 2020-03-13 14:52:04 UTC
(In reply to Miro Hrončok from comment #8)
> ws4py-0.5.1/ws4py/utf8validator.py seem to be bundled and not BSD licensed,
> please add the appropriate bundled() provides and change the license to BSD
> and ASL 2.0 with a comment that explains this.
> 
> Also, please add:
> 
> %files -n python3-%{srcname}
> %license LICENSE
> %doc README.md

Done.

Comment 12 Miro Hrončok 2020-03-13 15:17:43 UTC
(In reply to Fabien Boucher from comment #9)
> (In reply to Miro Hrončok from comment #7)
> > Thanks. I'm running automated checks now.
> 
> What tool are you using for that ?

https://pagure.io/FedoraReview (running from master branch)



> > Two more nitpicks:
> > 
> > > touch test/__init__.py
> > 
> > Why is this needed?
> > 
> 
> The Pypi archive does not include that file. It is needed to run unitests.
> ...
> Using pytest now.

Does pytest need it?

Comment 13 Miro Hrončok 2020-03-13 15:30:48 UTC
Package Review
==============

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


This package is APPROVED.

Please add a comment with a link to the 3.7/3.8 pull request when ready.

Please see if `touch test/__init__.py` is still needed with pytest.



===== 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", "BSD 3-clause "New" or "Revised"
     License", "*No copyright* BSD 3-clause "New" or "Revised" License",
     "Apache License 2.0". 36 files have unknown license.
[x]: If the package is under multiple licenses, the licensing breakdown
     must be documented in the spec.
[-]: 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 10240 bytes in 1 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.
[?]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[!]: 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.
[-]: 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.
[x]: %check is present and all tests pass.
[?]: 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-ws4py-0.5.1-2.fc33.noarch.rpm
          python-ws4py-0.5.1-2.fc33.src.rpm
python-ws4py.src:33: W: unversioned-explicit-provides bundled(utf8validator)
2 packages and 0 specfiles checked; 0 errors, 1 warnings.

This is OK, there is no know version.


Rpmlint (installed packages)
----------------------------
python3-ws4py.noarch: W: invalid-url URL: https://ws4py.readthedocs.org/en/latest/ <urlopen error [Errno -2] Name or service not known>
1 packages and 0 specfiles checked; 0 errors, 1 warnings.

This is OK, my mock has disabled networking.


Source checksums
----------------
https://files.pythonhosted.org/packages/source/w/ws4py/ws4py-0.5.1.tar.gz :
  CHECKSUM(SHA256) this package     : 29d073d7f2e006373e6a848b1d00951a1107eb81f3742952be905429dc5a5483
  CHECKSUM(SHA256) upstream package : 29d073d7f2e006373e6a848b1d00951a1107eb81f3742952be905429dc5a5483


Requires
--------
python3-ws4py (rpmlib, GLIBC filtered):
    python(abi)
    python3-cherrypy
    python3-gevent
    python3-tornado



Provides
--------
python3-ws4py:
    bundled(utf8validator)
    python-ws4py
    python3-ws4py
    python3.8dist(ws4py)
    python3dist(ws4py)



Generated by fedora-review 0.7.0 (fed5495) last change: 2019-03-17
Command line :try-fedora-review -b 1812857 -m fedora-rawhide-x86_64
Buildroot used: fedora-rawhide-x86_64
Active plugins: Generic, Shell-api, Python
Disabled plugins: Haskell, Perl, fonts, PHP, Java, R, SugarActivity, C/C++, Ocaml, Ruby
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 14 Fabien Boucher 2020-03-13 15:33:52 UTC
(In reply to Miro Hrončok from comment #12)
> (In reply to Fabien Boucher from comment #9)
> > (In reply to Miro Hrončok from comment #7)
> > > Thanks. I'm running automated checks now.
> > 
> > What tool are you using for that ?
> 
> https://pagure.io/FedoraReview (running from master branch)
> 
> 
> 
> > > Two more nitpicks:
> > > 
> > > > touch test/__init__.py
> > > 
> > > Why is this needed?
> > > 
> > 
> > The Pypi archive does not include that file. It is needed to run unitests.
> > ...
> > Using pytest now.
> 
> Does pytest need it?

Actually it worked this way, so I've fixed the spec with.
PYTHONPATH=. pytest

Comment 15 Miro Hrončok 2020-03-13 15:37:15 UTC
(In reply to Fabien Boucher from comment #14)
> Actually it worked this way, so I've fixed the spec with.
> PYTHONPATH=. pytest

Try:

%{python3} -m pytest


Docs: https://docs.pytest.org/en/latest/usage.html#calling-pytest-through-python-m-pytest

Benefits:

 - you get PYTHONPATH=. automatically
 - the pytest is invoked with the proper Python version regardless of what /usr/bin/pytest happens to be (it usually matches, but might not e.g. on RHEL with multiple Python versions)

Comment 16 Fabien Boucher 2020-03-13 16:31:38 UTC
Thanks it worked.

Comment 17 Gwyn Ciesla 2020-03-17 13:07:16 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/python-ws4py