textual icon indicating copy to clipboard operation
textual copied to clipboard

README.md Installation section possibly missing some context?

Open davep opened this issue 3 years ago • 7 comments

This is more of a question for clarification than a bug report or anything, but wanting to have a wee look at the library with a view to experimenting with a tool built around it, I was trying to get the examples up and running first (apologies if this isn't the correct place to ask this; so please point me in the right direction if so). For context:

  1. I was initially working with the css branch at @willmcgugan's suggestion of the best place to look.
  2. I've currently got zero experience with poetry (got sucked into pipenv some time back and... yeah, I know, I know) so I'm also finding my way with that too.

Having forked and cloned and switched to the css branch I did a poetry install and initially wondered if this:

Once installed you can run the following command for a quick test, or see examples (below):

python -m textual.app

was correct? This could be my ignorance showing but would it not be:

poetry run python -m textual.app

instead? Working on that assumption I run into the following:

Traceback (most recent call last):
  File "/Users/davep/develop/python/textual/src/textual/devtools/client.py", line 28, in <module>
    import msgpack
ModuleNotFoundError: No module named 'msgpack'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/[email protected]/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/[email protected]/3.10.5/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/davep/develop/python/textual/src/textual/app.py", line 52, in <module>
    from .devtools.client import DevtoolsClient, DevtoolsConnectionError, DevtoolsLog
  File "/Users/davep/develop/python/textual/src/textual/devtools/client.py", line 31, in <module>
    raise DevtoolsDependenciesMissingError(
textual.devtools.client.DevtoolsDependenciesMissingError: Textual Devtools requires installation of the 'dev' extra dependencies.

That leaves me a bit stuck as, from what I can tell from the poetry docs, it will install all dependencies, including dev dependencies, by default, and the only related switch is the one that doesn't install the dev dependencies.

Given the above, I thought I'd try the same in the main branch (with the modified command for running the demo app) and it works fine.

So... while very much keeping in mind Textual is a moving target at the moment, am I just being thrown off by the fact that the README is lagging in the css branch, and should the command to test textual.app be explicit about using poetry to run python to run the app?

davep avatar Jul 31 '22 17:07 davep

I'm afraid the readme for the CSS branch is terribly out of date.

From memory, I think this will get you started. Navigate to the repo root and do the following (assume you have installed poetry).

poetry shell
poetry install

Have a look in sandbox/will for some example apps.

willmcgugan avatar Jul 31 '22 18:07 willmcgugan

Cool, thanks, that makes more sense (if it helps I'll be happy to submit changes for the README to help other folk coming at this branch fresh).

However... the main issue still seems to be the msgpack error mentioned above.

Screenshot 2022-07-31 at 20 07 33

Just importing textual.app seems to cause the problem, and any of the examples (including yours you mention above) exhibit the same issue.

Curiously, and again I'm feeling my way around with poetry, if I poetry show I get a list of what I take to be all the dependencies, and msgpack is shown in red while all the others are green -- not knowing what the colour difference signified (I'll RTFM) I got the list without the colours and it shows a (!) against it.

Presumably, whatever is happening here, poetry is having a problem with this msgpack package (but doesn't seem to want to explicitly tell me what the problem is).

davep avatar Jul 31 '22 19:07 davep

Ah, you'll need the dev extras.

Try this:

poetry install --extras dev

python -m textual.app won't do anything in the CSS brach. fun stuff is in sandbox/will

willmcgugan avatar Jul 31 '22 19:07 willmcgugan

Bingo! That was the magic I was looking for! All running now.

Would a tweak to the README be helpful/welcome, or is that going to clash with the work you're doing on the docs anyway?

davep avatar Jul 31 '22 19:07 davep

Great! I plan on rewriting that README before the CSS branch lands. Hopefully not much longer.

willmcgugan avatar Jul 31 '22 19:07 willmcgugan

Okay, thanks. This has got me going such that I can tinker and run stuff so that's a big help, appreciate it. Now starting to mess with a test app.

davep avatar Jul 31 '22 21:07 davep

Is the note in the readme about installing using pip pip install textual[dev] still supposed to work? When I try to install from OSX terminal I get: zsh: no matches found: textual[dev]

When I try to install from requirements.txt using pip install -r requirements.txt and my requirements.txt file has textual[dev] I get WARNING: textual 0.1.18 does not provide the extra 'dev'

D8ATech avatar Oct 11 '22 15:10 D8ATech

Did we solve your problem?

Glad we could help!

github-actions[bot] avatar Oct 25 '22 09:10 github-actions[bot]