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

Add support of Python 3.7+ #165

Merged
merged 3 commits into from
Nov 11, 2022
Merged

Conversation

win0err
Copy link
Contributor

@win0err win0err commented Mar 19, 2022

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.

@@ -22,7 +22,7 @@ class Cache:
cache_dir = get_app_dir("twtxt")
cache_name = "cache"

def __init__(self, cache_file, cache, update_interval):
def __init__(self, cache_file, cache, update_interval=0):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closes #141

@buckket buckket self-assigned this Mar 21, 2022
@buckket buckket added this to the 1.3.0 milestone Mar 21, 2022
@win0err
Copy link
Contributor Author

win0err commented Jun 1, 2022

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

@ChildishGiant
Copy link

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

@win0err
Copy link
Contributor Author

win0err commented Sep 1, 2022

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 win0err mentioned this pull request Sep 1, 2022
@ChildishGiant
Copy link

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
Copy link

KAction commented Sep 7, 2022

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

@win0err
Copy link
Contributor Author

win0err commented Sep 7, 2022

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 .

Dmitry Bogatov and others added 2 commits September 7, 2022 18:33
@buckket buckket merged commit 05097fc into buckket:master Nov 11, 2022
@buckket
Copy link
Owner

buckket commented Nov 11, 2022

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

@buckket buckket mentioned this pull request Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment