Skip to content

Alternative to Version from distutils/packaging #364

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

Closed
3 tasks
tony opened this issue Mar 20, 2022 · 5 comments
Closed
3 tasks

Alternative to Version from distutils/packaging #364

tony opened this issue Mar 20, 2022 · 5 comments
Labels

Comments

@tony
Copy link
Member

tony commented Mar 20, 2022

This is necessary in libtmux and tmuxp.

tmuxp uses this for tmux versions (via git and 3.0b, etc)

Needs to be flexible and ideally have no dependency

  • LegacyVersion deprecation

    In packaging, LegacyVersion (the supercessor to LooseVersion) will be deprecated, we won't be able to support 2.4-openbsd (like what is seen on OpenBSD's tmux versions

      /home/t/work/python/libtmux/.venv/lib/python3.10/site-packages/packaging/version.py:127: 
        DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release
        warnings.warn(
    
    -- Docs: https://docs.pytest.org/en/stable/warnings.html
    
  • tmux versions

     To the above, consider subclassing `Version` for tmux versions to handle git builds, platform builds, etc. then keeping `Version` for supporting pypi releases
    
  • Version Assure that libtmux.__version__ / tmuxp.__version__ supports git refs / local match groups

@bszonye
Copy link

bszonye commented Dec 11, 2022

Today I hit a tmuxp that looks related to this work. I've been moving my pip --user installs to use pipx instead, and I hit this error in startup:

$ ssh-agent tmuxp load wsl
Traceback (most recent call last):
  File "/home/bradd/.local/bin/tmuxp", line 5, in <module>
    from tmuxp import cli
  File "/home/bradd/.local/pipx/venvs/tmuxp/lib/python3.11/site-packages/tmuxp/__init__.py", line 11, in <module>
    from . import cli, util
  File "/home/bradd/.local/pipx/venvs/tmuxp/lib/python3.11/site-packages/tmuxp/cli/__init__.py", line 14, in <module>
    from libtmux.__about__ import __version__ as libtmux_version
  File "/home/bradd/.local/pipx/venvs/tmuxp/lib/python3.11/site-packages/libtmux/__init__.py", line 12, in <module>
    from .pane import Pane
  File "/home/bradd/.local/pipx/venvs/tmuxp/lib/python3.11/site-packages/libtmux/pane.py", line 12, in <module>
    from libtmux.common import tmux_cmd
  File "/home/bradd/.local/pipx/venvs/tmuxp/lib/python3.11/site-packages/libtmux/common.py", line 17, in <module>
    from ._compat import LooseVersion, console_to_str, str_from_console
  File "/home/bradd/.local/pipx/venvs/tmuxp/lib/python3.11/site-packages/libtmux/_compat.py", line 40, in <module>
    from packaging.version import Version
ModuleNotFoundError: No module named 'packaging'

It looks like libtmux depends on "packaging" as an undeclared dependency. That package is ubiquitous, so it's fine when installed globally or with --user, but in a fresh virtualenv (e.g. with pipx) the Version call crashes the utility. Probably libtmux should include the dependency in pyproject.toml until you find a replacement.

@tony
Copy link
Member Author

tony commented Dec 12, 2022

@bszonye Good catch! Taking a closer look now

@tony tony mentioned this issue Dec 12, 2022
@tony
Copy link
Member Author

tony commented Dec 12, 2022

@bszonye Fixed in libtmux v0.16.1, tmuxp v1.19.1

If you try now, any better?

See also #461

@bszonye
Copy link

bszonye commented Dec 12, 2022

Works for me with tmuxp v1.191, thanks!

@tony
Copy link
Member Author

tony commented Dec 12, 2022

@bszonye Excellent!

I will close this for now per tmuxp 1.19.1 (via libtmux 0.16.1) handling the packaging dependency!

@tony tony closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants