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

dependent on prompt-toolkit version 1 however prompt-toolkit version 3.0.30 is required #316

Open
wkvolkman opened this issue Apr 6, 2024 · 1 comment

Comments

@wkvolkman
Copy link

wkvolkman commented Apr 6, 2024

Lovely failure due to "lex_document" not being a method on SQLexer any more however a symptom of a larger problem. If I back down to prompt-toolkit==1.0.18 pydruid command line works, else fails.
However:

ipython 8.15.0 requires prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30, but you have prompt-toolkit 1.0.18 which is incompatible.
jupyter-console 6.6.3 requires prompt-toolkit>=3.0.30, but you have prompt-toolkit 1.0.18 which is incompatible.

Current version of prompt-toolkit appears to be 3.0.43 at the moment.
Lovely traceback

(py39) [wkv@wkv6 learn-druid]$ pip install -U pydruid
Requirement already satisfied: pydruid in /home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages (0.6.1)
Collecting pydruid
  Using cached pydruid-0.6.6-py2.py3-none-any.whl
Requirement already satisfied: requests in /home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages (from pydruid) (2.31.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages (from requests->pydruid) (2.0.4)
Requirement already satisfied: idna<4,>=2.5 in /home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages (from requests->pydruid) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages (from requests->pydruid) (2.1.0)
Requirement already satisfied: certifi>=2017.4.17 in /home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages (from requests->pydruid) (2024.2.2)
Installing collected packages: pydruid
  Attempting uninstall: pydruid
    Found existing installation: pydruid 0.6.1
    Uninstalling pydruid-0.6.1:
      Successfully uninstalled pydruid-0.6.1
Successfully installed pydruid-0.6.6
(py39) [wkv@wkv6 learn-druid]$ pip install -U prompt-toolkit
Requirement already satisfied: prompt-toolkit in /home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages (1.0.18)
Collecting prompt-toolkit
  Using cached prompt_toolkit-3.0.43-py3-none-any.whl.metadata (6.5 kB)
Requirement already satisfied: wcwidth in /home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages (from prompt-toolkit) (0.2.5)
Using cached prompt_toolkit-3.0.43-py3-none-any.whl (386 kB)
Installing collected packages: prompt-toolkit
  Attempting uninstall: prompt-toolkit
    Found existing installation: prompt-toolkit 1.0.18
    Uninstalling prompt-toolkit-1.0.18:
      Successfully uninstalled prompt-toolkit-1.0.18
Successfully installed prompt-toolkit-3.0.43
(py39) [wkv@wkv6 learn-druid]$ pydruid http://localhost:8084/druid/v2/sql/
Traceback (most recent call last):
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/cache.py", line 40, in get
    return self._data[key]
KeyError: ('', 94195175986544)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wkv/anaconda3/envs/py39/bin/pydruid", line 8, in <module>
    sys.exit(main())
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/pydruid/console.py", line 171, in main
    query = prompt(
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1416, in prompt
    return session.prompt(
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1026, in prompt
    return self.app.run(
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 1002, in run
    return asyncio.run(coro)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 886, in run_async
    return await _run_async(f)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 739, in _run_async
    self._redraw()
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 543, in _redraw
    self.context.copy().run(run_in_context)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/application/application.py", line 526, in run_in_context
    self.renderer.render(self, self.layout)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/renderer.py", line 640, in render
    layout.container.preferred_height(size.columns, size.rows).preferred,
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/containers.py", line 318, in preferred_height
    dimensions = [
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/containers.py", line 319, in <listcomp>
    c.preferred_height(width, max_available_height) for c in self._all_children
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/containers.py", line 786, in preferred_height
    return self.content.preferred_height(width, max_available_height)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/containers.py", line 318, in preferred_height
    dimensions = [
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/containers.py", line 319, in <listcomp>
    c.preferred_height(width, max_available_height) for c in self._all_children
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/containers.py", line 2629, in preferred_height
    return self.content.preferred_height(width, max_available_height)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/containers.py", line 1611, in preferred_height
    return self._merge_dimensions(
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/containers.py", line 1639, in _merge_dimensions
    preferred = get_preferred()
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/containers.py", line 1604, in preferred_content_height
    return self.content.preferred_height(
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/controls.py", line 620, in preferred_height
    content = self.create_content(width, height=1)  # Pass a dummy '1' as height.
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/controls.py", line 754, in create_content
    get_processed_line = self._create_get_processed_line_func(
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/controls.py", line 705, in _create_get_processed_line_func
    return create_func()
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/controls.py", line 692, in create_func
    get_line = self._get_formatted_text_for_line_func(document)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/controls.py", line 652, in _get_formatted_text_for_line_func
    return self._fragment_cache.get(key, get_formatted_text_for_line)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/cache.py", line 43, in get
    value = getter_func()
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/layout/controls.py", line 649, in get_formatted_text_for_line
    return self.lexer.lex_document(document)
  File "/home/wkv/anaconda3/envs/py39/lib/python3.9/site-packages/prompt_toolkit/lexers/base.py", line 80, in lex_document
    return lexer.lex_document(document)
AttributeError: type object 'SqlLexer' has no attribute 'lex_document'
@wkvolkman
Copy link
Author

btw. I had to backoff to pydruid 0.6.1 to get it to work, apologies for that omission. I just found the druidapi under the learn-druid project so I'm checking that out now. I didn't find it on pypi.org though.

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

No branches or pull requests

1 participant