twtxt icon indicating copy to clipboard operation
twtxt copied to clipboard

Add support of Python 3.7+

Open win0err opened this issue 2 years ago • 6 comments

Problem: Generator-based coroutines are deprecated and scheduled for removal in Python 3.11 (docs). Due to that, twtxt doesn't work with Python 3.7+.

Solution: I have changed gererator-based coroutines to async-def coroutines. Other dependencies have also been updated to current versions. Important: breaking changes, won't work with Python 3.6 or lower.

Passed tests: https://github.com/win0err/twtxt/actions/runs/2009500872 I'll create a PR with integration with GitHub Actions in a separate PR.

Closes #140, closes #141, closes #161, closes #162, closes #163

P.S. Please, test the changes manually.

win0err avatar Mar 19 '22 18:03 win0err

@buckket, do you have some plans about releasing version 1.3.0?

win0err avatar Jun 01 '22 12:06 win0err

This is stopping me installing and using twtxt, would love a merge

ChildishGiant avatar Sep 01 '22 12:09 ChildishGiant

This is stopping me installing and using twtxt, would love a merge

You may install this version from a local directory. You need to have git and pip installed on your system.

git clone https://github.com/win0err/twtxt.git
cd twtxt/
git checkout feature/python-3-7-plus
pip install -e .

win0err avatar Sep 01 '22 14:09 win0err

Hmm I installed following your instructions but get this error when trying to run quickstart

allie@allie-desktop:~/Programs/twtxt$ twtxt quickstart
Traceback (most recent call last):
  File "/home/allie/.local/bin/twtxt", line 11, in <module>
    load_entry_point('twtxt', 'console_scripts', 'twtxt')()
  File "/home/allie/.local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/allie/.local/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/allie/.local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/allie/.local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/allie/.local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/allie/Programs/twtxt/twtxt/cli.py", line 283, in quickstart
    width = click.get_terminal_size()[0]
AttributeError: module 'click' has no attribute 'get_terminal_size'

ChildishGiant avatar Sep 06 '22 12:09 ChildishGiant

click=8.1.0 removed get_terminal_size. It now must be imported from shutil

KAction avatar Sep 07 '22 00:09 KAction

click=8.1.0 removed get_terminal_size. It now must be imported from shutil

@KAction, thank you, I've merged your changes to my fork.

@ChildishGiant, please, run git pull the changes and install the updated version using pip install -e .

win0err avatar Sep 07 '22 15:09 win0err

Thanks! I’ve modified the code slightly to work without nest_asyncio.

buckket avatar Nov 11 '22 21:11 buckket