here you goThings I’ve made, read and saved — shared here.

Archive

9,565 entries: 46 from X, 8,923 from Pinboard, saved 1998 to 2026.

Browse by tag, site, author, folder or language

Tags

Sites

Authors

Folders

Languages

Showing 1–50 of 393#python ×

This month

NVIDIA/auto-ontology

github.com

Auto Ontology is a Python framework for building semantic, graph-based reasoning layers over data. It enables deterministic query generation, better context retrieval, and more explainable AI for LLM and agent workflows.

February 2026

Deploy Python to AWS in minutes, not days - Stelvio

stelvio.dev

Stelvio is run on top of pulumi, so it gives you access to multi cloud if needed. Also we automatically configure permissions between resources.

We do provide high level components which makes it easier to deploy an app without thinking about all underlying AWS primitive

And there is a dev mode in which you can run your lambdas locally from your AWS URLs.

2025

streamlit

Streamlit is a python library to build data apps. This is similar to observable, and evidence.

With uv, it is easy to see what streamlit looks like -- uv run --with streamlit streamlit hello -- this launches a demo app with a couple different visualization screens.

This is more along the lines of "UI controls that allow you to change the parameters of a chart/visualization" than evidence's "Dynamic report" approach.

Streamlit is a pythonic middle ground between reporting oriented evidence and a very visualization oriented observable.

another way to look at these three: streamlit is python, observable is javascript, and evidence is sql.

notes#dataapps#python

xlwings Lite documentation

lite.xlwings.org

xlwings Lite brings the VBA experience into the modern age by offering a privacy-first, secure, and developer-friendly way to automate Excel and write custom functions with Python.

It’s an Excel add-in that runs a web assembly instance of python locally on your machine and you can write excel macros and formulas with python instead of VBA. This differs from Microsoft’s Python for Excel in that it is 100% local, Microsoft uses an Azure instance to run the Python code.

2024

Python Inline Script Metadata

The PEP-723 lays out the intentions and how the metadata that can be embedded into python scripts to assist launchers, IDEs etc to interact with the script. uv was the first tool (to my knowledge) that brought this into wide attention.

Since then many python ecosystem tools have started to leverage this.

notes#python

scikit-learn

Scikit-learn provides libraries for - classification, regression, clustering, dimensionality reduction, model selection, preprocessing etc.

Scitkit-learn can be (should be) installed into a python virtualenv with pip install -U scikit-learn (the -U flag stands for "upgrade"). This installation in addition may requireother popular python data science libraries like numpy, pandas, matplotlib, cython, polars, .. etc for full functionality. The basic install only installed the following.

# 2024-08-27
$ pip freeze
joblib==1.4.2
numpy==2.1.0
scikit-learn==1.5.1
scipy==1.14.1
threadpoolctl==3.5.0

See also: pytorch, and tensorflow

notes#python#scikit

Django

Django from first principles

Static site generator for Django - Django Distill

While making https://thesummarist.net, I came across https://django-distill.com, which is THE BEST way to create static sites, bar none. You just make a standard, dynamic Django site, then you run a command and boom! It's static. I love it. -- via Stravos

Django SQLite Production Config

# yourproject/settings.py
DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "OPTIONS": {
            "transaction_mode": "IMMEDIATE",
            "timeout": 5,  # seconds
            "init_command": """
                PRAGMA journal_mode=WAL;
                PRAGMA synchronous=NORMAL;
                PRAGMA mmap_size = 134217728;
                PRAGMA journal_size_limit = 27103364;
                PRAGMA cache_size=2000;
            """,
        },
    }
}

notes#django#python

Python Frontend Frameworks

Write complete web applications in Python without writing javascript. There are a large class of problems for which this is an excellent solution, without having to dip into the javascript tarpit.

The advantage of something like this over using templates is that you can think of "widgets" vs "templates".

Some frameworks are:

Reflex (formerly known as pynecone). Uses FastAPI + React.

NiceGUI. Uses FastAPI + Vue.js + Quasar, tailwind.

Pydantic/FastUI. Uses React. still early in development.

Gradio -- "Build & Share Delightful Machine Learning Apps"

notes#javascript#python#web

Ray

(Moritz et al. 2018) PDF

Ray unifies task-parallel and actor programming models in a single dynamic task graph and employs a scalable architecture enabled by the global control store and a bottom-up distributed scheduler. The programming flexibility, high throughput, and low latencies simultaneously achieved by this architecture is particularly important for emerging artificial intelligence work- loads, which produce tasks diverse in their resource requirements, duration, and functionality.

Learning Ray by Max Pumperla, Edward Oakes, and Richard Liaw. ( PDF ).

In short, Ray sets up and manages clusters of computers so that you can run distributed tasks on them. A Ray Cluster consists of nodes that are connected to each other via a network. You program against the so-called driver, the program root, which lives on the head node. The driver can run jobs, a collection of tasks, that are run on the nodes in the cluster. Specifically, the individual tasks of a job are run on worker processes on worker nodes.

This cluster can also be local, on your laptop. The default number of worker processes is the number of CPUs available on your machine.

Github - https://github.com/ray-project/ray

$ pip install "ray[rllib, serve, tune]==2.10.0"

import ray
ray.init()

Libraries:

  • data processing -- apache-arrow
  • model training -- TensorFlow, pytorch
  • hyperparameter tuning
  • model serving

News:

References

notes#distributed#python#ray

paveldedik/ludic: Lightweight framework for building HTML pages in pure Python.

github.com

Ludic is a lightweight framework for building HTML pages with component approach similar to React. It is built to be used together with htmx.org so that developers don't need to write almost any JavaScript to create dynamic web services. It's potential can be leveraged together with its web framework which is a wrapper around powerful Starlette framework.

mfarragher/obsidiantools: Obsidian tools - a Python package for analysing an Obsidian.md vault

github.com

obsidiantools is a Python package for getting structured metadata about your Obsidian.md notes and analysing your vault. Complement your Obsidian workflows by getting metrics and detail about all your notes in one place through the widely-used Python data stack.

It's incredibly easy to explore structured data on your vault through this fluent interface. This is all the code you need to generate a vault object that stores all the data:

great_tables - Intro

posit-dev.github.io

The Great Tables package is all about making it simple to produce nice-looking display tables. Display tables? Well yes, we are trying to distinguish between data tables (i.e., DataFrames) and those tables you’d find in a web page, a journal article, or in a magazine. Such tables can likewise be called presentation tables, summary tables, or just tables really. Here are some examples, ripped straight from the web:

2023

Jupyter

Do not misuse Jupyter, understand the limitations -- "Notebooks are McDonalds of Code."

Books

Teaching and Learning with Jupyter An open book about Jupyter and its use in teaching and learning.

Tools

seeM/Jim: Jim is a simple, beautiful Jupyter notebook editor for macOS (last commit in 2023)

nbdev – Create delightful software with Jupyter Notebooks Write, test, document, and distribute software packages and technical articles — all in one place, your notebook.

voila -- Voilà allows you to convert a Jupyter Notebook into an interactive dashboard that allows you to share your work with others.

Alternatives / Improvements

marimo "is a reactive notebook for Python that models notebooks as dataflow graphs: run a cell or interact with a UI element, and marimo automatically runs affected cells, keeping code and outputs consistent and preventing bugs before they happen. Every marimo notebook is stored as pure Python, executable as a script, and deployable as an app." ;Lessons learned reinventing the Python notebook | marimo

nteract "NATIVE INTERACTIVE NOTEBOOKS"

In other languages

See also: srcbookdev/srcbook: JS/TS notebook for typescript.

Clerk in clojure is another alternative to jupyter note books.

Livebook.dev is for elixir.

See Data Apps for frameworks.

notes#jupyter#notebook#python

watchfiles

Watchfiles is a file watching and code reload in python, written in rust.

Usage:

# pip install watchfiles
from watchfiles import watch

for changes in watch('./path/to/dir'):
    print(changes)

Also supports async via awatch:

import asyncio
from watchfiles import awatch

async def main():
    async for changes in awatch('/path/to/dir'):
        print(changes)

asyncio.run(main())

Alternatives

notes#nix#python#rust

pandas

Top level notes

  • Pandas Documentation Homepage
  • Installing (2.0) -- pip install pandas==2.0
    • installing pandas will also install numpy
  • Pandas helps in working with tabular data (databases, spreadsheets)
  • Helps = explore, clean and proess
  • Anything you can do with SQL you can also do with Pandas.
    • Group by operations
  • Summary Statistics. eg., mean, median, std..
  • The data table is called a DataFrame
  • pandas can read (read_ methods) from various file formats like csv, xls, parquet, hdf5, json, sql (db) and generate output (to_ methods) in the above formats.
  • matplotlib is used to generated plots from data tables.
  • split-apply-combine approach. Hmm.. map-reduce?
  • melt() to convert from wide -> long/tidy form and pivot() to convert from long to wide format.
  • combine multiple tables using concat() function for column-wise or row-wise joining
  • for database like joining/merging, use the merge function. pd.merge(tbone, tbtwo, how="left", left_on="col1", right_on="col2"). also merge_asof
  • pandas supports inner, outer, right and left joins.
  • use shape() to find the rowxcolumn shape.
  • TODO: how vectorization is done in pandas
  • TODO: where numpy is faster than pandas
  • TODO: Pyspark with pandas

Quick intro

import numpy as np
import pandas as pd

# create new Series
s = pd.Seres([1,2,3, pd.nan, 8, 121])
# pd.nan = not a number

# pd.date_range("<YYYYMMDD", periods=n) produces a
# a date range starting at YYYYMMDD for the period `n`

# dataframes are created with

df = pd.DataFrame(nparray, index=<indexvec>, columns=list(names))
# the nparray is a 2-d numpy array of mxn dimensions

# the df can also be created by passing a dict with keys as the
# column names and the value as the series.

Articles

notes#python

Minify HTML

wilsonzlin/minify-html : Extremely fast and smart HTML + JS + CSS minifier, available for Rust, Deno, Java, Node.js, Python, Ruby, and WASM

The Python library on pypi.

Using the Python library:

# code/example_minifyhtml.py
#!/usr/bin/env python

import minify_html

with open("output/index.html") as f:
    t = f.read()
    print(t)
    o = minify_html.minify(
        t,
        do_not_minify_doctype=True,
        keep_spaces_between_attributes=True,
        ensure_spec_compliant_unquoted_attribute_values=True,
    )
    print(o)

notes#html#python

JAX

JAX is a Python library which augments numpy and Python code with function transformations which make it trivial to perform operations common in machine learning programs. Concretely, this makes it simple to write standard Python/numpy code and immediately be able to

Compute the derivative of a function via a successor to autograd Just-in-time compile a function to run efficiently on an accelerator via XLA Automagically vectorize a function, so that e.g. you can process a “batch” of data in parallel. learn more ... "You don't know Jax" (2019)

Jax's website - google/jax: Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more

JAX and Equinox: What are they and why should I bother?

notes#deep-learning#python

2022

2021

2020

Python Programming Language

My Python Stuff

Meta

Advanced Python

dabeaz-course/python-mastery: Advanced Python Mastery (course by David Beazley)

Books

  • Fundamentals of Python programming (PDF) -- "... introduction to computer programming textbooks are available in PDF form for free download. University and high school students and self learners around the world have found them helpful. See the terms of use in the preface of each book."

  • Intermediate Python -- "Fluent python" by Luciano Ramalho.

Learning sources

"This repository contains the text for the Tiny Python 3.6 Notebook. it is a notebook containing curated examples for Python 3 as well as the new features found in Python 3.6."

Internals

Developer Experience (DevEx)

Make Python DevEx -- this is very close to how I choose to do Python development. good read. I don't have such an extensive Makefile setup.

Debugging

Profiling

Web

Multiprocessing

Async

Sublime Text

Alternate Python implementations

To Install Zippy:

hg clone https://bitbucket.org/ssllab/zippy
cd zippy
TBD

Libraries

Data science libraries

Conferences

Python3

Pypy

Package management

python setup.py sdist
python setup.py bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Project Managers

Do not use requirements.txt - quanttype -- instead choose Poetry, Hatch or pdm.

Poetry

I have been using poetry for a while.

Poetry uses the pyproject.toml standard, but it does not follow the standard specifying how metadata should be represented in a pyproject.toml file (PEP 621), instead using a custom [tool.poetry] table. This is partly because Poetry came out before PEP 621. -- from pdm's documentation

Hatch

pdm

Unlike Poetry and Hatch, PDM is not limited to a specific build backend; users have the freedom to choose any build backend they prefer.

Links

2019

Via My Python Development Environment, 2020 Edition | Jacob Kaplan-Moss:

notes#programming-language#python

2019

2017

2015

2014

2013

2012