Bug 1941294 - Review Request: python-typer - Typer, build great CLIs. Easy to code. Based on Python type hints
Summary: Review Request: python-typer - Typer, build great CLIs. Easy to code. Based o...
Keywords:
Status: CLOSED DUPLICATE of bug 1964742
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Parag AN(पराग)
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-21 12:24 UTC by Chandan Kumar
Modified: 2021-06-17 15:50 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-17 05:18:46 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Chandan Kumar 2021-03-21 12:24:59 UTC
Spec URL: https://chandankumar.fedorapeople.org/python-typer/python-typer.spec
SRPM URL: https://chandankumar.fedorapeople.org/python-typer/python-typer-0.3.2-1.fc33.src.rpm
Description: 
Typer is a library for building CLI applications that users will love using and developers will love creating. Based on Python 3.6+ type hints.

Fedora Account System Username: chandankumar

Comment 1 Chandan Kumar 2021-03-21 12:26:19 UTC
I tried doing scratch build here: https://kojipkgs.fedoraproject.org//work/tasks/9403/64259403/root.log But the build is failing:
DEBUG util.py:444:  Error: 
DEBUG util.py:444:   Problem: nothing provides requested (python3dist(flit-core) < 3 with python3dist(flit-core) >= 2)
DEBUG util.py:446:  (try to add '--skip-broken' to skip uninstallable packages)

I am new to pyproject toml macro part. Any help would be appreciated.

Comment 2 Sagi Shnaidman 2021-03-21 12:53:22 UTC
This is an unofficial review:

Local mock build fails because of:

+ /usr/bin/python3 -s /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3
Import error: No module named 'toml'

Rpmbuild fails:
ModuleNotFoundError: No module named 'flit_core'

Build in Koji fails because of same:
> Problem: nothing provides requested (python3dist(flit-core) < 3 with python3dist(flit-core) >= 2)

and python-flit is not built for F35:
https://src.fedoraproject.org/rpms/python-flit
Probably worth to fill a bug.

.github, .gitignore and .coveragerc are not necessary and can be removed from RPM package.
docs_src can be dropped if we have docs already in place

Comment 3 Parag AN(पराग) 2021-03-25 07:36:46 UTC
Thanks Sagi for pointing to this package review. I nowadays only review when someone asks me.
I found this package as good opportunity to learn more about pyproject macros.

When build fails which says about "nothing provides" there can be 2 things 
1) package is available but not added as BuildRequires: in spec 
2) Package is not available in Fedora then you need to package that also. 

In above error, we have package python3-flit-core in Fedora but requirements are not satisfying as Fedora's python-flit-core package moved to recent release which is > 3 version

I think this can be adjusted by editing toml file as
sed -i &apos;s/2,&lt;3/2/g&apos; pyproject.toml

I had a look into this package to learn more about pyproject macros.

This package is missing below line along with that some missing test execution BR:'s and usage of %pytest
%pyproject_save_files typer

There are 2 tests which are still failing
=================================== FAILURES ===================================
_____________________________ test_show_completion _____________________________
    def test_show_completion():
        result = subprocess.run(
            [
                "bash",
                "-c",
                f"{sys.executable}  -m coverage run {mod.__file__} --show-completion",
            ],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            encoding="utf-8",
            env={**os.environ, "SHELL": "/bin/bash", "_TYPER_COMPLETE_TESTING": "True"},
        )
>       assert "_TUTORIAL001.PY_COMPLETE=complete_bash" in result.stdout
E       AssertionError: assert '_TUTORIAL001.PY_COMPLETE=complete_bash' in ''
E        +  where '' = CompletedProcess(args=['bash', '-c', '/usr/bin/python3  -m coverage run /builddir/build/BUILD/typer-0.3.2/docs_src/first_steps/tutorial001.py --show-completion'], returncode=1, stdout='', stderr='Shell sh not supported.\n').stdout
tests/test_completion/test_completion.py:21: AssertionError
___________________________ test_install_completion ____________________________
    def test_install_completion():
        bash_completion_path: Path = Path.home() / ".bashrc"
        text = ""
        if bash_completion_path.is_file():  # pragma: nocover
            text = bash_completion_path.read_text()
        result = subprocess.run(
            [
                "bash",
                "-c",
                f"{sys.executable} -m coverage run {mod.__file__} --install-completion",
            ],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            encoding="utf-8",
            env={**os.environ, "SHELL": "/bin/bash", "_TYPER_COMPLETE_TESTING": "True"},
        )
        new_text = bash_completion_path.read_text()
        bash_completion_path.write_text(text)
>       assert "source" in new_text
E       assert 'source' in '# .bashrc\n\n# Source global definitions\nif [ -f /etc/bashrc ]; then\n\t. /etc/bashrc\nfi\n\n# User specific environ...c.d ]; then\n\tfor rc in ~/.bashrc.d/*; do\n\t\tif [ -f "$rc" ]; then\n\t\t\t. "$rc"\n\t\tfi\n\tdone\nfi\n\nunset rc\n'
tests/test_completion/test_completion.py:42: AssertionError
================================================================

Good to report that to upstream about its failure

I think the working SPEC for this package is https://paste.centos.org/view/c75bbef1
Fedora services are down, hence SPEC is added as paste URL.

Comment 4 Parag AN(पराग) 2021-03-25 07:37:13 UTC
Thanks Sagi for pointing to this package review. I nowadays only review when someone asks me.
I found this package as good opportunity to learn more about pyproject macros.

When build fails which says about "nothing provides" there can be 2 things 
1) package is available but not added as BuildRequires: in spec 
2) Package is not available in Fedora then you need to package that also. 

In above error, we have package python3-flit-core in Fedora but requirements are not satisfying as Fedora's python-flit-core package moved to recent release which is > 3 version

I think this can be adjusted by editing toml file as
sed -i &apos;s/2,&lt;3/2/g&apos; pyproject.toml

I had a look into this package to learn more about pyproject macros.

This package is missing below line along with that some missing test execution BR:'s and usage of %pytest
%pyproject_save_files typer

There are 2 tests which are still failing
=================================== FAILURES ===================================
_____________________________ test_show_completion _____________________________
    def test_show_completion():
        result = subprocess.run(
            [
                "bash",
                "-c",
                f"{sys.executable}  -m coverage run {mod.__file__} --show-completion",
            ],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            encoding="utf-8",
            env={**os.environ, "SHELL": "/bin/bash", "_TYPER_COMPLETE_TESTING": "True"},
        )
>       assert "_TUTORIAL001.PY_COMPLETE=complete_bash" in result.stdout
E       AssertionError: assert '_TUTORIAL001.PY_COMPLETE=complete_bash' in ''
E        +  where '' = CompletedProcess(args=['bash', '-c', '/usr/bin/python3  -m coverage run /builddir/build/BUILD/typer-0.3.2/docs_src/first_steps/tutorial001.py --show-completion'], returncode=1, stdout='', stderr='Shell sh not supported.\n').stdout
tests/test_completion/test_completion.py:21: AssertionError
___________________________ test_install_completion ____________________________
    def test_install_completion():
        bash_completion_path: Path = Path.home() / ".bashrc"
        text = ""
        if bash_completion_path.is_file():  # pragma: nocover
            text = bash_completion_path.read_text()
        result = subprocess.run(
            [
                "bash",
                "-c",
                f"{sys.executable} -m coverage run {mod.__file__} --install-completion",
            ],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            encoding="utf-8",
            env={**os.environ, "SHELL": "/bin/bash", "_TYPER_COMPLETE_TESTING": "True"},
        )
        new_text = bash_completion_path.read_text()
        bash_completion_path.write_text(text)
>       assert "source" in new_text
E       assert 'source' in '# .bashrc\n\n# Source global definitions\nif [ -f /etc/bashrc ]; then\n\t. /etc/bashrc\nfi\n\n# User specific environ...c.d ]; then\n\tfor rc in ~/.bashrc.d/*; do\n\t\tif [ -f "$rc" ]; then\n\t\t\t. "$rc"\n\t\tfi\n\tdone\nfi\n\nunset rc\n'
tests/test_completion/test_completion.py:42: AssertionError
================================================================

Good to report that to upstream about its failure

I think the working SPEC for this package is https://paste.centos.org/view/c75bbef1
Fedora services are down, hence SPEC is added as paste URL.

Comment 5 Parag AN(पराग) 2021-03-31 01:30:18 UTC
Hi Chandan,
Can you provide updated SRPM and SPEC for further review here?

Comment 6 Ben Beasley 2021-05-29 15:12:55 UTC
I recently submitted this package for review (https://bugzilla.redhat.com/show_bug.cgi?id=1964742) without noticing this existing review request. My spec file is able to pass review, but your review request came first.

There are several possible options:

  1. If you want to continue with the review, using your spec file and fixing the issues found in the package review, I am happy to withdraw my review request and close it as a duplicate. I can help you resolve any issues, as I’ve already worked through them once.

  2. If you want to continue with your review request, but you want to simply copy my spec file, please feel free to do so. I can co-maintain too if you like.

  3. If you have changed your mind about finishing this package review, you can close the issue as WONTFIX and I will proceed with mine instead.

Please respond with what you want to do, so that one or the other of us can get this package into Fedora. Thanks!

Comment 7 Ben Beasley 2021-05-29 15:20:37 UTC
> There are 2 tests which are still failing
> […]
> Good to report that to upstream about its failure

From my spec file:

> # Shell completion tests need us to be running under a supported shell, i.e.
> # bash rather than sh. Unfortunately, shell detection with shellingham is so
> # thorough we cannot fool it by any combination of:
> #  - export SHELL=/bin/bash
> #  - bash -c '%%pytest'
> #  - %%check -p /bin/bash
> # so we must simply skip the affected tests.
> %pytest -k 'not test_show_completion and not test_install_completion'

That is, these tests are not exactly “broken,” but they are sensitive to the user’s login shell, so they are brittle. They work in upstream CI, but they won’t work in mock/koji where the login shell is “sh”.

Comment 8 Chandan Kumar 2021-06-17 05:18:46 UTC
Thanks Ben for packaging it, I was on a long vacation. So delay in reply.
Please go ahead with your package review bug for python-typer.
I will close this one as a WONTFIX.

Comment 9 Ben Beasley 2021-06-17 15:50:13 UTC
Thanks for following up! I have marked this issue as a duplicate to connect the two review requests.

*** This bug has been marked as a duplicate of bug 1964742 ***


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