#python

318 bookmarks tagged with #python · RSS Feed · ← All Tags

yfedoseev/pdf_oxide: The fastest PDF library for Python and Rust. Text extraction, image extraction, markdown conversion, PDF creation & editing. 0.8ms mean, 5× faster than industry leaders, 100% pass rate on 3,830 PDFs. MIT/Apache-2.0.

https://github.com/yfedoseev/pdf_oxide
The fastest PDF library for Python and Rust. Text extraction, image extraction, markdown conversion, PDF creation & editing. 0.8ms mean, 5× faster than industry leaders, 100% pass rate on 3,830 PDFs. MIT/Apache-2.0.

Django 6.0 released | Weblog | Django

https://www.djangoproject.com/weblog/2025/dec/03/django-60-released/
The Django team is happy to announce the release of Django 6.0. The release notes assembles a mosaic of modern tools and thoughtful design. A few highlights are: Template Partials: modularize templates using small, named fragments for cleaner, more maintainable code. (GSoC project by Farhan Ali Raza, mentored by Carlton Gibson) Background Tasks: run code outside the HTTP request-response cycle with a built-in, flexible task framework. (Jake Howard)

Litestar is worth a look

https://www.b-list.org/weblog/2025/aug/06/litestar/
A few years ago at work, I had a project which offered an opportunity to look at the new generation of async-first, type-hint-driven Python web frameworks. For reasons which aren’t particularly relevant today, on that project I ended up choosing Litestar, which is the one that doesn’t have a ravenous all-consuming hype machine surrounding it. And I’m very glad I did, because today I’m more convinced than ever it was the right choice, and for the last 18 months or so every new project I’ve started at my day job has been built with Litestar.

Rust, Python, and TypeScript: the new trifecta · baby steps

https://smallcultfollowing.com/babysteps/blog/2025/07/31/rs-py-ts-trifecta/
But of course programmers have evolved a way to cope with human’s narrow focus: type systems, and particularly advanced type systems. Basic type systems catch small mistakes, like arguments of the wrong type. But more advanced type systems, like the ones in Rust and TypeScript, also capture domain knowledge and steer you down a path of success: using a Rust enum, for example, captures both which state your program is in and the data that is relevant to that state. This means that you can’t accidentally read a field that isn’t relevant at the moment. This is important for you, but it’s even more important for your AI collaborator(s), because they don’t have the comprehensive memory that you do, and are quite unlikely to remember those kind of things.

Run Your Own AI – AnthonyLewis.com

https://anthonylewis.com/2025/06/01/run-your-own-ai/
Here are some instructions that I shared with my co-workers. These are specifically for Macs with an M-series processor. On a PC, skip the steps about MLX and use Ollama to download a model. Then install the llm-llama plugin instead of llm-mlx.

Fun with uv and PEP 723

https://www.cottongeeks.com/articles/2025-06-24-fun-with-uv-and-pep-723
For the longest time, I have been frustrated with Python because I couldn’t use it for one-off scripts. I had to first ensure it was running in an environment where it could find the right Python version and the dependencies installed. That is now a thing of the past.

halcy log - Mastodon.py in the browser!

https://halcy.de/blog/2025/02/18/mastodonpy-in-the-browser/
Today, I learned that PyScript exists. PyScript is, at its core, some rigging to make Pyodide, a WebAssembly port of the CPython Python interpreter, real easy to use as a proper client-side web scripting language. Just include one <script> tag and now <script type="py"> is a valid thing you can have in your website. Put Python code inside of it, interact with the DOM, the works. I think that rules and/or is kind of horrifying, depending. Obviously, for me, the immediate question was: Can this run Mastodon.py? And the answer is: Yes, very competently.

The definitive guide to using Django with SQLite in production | alldjango.com

https://alldjango.com/articles/definitive-guide-to-using-django-sqlite-in-production
Especially for side projects with limited traffic requirements and scaling concerns, the promise of SQLite is that it can remove a lot of ongoing hassles. Without a separate database, cache, or queue, there is less network traffic (because the SQLite file is local), and less servers to manage, maintain, and backup.

Playground Wisdom: Threads Beat Async/Await | Armin Ronacher's Thoughts and Writings

https://lucumr.pocoo.org/2024/11/18/threads-beat-async-await/
It's been a few years since I wrote about my challenges with async/await-based systems and how they just seem to not support back pressure well. A few years later, I do not think that this problem has subsided much, but my thinking and understanding have perhaps evolved a bit. I'm now convinced that async/await is, in fact, a bad abstraction for most languages, and we should be aiming for something better instead and that I believe to be thread.

PRAW: The Python Reddit Api Wrapper — PRAW 2.1.4 documentation

https://praw.readthedocs.org/en/latest/
PRAW, an acronym for “Python Reddit API Wrapper”, is a python package that allows for simple access to reddit’s API. PRAW aims to be as easy to use as possible and is designed to follow all of reddit’s API rules. You have to give a useragent that follows the rules, everything else is handled by PRAW so you needn’t worry about violating them.

PRAW: The Python Reddit Api Wrapper — PRAW 2.1.4 documentation

https://praw.readthedocs.org/en/latest
PRAW, an acronym for “Python Reddit API Wrapper”, is a python package that allows for simple access to reddit’s API. PRAW aims to be as easy to use as possible and is designed to follow all of reddit’s API rules. You have to give a useragent that follows the rules, everything else is handled by PRAW so you needn’t worry about violating them.

webiopi - Raspberry Pi REST framework to control GPIO and more - Google Project Hosting

http://code.google.com/p/webiopi/
WebIOPi is a REST framework and a webapp which allows you to control your Raspberry Pi's GPIO. Just install it on your Pi, and use any browser from your network. It's useful to start enjoying GPIOs and also to debug some circuits without writing any line of code. It also allows to control your Pi's GPIOs over Internet, so it's a good starting point for home remote control.

webiopi - Raspberry Pi REST framework to control GPIO and more - Google Project Hosting

http://code.google.com/p/webiopi
WebIOPi is a REST framework and a webapp which allows you to control your Raspberry Pi's GPIO. Just install it on your Pi, and use any browser from your network. It's useful to start enjoying GPIOs and also to debug some circuits without writing any line of code. It also allows to control your Pi's GPIOs over Internet, so it's a good starting point for home remote control.

Using Travis-CI with Python and Django - David Cramer's Blog

http://justcramer.com/2012/05/03/using-travis-ci/
I’ve been using Travis-CI for a while now. Both my personal projects, and even several of the libraries we maintain at DISQUS rely on it for Continuous Integration. I figured it was about time to confess my undenying love for Travis, and throw up some notes about the defaults we use in our projects.

Django Development Server with HTTPS - xster.net - Never relearn twice

http://tech.xster.net/tips/django-development-server-with-https/
Sometimes you can’t avoid using HTTPS right starting from development (such as for developing Facebook canvas applications). You can setup Apache on your local machine and go through a bunch of trouble setting up your domain and setting up the certificate etc but there’s an easy way of using Django’s python manage.py runserver to work with HTTPS.

Django Development Server with HTTPS - xster.net - Never relearn twice

http://tech.xster.net/tips/django-development-server-with-https
Sometimes you can’t avoid using HTTPS right starting from development (such as for developing Facebook canvas applications). You can setup Apache on your local machine and go through a bunch of trouble setting up your domain and setting up the certificate etc but there’s an easy way of using Django’s python manage.py runserver to work with HTTPS.

Why Django Sucks, Except When It Doesn’t « Coffee on the Keyboard

http://coffeeonthekeyboard.com/why-django-sucks-except-when-it-doesnt-664/
If you’re prototyping a new project, or if you’re a start-up and need to ship something, or if you’re just one person working on a little app with a few (even a few tens of thousands) of users, odds are that none of those benefits are worth losing the nice stuff Django gives you, or the time it takes to build APIs (even using existing apps to do it) or abstraction layers between the silos.

Why Django Sucks, Except When It Doesn’t « Coffee on the Keyboard

http://coffeeonthekeyboard.com/why-django-sucks-except-when-it-doesnt-664
If you’re prototyping a new project, or if you’re a start-up and need to ship something, or if you’re just one person working on a little app with a few (even a few tens of thousands) of users, odds are that none of those benefits are worth losing the nice stuff Django gives you, or the time it takes to build APIs (even using existing apps to do it) or abstraction layers between the silos.

Custom Admin Views and Reversing Django Admin URLs - Ian Lewis

http://www.ianlewis.org/en/reversing-django-admin-urls
The key parts are the get_urls function and the admin_update_feeds view. The get_urls method returns the urls for this admin to which we are adding our custom view. The custom view does the updating of the lifestream feeds and returns the user to the Item model's changelist view. We get the url for that view by calling reverse with the pattern "<namespace>:<app>_<model>_changelist" which in our case is "admin:lifestream_item_changelist" since the django admin uses the admin namespace.

Python | Bernstein Bear

http://bernsteinbear.com/python
Sometimes, just to screw with people, I will rewrite .bashrc to contain only: echo "Python 2.6.6 (r266:84374, Aug 31 2010, 11:00:51) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information." export PS1=">>> " trap bashtrap INT bashtrap() { echo -n " KeyboardInterrupt" }

pyTivo - Wiki

http://pytivo.sourceforge.net/wiki/index.php/PyTivo
pyTivo is both an HMO and GoBack server. Similar to TiVo Desktop, pyTivo loads many standard video compression codecs and outputs mpeg2 video to the TiVo. However, pyTivo is able to load many more file types than TiVo Desktop.

Ned Batchelder: Global Django requests

http://nedbatchelder.com/blog/201008/global_django_requests.html
"As my Django sites get larger and larger, there inevitably comes a point where I want access to the current request from deep inside some function that doesn't have the request object. The latest reason was that I wanted a model class helper to have access to the session so it could access some debug flags. "

Django Signals enable Aspect-Oriented programming. by Elf Sternberg

http://www.elfsternberg.com/2010/07/29/lightbulb-django-signals-aspectoriented-programming
"This is exactly the kind of cross-cutting concern (note the use of a signal publisher for notification!) that would be better handled with a signal from the microblogging app. Perhaps the app could have published “tweet received” as a signal, with an optional “module for common associated applications” dispatching that event to logging, activity streams, notifications or whatever as available. The presence of explicit publication would have signaled to any developer to look for subscribers, so I don’t think this is a dangerous case of unlabeled subroutines and the potential for spaghetti code that goes with it. Most Django apps are small silos of code; it would not have been onerous to separate out and isolate this cross-cutting concern from the rest of the microblogging application’s functionality."

Python Package Index : django-app-plugins 0.1.1

http://pypi.python.org/pypi/django-app-plugins/0.1.1
"A template extension system for marking points in your django templates as 'plugin-points', and providing plugins which inject themselves at those points. Multiple applications can be injected at each plugin point, and 'registered' plugin-points can have the visibility, order and access of the plugins controlled via DB models. This control can be done on a site wide or per-user basis. Thus you can allow users to add, remove, and reorder the plugins on their profile page for instance."

Django Software Stack : Sourcefabric

http://www.sourcefabric.org/en/home/blog/139/Django-Software-Stack.htm?tpl=355
"Here at Sourcefabric we have been looking in to what software stack to use for our next web products. This discussion used to be (oh, 5-10 years ago) a lot simpler, mainly involving choosing an operating systems, a language, and a database. But now it’s about higher-level things like out-of-the-box support for commenting, activity streams, ajax, cloud storage, deployment tools, scalability, geolocation, tagging, RESTful interfaces, search, twitter, facebook, and a whole lot more. Users and customers are starting to expect all of this built into any web application you build. Building applications these days is largely about integrating a large number of existing technologies instead of building something from scratch."

Making development with Django more fun with BDD under Freshen | Francisco Souza

http://www.franciscosouza.net/2010/06/making-development-with-django-more-fun.html
"Freshen is an acceptance testing framework for Python, inspired by Cucumber and has the same goal: make BDD fun, but using Python instead of Ruby. Freshen uses the same syntax of Cucumber (Gherkin Syntax) and runs as a plugin of Nose, a powerful Python tool for using daily when you with TDD"

uWSGI

http://projects.unbit.it/uwsgi
"uWSGI is a fast (pure C), self-healing, developer-friendly WSGI server, aimed for professional python webapps deployment and development. Over time it has evolved in a complete stack for networked/clustered python applications, implementing message/object passing and process management. It uses the uwsgi (all lowercase) protocol for all the networking/interprocess communications. From the 0.9.5 release it includes a plugin loading technology that can be used to add support for other languages or platform. A Lua wsapi adaptor, a PSGI handler and an Erlang message exchanger are already available. "

cloudkick | blog: 4 Months with Cassandra, a love story

https://www.cloudkick.com/blog/2010/mar/02/4_months_with_cassandra
"At Cloudkick we track a ton of metrics about our customer's servers and it's quite a challenge to store such massive amounts of data. Early on, we made the decision to avoid using tools like RRDTool, so we could provide a more holistic look at infrastructure. We had two firm requirements: we wanted to show trends on a macro-level and to have very low latency so our users would never wait for graphs to build. We initially used PostgreSQL, but as we added billions of rows, the performance quickly degraded. We used cron jobs that would roll up the data on intervals to trade storage for throughput and lower latency. With clever partitioning, we were able to stretch the system to a certain point, but beyond that we faced issues of needing a much bigger machine and faster rotational disks to accommodate our business requirements; that's when started looking at other solutions."

Impressive

http://impressive.sourceforge.net
"Impressive is a program that displays presentation slides. But unlike OpenOffice.org Impress or other similar applications, it does so with style. Smooth alpha-blended slide transitions are provided for the sake of eye candy, but in addition to this, Impressive offers some unique tools that are really useful for presentations. "

evserver - Google Code

http://code.google.com/p/evserver
"EvServer is a lightweight http server, created especially to host python WSGI applications. Additionally, it supports little known Asynchronous WSGI extension, which was suggested by Christopher Stawarz. Using this extension it's possible to create an output html response in many data chunks, without blocking the main server process while your application waits for external resources. "

Dynamic programming futures | InfoWorld | Test Center | October 13, 2008 | By Peter Wayner, IDG News Service

http://weblog.infoworld.com/archives/emailPrint.jsp?A=/article/08/10/13/42TC-dynamic-futures_1.html&R=printThis
"What will the world of dynamic programming languages and Web applications look like in five years? This is one of those highly personal and deeply philosophical questions best saved for after dessert is served, the drinks are poured, and the sidearms are safely locked away."

Paver: Build, Distribute and Deploy Python Projects — Paver v0.8 documentation

http://www.blueskyonmars.com/projects/paver
"Paver is a Python-based build/distribution/deployment scripting tool along the lines of Make or Rake. What makes Paver unique is its integration with commonly used Python libraries. Common tasks that were easy before remain easy. More importantly, dealing with your applications specific needs and requirements is now much easier."

eyeD3 0.6.16

http://eyed3.nicfit.net
Looks like this can add cover art among other things. "eyeD3 is a Python module and program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3 v1.0/v1.1 and v2.3/v2.4"

Repoze

http://repoze.org/index.html
"Want the maturity of Zope now with the flexibility of the WSGI future? Repoze integrates Zope technologies with WSGI and reusable Python middleware."

Wait For It

http://pythonpaste.org/waitforit
"If the response doesn't come back before the time limit, the user is given a response page that asks them to wait. The response page contains Javascript that will re-check the status of the page"

MySpace parser

http://www.throwingbeans.org/myspace_parser.html
I was building something like this at my last job. "Here's a MySpace parser. Usage is straightforward; the constructor takes a MySpace URL or numerical ID, and profile, friend and comment details are exposed as attributes"

Markup - Trac

http://markup.edgewall.org
"Markup is a Python library that provides an integrated set of components for parsing, generating, and processing HTML or XML content in a uniform manner. The major feature is a template language, which is heavily inspired by Kid."

PylonsHQ

http://pylonshq.com
"Pylons combines the very best ideas from the worlds of Ruby, Python and Perl, providing a structured but extremely flexible Python web framework."

WPHP

http://blog.ianbicking.org/2006-wphp.html
"This means that PHP applications can be embedded in Python systems. This may not seem that exciting, until you have interesting WSGI middleware."

Routes

http://routes.groovie.org
"Routes is a Python re-implementation of the Rails routes system for mapping URL's to Controllers/Actions and generating URL's."

Python Templates

http://jtauber.com/2006/05/templates.html
"Originally posted to the Python Web SIG back in 2003. Published here May 2006 with minor changes."

appscript

http://freespace.virgin.net/hamish.sanderson/appscript.html
"Appscript makes MacPython a serious alternative to Apple's own AppleScript language for automating your Mac."

Tripoli: FAQ

http://tripoli.sourceforge.net/faq.html
"It has the special property that you can ask to inspect or remove a triple before it has been added, and the triplespace will supply you with the triple you asked for when it becomes available."

Go Siege

http://gosiege.sourceforge.net
"Go Siege is a transformation of the ancient Chinese game of Go into a massively multiplayer online game in which hundreds of players can compete simultaneously."

thunk.py

http://zesty.ca/python/thunk.py
"Use _ as a placeholder in an expression to create a one-argumentfunction that fills in the placeholder and evaluates the expression."

Embedding IPython

http://ipython.scipy.org/doc/manual/node9.html
"It is possible to start an IPython instance inside your own Python programs." Using this like I've used the BeanShell console in Java programs before.

SQLObject v0.6.1 released

http://sqlobject.org/docs/News.html#sqlobject-0-6-1
Wow, lots of really, really good feature advances like select distinct, indexes, unicode columns, and everything accepts a connection now.

DOMForm

http://wwwsearch.sourceforge.net/DOMForm
"DOMForm is a Python module for web scraping and web testing. It knows how to evaluate embedded JavaScript code in response to appropriate events."

Python main() functions

http://www.artima.com/weblogs/viewpost.jsp?thread=4829
"For Python programmers, I've got some suggestions on how to write a main() function that's easy to invoke in other contexts, e.g. from the interactive Python prompt when you feel like experimenting."

Kid

http://splice.sourceforge.net/kid
"Kid is a simple Pythonic template language for XML based vocabularies."

The ctypes module

http://starship.python.net/crew/theller/ctypes
"ctypes is a Python package to create and manipulate C data types in Python, and to call functions in dynamic link libraries/shared dlls. It allows wrapping these libraries in pure Python."

The Python Paradox

http://www.paulgraham.com/pypar.html
"And people don't learn Python because it will get them a job; they learn it because they genuinely like to program and aren't satisfied with the languages they already know."

Beautiful Soup

http://www.crummy.com/software/BeautifulSoup
"You didn't write that awful page. You're just trying to get some data out of it. Right now, you don't really care what HTML is supposed to look like."

Levenshtein

http://trific.ath.cx/resources/python/levenshtein
Python module for measuring 'distance' between two strings' contents

mnot - cgi_buffer

http://www.mnot.net/cgi_buffer
"cgi_buffer is a group of libraries (for Perl, Python and PHP) that automatically handle performance-improving HTTP features that most Web servers don't implement (at least for scripts)"