r/Python • • Apr 20 '14

HMTL and Python

0 Upvotes

I'm trying to use the setHtml function of PyQt to display some Html for a small app. I'd like to return the text from a function. Currently, on calling the function, the HTML displays in the textBrowser, but there is no right justify of the numbers in stack list.

Code:

def display(stack):
head = '''

<!DOCTYPE html>

<style type="text/css"> body { font-family: sans-serif; font-size: large } .container { position: absolute; bottom:0; margin: 0 5px 5px 5px; } .right{ display: block; float: right; text-align: right width: 500px; } </style>

<body>'''

tail = '</body>'

i = len(stack)
for num in stack:
	if i % 2 == 0:
		line = '<div class = "container"; style = background-color:#a0c4de;><b>' + str(i) +':</b>' +  \
						'<span class = "right">'+ str(num) +'</span>' + \
					'</div>'
	else:
		line = '<div class = "container"><b>' + str(i) +':</b>' + \
						'<span class = "right">' + str(num) +'</span>' + \
					'</div>'

	head += line
	i -= 1
		
return head + tail

I originally wanted to use Jinja 2 to accomplish this but wasn't able to get it to work.

Any advice is appreciated.

Edit: I don't think pyqt supports the css styles I'm trying to use: PyQt style docs

However, I'm still not able to get this to work even by using margin-right: 100px; in my .left properties. However, this works using JSFiddle: HTML test

Thoughts?


r/Python • • Apr 26 '14

I wrote a virutalenv bootstrap, so you can virtualenv your virtualenv while you virtualenv your virtualenv without installing virtualenv

Thumbnail
github.com
0 Upvotes

r/Python • • Feb 08 '14

I made a Program that I was about to publish but I realized other people would need a form of Python to open up the file. What could a user download without downloading a whole IDE?

2 Upvotes

r/Python • • 21d ago

Discussion PYTHON 🆚 ALL ...

0 Upvotes

"If you want to learn programming, don’t start with Python; you should start with another language."

This advice seems ridiculous to me, even though I hear it everywhere. Can someone explain this advice to me... and are they right?


r/Python • • Feb 26 '26

Showcase ytmpcli - a free open source way to quickly download mp3/mp4

12 Upvotes
  • What My Project Does

    • so i've been collecting songs majorly from youtube and curating a local list since 2017, been on and off pretty sus sites, decided to create a personal OSS where i can quickly paste links & get a download.

    • built this primarily for my own collection workflow, but it turned out clean enough that I thought i’d share it with y'all. one of the best features is quick link pastes/playlist pastes to localize it, another one of my favorite use cases is getting yt videos in a quality you want using the res command in the cli.

  • Target Audience (e.g., Is it meant for production, just a toy project, etc.)

    • its a personal toy project

  • Comparison (A brief comparison explaining how it differs from existing alternatives.)

    • there are probably multiple that exist, i'm posting my personal minimalistic mp3/mp4 downloader, cheers!

https://github.com/NamikazeAsh/ytmpcli

(I'm aware yt-dlp exists, this tool uses yt-dlp as the backend, it's mainly for personal convenience for faster pasting for music, videos, playlists!)


r/Python • • Apr 16 '14

Why I went from Python to Go (and not node.js)

Thumbnail
jordanorelli.com
4 Upvotes

r/Python • • Feb 26 '26

Showcase A minimal, framework-free AI Agent built from scratch in pure Python

0 Upvotes

Hey r/Python,

What My Project Does:
MiniBot is a minimal implementation of an AI agent written entirely in pure Python without using heavy abstraction frameworks (no LangChain, LlamaIndex, etc.). I built this to understand the underlying mechanics of how agents operate under the hood.

Along with the core ReAct loop, I implemented several advanced agentic patterns from scratch. Key Python features and architecture include:

  • Transparent ReAct Loop: The core is a readable, transparent while loop that handles the "Thought -> Action -> Observation" cycle, showing exactly how function calling is routed.

  • Dynamic Tool Parsing: Uses Python's built-in inspect module to automatically parse standard Python functions (docstrings and type hints) into LLM-compatible JSON schemas.

  • Hand-rolled MCP Client: Implements the trending Model Context Protocol (MCP) from scratch over stdio using JSON-RPC 2.0 communication.

  • Lifecycle Hooks: Built a simple but powerful callback system (utilizing standard Python Callable types) to intercept the agent's lifecycle (e.g., on_thought, on_tool_call, on_error). This makes it highly extensible for custom logging or UI integration without modifying the core loop.

  • Pluggable Skills: A modular system to dynamically load external capabilities/functions into the agent, keeping the namespace clean.

  • Lightweight Teams (Subagents): A minimal approach to multi-agent orchestration. Instead of complex graph abstractions, it uses a straightforward Lead/Teammate pattern where subagents act as standard tools that return structured observations to the Lead agent.

Target Audience:
This is strictly an educational / toy project. It is meant for Python developers, beginners, and students who want to learn the bare-metal mechanics of LLM agents, subagent orchestration, and the MCP protocol by reading clear, simple source code. It is not meant for production use.

Comparison:
Unlike LangChain, AutoGen, or CrewAI which use deep class hierarchies and heavy abstractions (often feeling like "black magic"), MiniBot focuses on zero framework bloat. Where existing alternatives might obscure the tool-calling loop, event hooks, and multi-agent routing behind multiple layers of generic executors, MiniBot exposes the entire process in a single, readable agent.py and teams.py. It’s designed to be read like a tutorial rather than used as a black-box dependency.

Source Code:
GitHub Repo:https://github.com/zyren123/minibot


r/Python • • Feb 02 '26

Discussion Was there a situation at work where a compiler for python would have been a game changer for you?

0 Upvotes

I’m currently working on one and I’m looking for concrete use-cases where having a single executable built from your python scripts would have been a game changer. I know about PyInstaller and Nuitka, but they don’t seem to be reliable enough for industry use.


r/Python • • Apr 08 '17

How to Win Slot Machines - Intro to Deep Learning

Thumbnail
youtube.com
7 Upvotes

r/Python • • Aug 06 '09

Automatically Respond to Twitter Messages Python Script

Thumbnail
halotis.com
7 Upvotes

r/Python • • Sep 02 '24

News Deta Space is shutting down.

0 Upvotes

After an incredible run, we've made the difficult decision to shut down Deta Space. You can continue to login for 45 days until sunset on October 17, 2024, at which point we will start deleting all apps (hosted or installed) and data in Collections.

We've built tools for exporting your data (and code for developers), with tutorials available in the docs.

We wanted to thank you for joining the journey so far. Everything we've done wouldn't have been possible without our community, mods, investors, and friends. We hope you'll stick around for what's next.
https://deta.space/sunset

(I'm not from the Team, I am a user)


r/Python • • Feb 13 '17

Scrapy | A Fast and Powerful Scraping and Web Crawling Framework

Thumbnail scrapy.org
7 Upvotes

r/Python • • Jul 23 '16

Why shouldn't I use vim as my python IDE?

15 Upvotes

Hi pythonistas!

I'd like to know why I should prefer pycharm, spyder or or some other IDE over vim. Are there things I can't do with vim or that I can do better with those alternatives? Will I reach a point (e.g. when I am a more advanced programmer) where vim for some reason cannot suffice anymore my requirements and I will be forced to drop it as my IDE?

I am asking this because I am deeply fascinated by vim. I steadily discover new, helpful, awesome stuff about it everyday. I have a highly customized configuration in addition to the fantastic builtins and am writing faster and more productively with every keystroke.

But I want the best of the best. And if there are valid reasons to change to another IDE then I need to do it now. Soon I may be lost in vim's black hole, forever.

Please give me reasons for not using vim!


r/Python • • Nov 19 '25

Discussion [Project] I got tired of manually creating project folders… so I built tree2fs (turns tree tex

0 Upvotes

Hi r/Python! I just published tree2fs to PyPI. It solves a problem I've had for a long time: manually recreating project structures from documentation or generated ones from ChatGPT/Claude..etc.

What it does: Converts tree-formatted text into actual files and folders.

Example:

project/ 
 ├── src/ 
 │ └── main.py
 └── tests/

Run tree2fs tree.txt and it creates everything.

Installation: $ pip install tree2fs

- PyPI: https://pypi.org/project/tree2fs/
- GitHub: https://github.com/ABDELLAH-Hallou/tree2fs

I'd love feedback! What features would make this more useful?