Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old setuptools_scm issue (FreeBSD, for example) #1207

Closed
henryiii opened this issue Jan 15, 2024 · 1 comment · Fixed by #1208
Closed

Old setuptools_scm issue (FreeBSD, for example) #1207

henryiii opened this issue Jan 15, 2024 · 1 comment · Fixed by #1208

Comments

@henryiii
Copy link
Contributor

henryiii commented Jan 15, 2024

Describe the bug

Pipx expects setuptools_scm (via hatch_vcs) to produce __version__ in the default template. However, older versions, such as the one supplied in FreeBSD, do not (this alias was added in version 7; for other reasons, FreeBSD is stuck on 6 and treats 7 as a new package).

https://github.com/pypa/pipx/blob/6918c4de5898d65807a2255eed43b6f5a6cf1a21/src/pipx/main.py#L31C1-L32C1

Two easy fixes and one less so: the one I usually do is to import version (the original name) as __version__ (like in https://github.com/scikit-build/scikit-build-core/blob/f8c5798897852e107df0683893de59e15c558baf/src/scikit_build_core/__init__.py#L9). That was the original name, and is always available. You can also specify the template, which allows you to put whatever you want in version.py, but does require a bit more configuration. And the less-ideal fix would be to limit the version of setuptools_scm that hatch_vcs pulls in to some minimum that includes the addition of this feature (v7).

How to reproduce

Seen in abravalheri/validate-pyproject#142, logs: https://github.com/abravalheri/validate-pyproject/pull/142/checks?check_run_id=20500888256

pipx run coverage xml -o coverage.xml
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)

Expected behavior

Would be nice not to have pipx crash on FreeBSD.

@henryiii
Copy link
Contributor Author

Currently FreeBSD is planning to patch Pipx to add a template: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275946

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant