Bug 275946 - devel/py-pipx: cannot be run
Summary: devel/py-pipx: cannot be run
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Po-Chuan Hsieh
URL:
Keywords:
: 276429 277080 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-12-26 11:49 UTC by Alexey Vyskubov
Modified: 2024-04-06 11:50 UTC (History)
10 users (show)

See Also:
fernape: maintainer-feedback? (sunpoet)


Attachments
pipx-1.4.1.patch (2.55 KB, patch)
2024-01-09 16:55 UTC, Jesús Daniel Colmenares Oviedo
no flags Details | Diff
[PATCH] devel/py-pipx: bump PORTREVISION to schedule for rebuild (634 bytes, patch)
2024-03-18 13:04 UTC, Älven
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Vyskubov 2023-12-26 11:49:17 UTC
pipx <whatever> =>
Traceback (most recent call last):
  File "/usr/local/bin/pipx", line 5, in <module>
    from pipx.main import cli
  File "/usr/local/lib/python3.9/site-packages/pipx/main.py", line 31, in <module>
    from pipx.version import __version__
ImportError: cannot import name '__version__' from 'pipx.version' (/usr/local/lib/python3.9/site-packages/pipx/version.py)


Indeed, there is no __version__ in pipx.version. Editing /usr/local/lib/python3.9/site-packages/pipx/version.py to define __version__ (duplicating 'version' definition) fixes the things.

FreeBSD 14.0-p4, both the latest package and the port from the latest branch
❯ grep PORTVERSION /usr/ports/devel/py-pipx/Makefile
PORTVERSION=    1.3.3
Comment 1 Jesús Daniel Colmenares Oviedo 2024-01-09 16:55:02 UTC
Created attachment 247545 [details]
pipx-1.4.1.patch

Description:

* Fix ImportError: cannot import name '__version__' from 'pipx.version'
  - pipx requires `__version__` to be defined, but hatch-vcs does not
    generate it when using the ports tree. To fix this, a template
    based on the default template [1] is used.

[1] https://github.com/pypa/setuptools_scm/blob/v6.4.0/src/setuptools_scm/__init__.py#L30-L39

ChangeLog: https://pipx.pypa.io/latest/changelog/#141

* Set default logging level to WARNING, so debug log messages won't be shown without passing additional flags such as --verbose.

QA:

* portlint: OK (looks fine.)
* testport: OK (poudriere: 14.0-RELEASE, amd64)
Comment 2 Henry Schreiner 2024-01-15 17:31:17 UTC
The best fix would be to patch it to `from pipx.version import version as __version__`, since older versions of setuptools_scm don't provide the `__version__` alias; this was added in version 7, which for some reason seems to be a separate package and not a dependency of hatch_vcs.

I've proposed an upstream fix at https://github.com/pypa/pipx/pull/1208, though ideally setuptools_scm should be updated to version 7 or even version 8.
Comment 3 freebsd 2024-03-07 01:47:25 UTC
I was just now able to build a working version 1.4.3 from ports (987b3aefae8dcd837edebefa792892faff7e8900) :)
Comment 4 Po-Chuan Hsieh freebsd_committer freebsd_triage 2024-03-08 15:12:35 UTC
*** Bug 276429 has been marked as a duplicate of this bug. ***
Comment 5 Po-Chuan Hsieh freebsd_committer freebsd_triage 2024-03-08 15:13:01 UTC
*** Bug 277080 has been marked as a duplicate of this bug. ***
Comment 6 Po-Chuan Hsieh freebsd_committer freebsd_triage 2024-03-08 15:14:17 UTC
(In reply to Jesús Daniel Colmenares Oviedo from comment #1)
(In reply to Henry Schreiner from comment #2)

The patch is no longer needed after py-setuptools-scm being updated to 8.0.4 in ports 5d4139f8bdb67bd6e8328422f9762661bd0d6454. Thanks.
Comment 7 Älven 2024-03-18 11:56:13 UTC
Please, update PORTREVISION for the package to be scheduled for rebuild during next `poudriere bulk` run.
Comment 8 Älven 2024-03-18 13:04:06 UTC
Created attachment 249265 [details]
[PATCH] devel/py-pipx: bump PORTREVISION to schedule for rebuild
Comment 9 Älven 2024-04-06 11:50:46 UTC
Comment on attachment 249265 [details]
[PATCH] devel/py-pipx: bump PORTREVISION to schedule for rebuild

Obsolete by release of 1.5.0