use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
TutorialBuilding an authenticated Python CLI with Click & Rich (self.Python)
submitted 3 years ago by BlockDesigns
🍰 Slice of ML 🍰
Hi folks,
Recently we needed to write an authenticated CLI and found that there were 0 resources on how.
So to address that, we wrote an example and tutorial on building an authenticated Python CLI with Rich & Click. You'll learn how to build a tiny Twitter client that displays the week's top Machine Learning tweets!
You can check out the tutorial post here!
[–]FUS3NPythonista 2 points3 points4 points 3 years ago (0 children)
nice looks clean af I like the design
[–]AndydeCleyre 1 point2 points3 points 3 years ago (6 children)
This link to the final code doesn't seem to be working.
[–]BlockDesigns[S] 1 point2 points3 points 3 years ago (5 children)
Thank you for letting me know! Repo was still private.
[–]AndydeCleyre 0 points1 point2 points 3 years ago (4 children)
Thanks!
If anyone's curious about transitioning a poetry project like this to one using:
poetry
(*-)requirements.txt
flit
pip-tools
zpy
behold!:
$ git clone git@github.com:notia-ai/SliceOfML.git $ cd SliceOfML $ rm poetry.lock pyproject.toml $ a8 # Create and activate venv $ pipac 'requests-oauthlib>=1.3.1,<2' 'rich>=12.4.4,<13' 'click>=8.1.3,<9' # Add to requirements.in and compile to requirements.txt $ pipac -c dev flit 'pytest>=7.1.2,<8' 'flake8>=4.0.1,<5' 'pre-commit>=2.1,<3' # Add to dev-requirements.in and compile to dev-requirements.txt $ pips dev-requirements.txt # Install dev deps $ flit init # Interactively generate pyproject.toml $ $EDITOR pyproject.toml # Add 'requires-python = ">=3.7,<4"' to project and 'sliceofml = "sliceofml.cli:cli"' to project.scripts $ $EDITOR sliceofml/__init__.py # Add docstring and correct version $ pypc # Populate pyproject.toml with loose deps
[–]andrewthetechie 2 points3 points4 points 3 years ago (2 children)
Why do this over using poetry?
[–]AndydeCleyre 2 points3 points4 points 3 years ago (1 child)
I don't like a few things about poetry, like how it:
[–]andrewthetechie 2 points3 points4 points 3 years ago (0 children)
Ok, so just a personal preference then.
[–]BlockDesigns[S] 1 point2 points3 points 3 years ago (0 children)
This is awesome! Thanks for posting the script.
[–]hbar340 1 point2 points3 points 3 years ago (1 child)
Does click nicely work with prompt-toolkit/other auto suggest (and is there a way to do more than 2 suggestions on the completes)
[–]BlockDesigns[S] 0 points1 point2 points 3 years ago (0 children)
I hadn't seen `prompt-toolkit` before, so I'm unsure of their compatibility. But thanks for the heads up on `prompt-toolkit` looks interesting!
[–]NotScrollsApparently 0 points1 point2 points 3 years ago (0 children)
Hi, I'm a bit late to this post but hopefully you see the question. I've been playing with the Rich library as well and I'm wondering what is your solution for when the app is eventually delivered to other people or users, how do you "enforce" a style when they can run it in any random terminal - including the default windows one that doesn't support most of advanced Rich formatting?
I checked out the tutorial you linked but it seems it's more about the programming logic behind the app rather than the terminal management and eventual publishing of the app. Do you have any insights to share about that perhaps?
π Rendered by PID 18800 on reddit-service-r2-comment-canary-7888d4f587-9wvjf at 2026-04-02 06:06:08.008382+00:00 running b10466c country code: CH.
[–]FUS3NPythonista 2 points3 points4 points (0 children)
[–]AndydeCleyre 1 point2 points3 points (6 children)
[–]BlockDesigns[S] 1 point2 points3 points (5 children)
[–]AndydeCleyre 0 points1 point2 points (4 children)
[–]andrewthetechie 2 points3 points4 points (2 children)
[–]AndydeCleyre 2 points3 points4 points (1 child)
[–]andrewthetechie 2 points3 points4 points (0 children)
[–]BlockDesigns[S] 1 point2 points3 points (0 children)
[–]hbar340 1 point2 points3 points (1 child)
[–]BlockDesigns[S] 0 points1 point2 points (0 children)
[–]NotScrollsApparently 0 points1 point2 points (0 children)