buckket / twtxt

Decentralised, minimalist microblogging service for hackers.
http://twtxt.readthedocs.org/en/stable/
MIT License
1.91k stars 79 forks source link

Add support of Python 3.7+ #165

Closed win0err closed 1 year ago

win0err commented 2 years ago

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 commented 2 years ago

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

ChildishGiant commented 1 year ago

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

win0err commented 1 year ago

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 .
ChildishGiant commented 1 year ago

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'
KAction commented 1 year ago

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

win0err commented 1 year ago

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 .

buckket commented 1 year ago

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