PLEASE Learn These 4 Python Tools

Tech With Tim · Beginner ·🔍 RAG & Vector Search ·1y ago
Skills: RAG Basics80%

Key Takeaways

The video demonstrates the use of UV, Streamlit, Rich, and Textual tools for efficient Python development, including dependency management, web-based UI creation, and terminal application styling.

Full Transcript

If you're a Python developer, then you need to be using these four tools. Stick around as I give you a high-level introduction to each of them and then jump into a code sample so you can see exactly how they work. And if you like this video, I also have a free developer training that I've linked below that explains my new program Dev Launch. So check that out if it sounds interesting. Anyways, let's get into tool number one, which is UV. Now, if you've written code in Python, I'm sure you've heard of the tool pip. Now, that's the thing that lets you install your favorite libraries like Pygame, NumPy, etc. Well, PIP is good, but UV is just better. UV is a relatively new tool that is 100 times faster than pip and in my opinion significantly easier to use. It does pretty much the exact same thing, but it also manages your Python virtual environments for you. So, it automatically handles dependency tracking, activating the environments, etc. and it makes it really easy to set up projects that have a lot of different dependencies. Anyways, let me show you a quick demo so you can see the value of UV. So, let's look at a laser demo here of UV. So, you can see that I'm inside of a directory, right? I've called it UV demo. Now, what I can do to create a new UV project is just type UV innit and then dot. Now, when I do that, it's going to make a new project inside of this directory. And if we look at the files here, you'll see that it creates a Python version file, a main.py Pi file, a pi project.toml file, and this is where it's actually going to store our dependencies. Now, it's super easy to work with uv. You can just type uv add and then the name of the package you want to install. So maybe something like numpy. When we do that, it installs this super fast, like usually way faster than pip. It gets added into our dependencies and then automatically creates av file here and manages a virtual environment for us. Now, right now, I don't actually need to activate this virtual environment like I might have to do with a traditional virtual environment. What I can do is simply run my code by using the command uv run and then the name of my Python file. So, something like main.py. When I do this, it's automatically going to use this virtual environment to run the Python code for me. So, for example, if I go to main.py here and I import numpy. Okay, let's just run the code now. And I run it. You can see that I don't get an error because it's actually using this Python interpreter, the one that was automatically created by UV to run the code. And then when I import numpy, there's no issue because numpy is actually installed. Of course, there's a lot more things that you can do with UV. But I just find it's very easy to add the packages. I just go UV add and then, you know, maybe mattplot lib or something and then boom, it gets installed, automatically finds all of the other dependencies, adds it to my pipro.toml file. And we also get a lock file so you can lock all of the dependency versions and know exactly what's happening for this particular project. All right, if you want more information on UV, I'm going to leave a video on screen that goes over all of the different features. With that said, let's move on to the next tool. Now, the next tool on my list is not Python related. It's actually called SEO writing, and they're the sponsor of today's video. Now, what if I told you that you could create high converting SEO optimized pages in literally minutes by analyzing what's already working for your top competitors? Well, that's exactly what SEO's writing new super page feature can do. Let me show you what I mean. I just created this top 10 best wireless headphones comparison page using the super page. You can see here I simply entered my keyword, told it I wanted a product roundup, and look at what it generated. We've got detailed product specs, pros and cons, feature tables, and these strategically placed buy now CTAs that are designed to actually convert. This tool analyze the top ranking pages in Google and extracted their winning strategies to build this out. But it's not just for product pages. Check out this local roofing service page that I created for Chicago. Super page automatically included service descriptions, contact information, and even suggested where to place phone call CTAs throughout the page. The AI analyzed what the top local service pages were doing and replicated those conversion elements. The genius here is that Super Page doesn't just create content. It's studying your SER competitors and stealing their best conversion traffic. Now, if you want to try Super Page for yourself, I've got an exclusive 25% discount code where you can use TWWT25 at seioritriting.ai. That link is in the description below. And now, let's get back to our Python tools. So, next on my list here is Streamlit. Again, a newer Python module that lets you make web-based user interfaces with pure Python. Now, since I discovered this, it's been my absolute go-to for spinning up simple Python websites. And it's extremely useful for data science and AI related apps. You don't need any JavaScript, no HTML, no CSS, and you can write three lines of Python code and have a fully functioning UI, which is great, especially for quick demos. Now, it's definitely not something I'd use in production, but it's still extremely useful. And I want to show you a few examples so you can see what it looks like. So, let's have a look at some Streamlit code. So, you can see here that I've imported Streamlit as ST. And I also just brought in pandas and numpy because it's very common to use these with Streamlit. I do some basic stuff. So, I'm setting the page configuration. So, this is the name of the page. For example, I can just add a title. I can add a sidebar. I can show some kind of number inputs. And then I can have some buttons. So, for example, there's a button here called generate. It's as easy as saying, okay, on the sidebar, I want to add a button. And let me show you how we run this code. So, you can see what this 29line file actually looks like. So, if I open up my terminal here, I've already used UV. So, I would have gone UV add and then streamllet, right? So, it installed the package for me. Then I can run the command uvun streamllet run and then the name of my Python file. So, main.py. So whenever you're running with Streamlit, rather than doing, you know, Python and the name of the file, you do Streamlit run and then the name of the file that you want to execute. And because I'm running this with UV, I just put UV before it. So it uses this Python virtual environment. So I'm going to go ahead and press enter. You're going to see that it spins this up now. So I'm just going to go full screen. It's just running localhost on my computer. Let's zoom in a little bit on the sidebar. Let's generate some data. And you can see that we get a graph that we can look at. And we have a table that we can kind of scroll through and we can edit and look at these different values. Obviously, this is a super simple example, but I think it's really cool. Streamlit works very, very well, especially for these data science related type applications and has all of these pre-built components. So, again, 29 lines of code and we now have this working. And Streamlit will also do hot reloading as well. So, anytime you make a change to the Python file, it can automatically reload on the page. Anyways, this is super cool. Definitely check streamlin out if you want a simple UI. And now let's move on to the next tool. Okay, now next on my list, we have a module that I probably install five times a week just because of how often I find myself using it, and that's Python.env. Now, this is an extremely simple yet very powerful module that simply lets you load environment variable files. With just two lines of code, python.env PNV can detect and load environment files in your project's directory and allow you to access the values in your code. And in case you don't know what an environment variable is, it's just a key value pair stored outside of the code that defines configuration settings or system behavior such as things like file paths, API keys, or database credentials. It allows your app to access dynamic values without hard coding them in, and it makes your code more secure and more portable. Anyways, let me show you here. Let's go on to the computer. So let's have a look here at the python.env module. Now first in order for this to make sense I just want to show you that I have this.env file created in my directory. Now this is a convention for storing various credentials. So for example I have this variable called API key. I've just made it equal to five zeros just as a demo here. But a lot of times you have all of these kind of secret values that you just want to be local to your own environment. Now, you want to be able to load these values into your Python script, but by default, Python doesn't really let you do this. So, for example, you can see I'm importing OS and then I'm trying to get this API key variable, which should be this, right, which stored in myv file. But if I just open up my terminal and I just run this by default without using the library I'm going to show you. So, I go Python and then main.py. So, let's run this here. You see that it says my API key is none. It tries to load this API key variable but it can't find it. So that's why we need this python.env module. Now in order to install this story you can go like this. We can type uv init and then dot. We can say uv add and then python.env. Okay. To install the module then I'm going to clear. And now what I can do is simply write these two lines of code. Okay. The ones that I'm on uncommenting here. So we just say from.env import load.env. And then we simply call this load.env function. When we do that, it's going to look for the presence of aenv file in our local directory. If it sees that, it's going to load this as an environment variable that we can then use in our Python script. So now if we go back here and we go uv run and then main.py, you'll see that it actually loads our API key. So obviously that works well, but you can also load various other environment variable files based on the environment you're running in. So a lot of times you might have like a staging.vironment variable file or a dev.environment variable file depending on the environment that your code is running in right staging development production etc. So if you want to specify a particular file to load then you can just go here and say the env path is equal to and then something like staging.env and then in this case it should load the value from staging. So if I run this now you can see the API key changes because in staging that's the value I have here. That's pretty much it. It is stupid simple, but it is so useful. So, I wanted to show you. Okay. Now, the last on my list here are actually two modules that I like to group together, and those are rich and textual. Now, if you've ever seen those really fancy terminal applications and wondered how people are generating those loading animations, colors, fonts, etc., well, they're probably using one of these. Now, both rich and textual allow you to make beautiful terminal applications with advanced configurations, styling, and commands. So, if you're making a command line interface tool, then these are really just a mustuse. Let me show you what they look like and how they work. So, before we can start using rich and textual, we do need to install them. So, I can type uv add rich and then textual like this in a UV project. And then it will add those dependencies for me. Then I'm going to show you a few different demos here of kind of how this works. So the first demo I have is a CPU and memory monitor. So it will kind of in live time update on the screen. You can see that I've imported a bunch of stuff from textual here as well as this PSUIL library which allows me to get things like the CPU percentage virtual memory etc. So if I open this up and I go uv run I believe I called this demo2.py Pi. You can see that we get this nice terminal and it shows you shows me sorry the CPU and memory usage. Then I can press Q and I can quit and get out of that. Okay. Next demo that I have for you here is a simple one where I'm just showing you kind of some different colors on the screen. So same thing. This is from textual. So I can go UV run and then demo3. py. And you can see that we have again a nice terminal. Welcome to the terminal UI built with textual. Next demo I have for you just uses the rich console. So again, just kind of showing you how we can have some different text with different styles. So here I can go UV run and then demo for py. And you can see we get more in the standard uh terminal here these different colors like the purple color, the emoji, the underline, the green, the bold, etc. And you can see how simple it is to use this. It's pretty much just the same command but using console.print. Okay. And kind of creating this text object. Lastly, we have demo five, which is just showing you how to make a loading bar using rich or kind of like a loading spinning animation. So, sometimes you might see that in the terminal and be like, how the heck do I make that? Well, this is how you do it. So, I'm going to go again UV run and then demo 5.py. And you can see it kind of says loading. We have that nice animation still working. And then boom, it stops. Okay, so stupid simple. Just a few lines of code here to get that to work, but makes your terminal applications look so much better. So, that's my list of Python tools that I think every developer needs to be using, mostly because I use them literally every single day. I'd like to hear what Python tools you're using. So, leave a comment down below. And with that said, I look forward to seeing you in another video. [Music]

Original Description

Get a 25% discount using the code TWT25 for SEOWriting at https://seowriting.ai/?utm_source=youtube&utm_medium=tech_with_tim Want to make real money with coding? I share high-signal insights on careers, monetization, and leverage in my free newsletter. Join here and get my guide How to Make Money With Coding instantly: https://techwithtim.net/newsletter If you're a Python developer, then you need to be using these four tools. Stick around as I give you a high level introduction to each of them, and then jump into a code sample so you can see exactly how they work. ⏳ Timestamps ⏳ 00:00 | Introduction 00:21 | Tool 1 - uv Package Manager 03:00 | SEOWriting 04:32 | Tool 2 - Streamlit 06:56 | Tool 3 - python-dotenv 10:08 | Tool 4 - Rich & Textual Hashtags #Python #PythonTools #streamlit --- I put together some free resources assosiated with this video that you might find useful: - UV Full Video: https://www.youtube.com/watch?v=6pttmsBSi8M - Streamlit Course: https://www.youtube.com/watch?v=o8p7uQCGD0U&t=6s
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Tech With Tim · Tech With Tim · 0 of 60

← Previous Next →
1 A* Path Finding Algorithm(Visualization)
A* Path Finding Algorithm(Visualization)
Tech With Tim
2 Python Programming Tutorial #1 - Variables and Data Types
Python Programming Tutorial #1 - Variables and Data Types
Tech With Tim
3 Python Programming Tutorial #2 - Basic Operators and Input
Python Programming Tutorial #2 - Basic Operators and Input
Tech With Tim
4 Python Programming Tutorial #3 - Conditions
Python Programming Tutorial #3 - Conditions
Tech With Tim
5 Python Programming Tutorial #4 - IF/ELIF/ELSE
Python Programming Tutorial #4 - IF/ELIF/ELSE
Tech With Tim
6 Python Programming Tutorial #5 - Chained Conditionals and Nested Statements
Python Programming Tutorial #5 - Chained Conditionals and Nested Statements
Tech With Tim
7 Python Programming Tutorial #6 - For Loops
Python Programming Tutorial #6 - For Loops
Tech With Tim
8 Python Programming Tutorial #7 - While Loops
Python Programming Tutorial #7 - While Loops
Tech With Tim
9 Python Programming Tutorial #8 - Lists and Tuples
Python Programming Tutorial #8 - Lists and Tuples
Tech With Tim
10 Python Programming Tutorial #9 - Iteration by Item (For Loops Continued...)
Python Programming Tutorial #9 - Iteration by Item (For Loops Continued...)
Tech With Tim
11 Python Programming Tutorial #10 - String Methods
Python Programming Tutorial #10 - String Methods
Tech With Tim
12 How to Overclock a NVIDIA GPU
How to Overclock a NVIDIA GPU
Tech With Tim
13 Python Programming Tutorial #11 - Slice Operator
Python Programming Tutorial #11 - Slice Operator
Tech With Tim
14 Python Programming Tutorial #12 - Functions
Python Programming Tutorial #12 - Functions
Tech With Tim
15 Python Programming Tutorial #13 - How to Read a Text File
Python Programming Tutorial #13 - How to Read a Text File
Tech With Tim
16 Python Programming Tutorial #14 - Writing to a Text File
Python Programming Tutorial #14 - Writing to a Text File
Tech With Tim
17 Python Programming Tutorial #15 - Using .count() and .find()
Python Programming Tutorial #15 - Using .count() and .find()
Tech With Tim
18 Python Programming Tutorial #16 - Introduction to Modular Programming
Python Programming Tutorial #16 - Introduction to Modular Programming
Tech With Tim
19 Python Programming Tutorial #17 - Optional Parameters
Python Programming Tutorial #17 - Optional Parameters
Tech With Tim
20 Python Programming Tutorial #18 - Try and Except (Python Error Handling)
Python Programming Tutorial #18 - Try and Except (Python Error Handling)
Tech With Tim
21 Python Programming Tutorial #19 - Global vs Local Variables
Python Programming Tutorial #19 - Global vs Local Variables
Tech With Tim
22 Python Programming Tutorial #20 - Classes and Objects
Python Programming Tutorial #20 - Classes and Objects
Tech With Tim
23 Cool VBS Script to Prank Your Friends!
Cool VBS Script to Prank Your Friends!
Tech With Tim
24 How to Overclock an AMD GPU
How to Overclock an AMD GPU
Tech With Tim
25 Best GPU'S For Mining Ethereum (2018)
Best GPU'S For Mining Ethereum (2018)
Tech With Tim
26 Recursion and Memoization Tutorial Python
Recursion and Memoization Tutorial Python
Tech With Tim
27 Ethereum Mining Rig - Hardware Guide
Ethereum Mining Rig - Hardware Guide
Tech With Tim
28 Pygame Tutorial #1 - Basic Movement and Key Presses
Pygame Tutorial #1 - Basic Movement and Key Presses
Tech With Tim
29 How to Install Pygame (Windows 8/10)
How to Install Pygame (Windows 8/10)
Tech With Tim
30 How to Trade Your Cryptocurrency (Bitcoin, Ethereum etc.) For Cash!
How to Trade Your Cryptocurrency (Bitcoin, Ethereum etc.) For Cash!
Tech With Tim
31 How to Mine Ethereum 2018 - WORKING (Super-Easy)
How to Mine Ethereum 2018 - WORKING (Super-Easy)
Tech With Tim
32 Microphone Comparison - $10 Mic vs $150 Mic (Blue Yeti USB)
Microphone Comparison - $10 Mic vs $150 Mic (Blue Yeti USB)
Tech With Tim
33 Pygame Tutorial #2 - Jumping and Boundaries
Pygame Tutorial #2 - Jumping and Boundaries
Tech With Tim
34 Pygame Tutorial #3 - Character Animation & Sprites
Pygame Tutorial #3 - Character Animation & Sprites
Tech With Tim
35 Pygame Tutorial #4 - Optimization & OOP
Pygame Tutorial #4 - Optimization & OOP
Tech With Tim
36 OBS Studio Tutorial - Best OBS Settings
OBS Studio Tutorial - Best OBS Settings
Tech With Tim
37 Linear Search Algorithm - Python Example and Code
Linear Search Algorithm - Python Example and Code
Tech With Tim
38 Make Any Mic Sound AMAZING! (WITH OBS)
Make Any Mic Sound AMAZING! (WITH OBS)
Tech With Tim
39 Binary Search Algorithm - Python Example & Code
Binary Search Algorithm - Python Example & Code
Tech With Tim
40 Pygame Tutorial #5 - Projectiles
Pygame Tutorial #5 - Projectiles
Tech With Tim
41 Pygame Game - Mini Golf
Pygame Game - Mini Golf
Tech With Tim
42 Pygame Tutorial - Projectile Motion (Part 1)
Pygame Tutorial - Projectile Motion (Part 1)
Tech With Tim
43 Pygame Tutorial - Projectile Motion (Part 2)
Pygame Tutorial - Projectile Motion (Part 2)
Tech With Tim
44 Pygame Tutorial #6 - Enemies
Pygame Tutorial #6 - Enemies
Tech With Tim
45 Pygame Tutorial #7 - Collision and Hit Boxes
Pygame Tutorial #7 - Collision and Hit Boxes
Tech With Tim
46 Pygame Tutorial #8 - Scoring and Health Bars
Pygame Tutorial #8 - Scoring and Health Bars
Tech With Tim
47 Cloud Mining vs. Hardware Mining - 2018
Cloud Mining vs. Hardware Mining - 2018
Tech With Tim
48 How to Install Pygame on Mac OSX (Fast-Simple)
How to Install Pygame on Mac OSX (Fast-Simple)
Tech With Tim
49 Pygame Tutorial #9 - Sound Effects, Music & More Collision
Pygame Tutorial #9 - Sound Effects, Music & More Collision
Tech With Tim
50 Pygame Tutorial #10 - Finishing Touches & Next Steps
Pygame Tutorial #10 - Finishing Touches & Next Steps
Tech With Tim
51 How to Fade Your Screen in Pygame [CODE IN DESCRIPTION]
How to Fade Your Screen in Pygame [CODE IN DESCRIPTION]
Tech With Tim
52 How to Create a Button in Pygame [CODE IN DESCRIPTION]
How to Create a Button in Pygame [CODE IN DESCRIPTION]
Tech With Tim
53 Pygame Side-Scroller Tutorial #1 - Scrolling Background/Character Movement
Pygame Side-Scroller Tutorial #1 - Scrolling Background/Character Movement
Tech With Tim
54 Pygame Side-Scroller Tutorial #2 - Random Object Generation
Pygame Side-Scroller Tutorial #2 - Random Object Generation
Tech With Tim
55 Pygame Side-Scroller Tutorial #3 - Collision
Pygame Side-Scroller Tutorial #3 - Collision
Tech With Tim
56 Pygame Side-Scroller Tutorial #4 - Scoring and End Screen
Pygame Side-Scroller Tutorial #4 - Scoring and End Screen
Tech With Tim
57 How to Create A Message Box in Python - Tkinter
How to Create A Message Box in Python - Tkinter
Tech With Tim
58 Is Ethereum Mining Still Profitable - Is It Worth It (April 2018)
Is Ethereum Mining Still Profitable - Is It Worth It (April 2018)
Tech With Tim
59 How to Run MAC OSX on a WINDOWS PC (Clover Boot-loader)
How to Run MAC OSX on a WINDOWS PC (Clover Boot-loader)
Tech With Tim
60 Programming Problem #1 - Alphabet Soup (Beginner/Novice)
Programming Problem #1 - Alphabet Soup (Beginner/Novice)
Tech With Tim

The video teaches how to use UV, Streamlit, Rich, and Textual to improve Python development efficiency, including creating web-based UI, styling terminal applications, and managing dependencies. It provides a comprehensive introduction to these tools and their applications.

Key Takeaways
  1. Type UV init and then dot to create a new UV project
  2. Type uv add and then the name of the package you want to install
  3. Type uv run and then the name of your Python file
  4. Import Streamlit as ST and create a web-based UI
  5. Install Rich and Textual using UV add rich and textual
  6. Create a CPU and memory monitor using Textual and PSUIL
💡 Using UV, Streamlit, Rich, and Textual can significantly improve Python development efficiency and create visually appealing applications.

Related AI Lessons

Your AI Keeps Making Things Up. RAG Is How You Make It Use Real Facts Instead.
Learn how to use RAG to make your AI provide accurate answers based on real facts instead of making things up
Medium · RAG
Evaluation Metrics for RAG: Measure Retrieval, Generation, and End-to-End Quality With Numbers That…
Learn to evaluate RAG models using metrics that measure retrieval, generation, and end-to-end quality
Medium · AI
Evaluation Metrics for RAG: Measure Retrieval, Generation, and End-to-End Quality With Numbers That…
Learn to evaluate RAG models using metrics that measure retrieval, generation, and end-to-end quality
Medium · Data Science
When Does HyDE Help RAG? I Tested 3 Query Types and It Failed on Two
Learn when HyDE retrieval helps or hinders RAG performance across different query types, and why it matters for improving search accuracy
Medium · AI

Chapters (6)

| Introduction
0:21 | Tool 1 - uv Package Manager
3:00 | SEOWriting
4:32 | Tool 2 - Streamlit
6:56 | Tool 3 - python-dotenv
10:08 | Tool 4 - Rich & Textual
Up next
RRF vs DBSF with Qdrant: Hybrid Retrieval Fusion for RAG in Python
Professor Py: AI Engineering
Watch →