bczsalba / pytermgui

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!
https://ptg.bczsalba.com
MIT License
2.21k stars 54 forks source link

[BUG] pip install failed - TypeError: RegexHighlighter() takes no arguments #65

Closed EdwardTheLegend closed 2 years ago

EdwardTheLegend commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

When I attempt to install pytermgui using pip the installation fails and throws an error

Defaulting to user installation because normal site-packages is not writeable
Collecting pytermgui
  Using cached pytermgui-6.1.0.tar.gz (136 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      Traceback (most recent call last):
        File "/home/[user]/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/home/[user]/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/[user]/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-3ngpzg9c/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/tmp/pip-build-env-3ngpzg9c/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-3ngpzg9c/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 281, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-3ngpzg9c/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 174, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 3, in <module>
          import pytermgui
        File "/tmp/pip-install-4s0u2_kx/pytermgui_e7e9e5f247fd4974833e1cb8344f0c75/pytermgui/__init__.py", line 20, in <module>
          from .parser import *
        File "/tmp/pip-install-4s0u2_kx/pytermgui_e7e9e5f247fd4974833e1cb8344f0c75/pytermgui/parser.py", line 121, in <module>
          from .colors import str_to_color, Color, StandardColor
        File "/tmp/pip-install-4s0u2_kx/pytermgui_e7e9e5f247fd4974833e1cb8344f0c75/pytermgui/colors.py", line 22, in <module>
          from .fancy_repr import FancyYield
        File "/tmp/pip-install-4s0u2_kx/pytermgui_e7e9e5f247fd4974833e1cb8344f0c75/pytermgui/fancy_repr.py", line 7, in <module>
          from .highlighters import highlight_python
        File "/tmp/pip-install-4s0u2_kx/pytermgui_e7e9e5f247fd4974833e1cb8344f0c75/pytermgui/highlighters.py", line 156, in <module>
          highlight_python = RegexHighlighter(
      TypeError: RegexHighlighter() takes no arguments
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

To Reproduce Steps to reproduce the behavior:

  1. Open a terminal on a machine without pytermgui installed
  2. Type python3 -m pip install pytermgui and hit enter
  3. See the error

Expected behavior A clear and concise description of what you expected to happen.

The installation to work successfully

Screenshots If applicable, add screenshots to help explain your problem.

System information

Alpine on WSL on Windows 10

Add the output of "ptg --version" in this box.

Possible cause If you have a hunch on what might be causing this, please add it here.

Seems like something to do with the dataclass meaning that RegexHighlighter doesn't get an init ?

Possible solution If you know a way we could fix this, please add it here.

I don't know much about dataclasses but maybe this link is relevant

bczsalba commented 2 years ago

Which version of Python is this?

EdwardTheLegend commented 2 years ago

3.9

bczsalba commented 2 years ago

Could you show me the output of ptg -v?

EdwardTheLegend commented 2 years ago
❯ ptg -v
Traceback (most recent call last):
  File "/home/[user]/.local/bin/ptg", line 33, in <module>
    sys.exit(load_entry_point('pytermgui==0.4.1', 'console_scripts', 'ptg')())
  File "/home/[user]/.local/bin/ptg", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.9/importlib/metadata.py", line 524, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.9/importlib/metadata.py", line 187, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: pytermgui
bczsalba commented 2 years ago

I didn't mean to close this yet. Could you try cloning the latest commit and installing using pip install .? I think it should work now.

Odd that this problem never seemed to come up anywhere else. Thank you for the report!

EdwardTheLegend commented 2 years ago

Working now image