<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Python on Big Muddy</title><link>https://muddy.jprs.me/tags/python/</link><description>Recent content in Python on Big Muddy</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sat, 28 Mar 2026 08:43:00 -0400</lastBuildDate><atom:link href="https://muddy.jprs.me/tags/python/index.xml" rel="self" type="application/rss+xml"/><item><title>Opt out of very new Python package versions with uv</title><link>https://muddy.jprs.me/notes/2026-03-28-opt-out-of-very-new-python-package-versions-with-uv/</link><pubDate>Sat, 28 Mar 2026 08:43:00 -0400</pubDate><guid>https://muddy.jprs.me/notes/2026-03-28-opt-out-of-very-new-python-package-versions-with-uv/</guid><description>&lt;p&gt;In light of several recent Python package compromises (&lt;a href="https://snyk.io/articles/poisoned-security-scanner-backdooring-litellm/"&gt;&lt;code&gt;litellm&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://www.aikido.dev/blog/telnyx-pypi-compromised-teampcp-canisterworm"&gt;&lt;code&gt;telnyx&lt;/code&gt;&lt;/a&gt;), here is a useful tip from Hacker News commenter &lt;a href="https://news.ycombinator.com/item?id=47547140"&gt;mil22&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;For those using &lt;em&gt;uv&lt;/em&gt;, you can at least partially protect yourself against such attacks by adding this to your &lt;em&gt;pyproject.toml&lt;/em&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;[tool.uv]&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;exclude-newer = &amp;quot;7 days&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;or this to your &lt;em&gt;~/.config/uv/uv.toml&lt;/em&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;exclude-newer = &amp;quot;7 days&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;This will prevent &lt;em&gt;uv&lt;/em&gt; picking up any package version released within the last 7 days, hopefully allowing enough time for the community to detect any malware and yank the package version before you install it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Commenter &lt;a href="https://news.ycombinator.com/item?id=47547405"&gt;notatallshaw&lt;/a&gt; follows up with how to achieve similar behaviour in *pip*:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Pip maintainer here, to do this in pip (26.0+) now you have to manually calculate the date, e.g. &amp;ndash;uploaded-prior-to=&amp;quot;$(date -u -d &amp;lsquo;3 days ago&amp;rsquo; &amp;lsquo;+%Y-%m-%dT%H:%M:%SZ&amp;rsquo;)&amp;quot;&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;In pip 26.1 (release scheduled for April 2026), it will support the day ISO-8601 duration format, which uv also supports, so you will be able to do &amp;ndash;uploaded-prior-to=P3D, or via env vars or config files, as all pip options can be set in either.&lt;/p&gt;
&lt;/blockquote&gt;</description></item><item><title>Using Claude Claude for cross-package statistical audits</title><link>https://muddy.jprs.me/links/2026-03-15-using-claude-claude-for-cross-package-statistical-audits/</link><pubDate>Sun, 15 Mar 2026 22:49:00 -0400</pubDate><guid>https://muddy.jprs.me/links/2026-03-15-using-claude-claude-for-cross-package-statistical-audits/</guid><description>&lt;p&gt;Economist Scott Cunningham shared an important example of why we should always report the statistical package and version used in our analyses, as he used Claude Code to produce six versions of the exact same analysis using six different packages in R, Python, and Stata. In a &lt;a href="https://en.wikipedia.org/wiki/Difference_in_differences"&gt;difference-in-differences&lt;/a&gt; analysis of the mental health hospital closures on homicide using the standard &lt;a href="https://bcallaway11.github.io/did/articles/multi-period-did.html"&gt;Callaway and Sant’Anna estimator&lt;/a&gt; (for DiD with multiple time periods), he got very different results for some model specifications.&lt;/p&gt;
&lt;p&gt;Since the specifications and the data were identical between packages, he discovered the divergences occurred due to how the packages handled problems with &lt;a href="https://www.tandfonline.com/doi/full/10.1080/00273171.2011.568786#d1e368"&gt;propensity score&lt;/a&gt; weights. Packages were not necessarily transparent about issues with these weights. If you were not running multiple analyses and comparing results across packages, or else carefully checking propensity score diagnostics, you might never have realized how precarious your results were.&lt;/p&gt;
&lt;p&gt;Prof. Cunningham closes with the following advice:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The fifth point, and the broader point, is that this kind of cross-package, cross-language audit is exactly what Claude Code should be used for. Why? Because this is a task that is time-intensive, high-value, and brutally easy to get wrong. But just one mismatched diagnostic across languages invalidates the entire comparison, even something as simple as sample size values differing across specifications, would flag it. This is both easy and not easy — but it is not the work humans should be doing by hand given how easy it would be to even get that much wrong.&lt;/p&gt;</description></item><item><title>An end-to-end AI pipeline for policy evaluation papers</title><link>https://muddy.jprs.me/links/2026-02-12-an-end-to-end-ai-pipeline-for-policy-evaluation-papers/</link><pubDate>Thu, 12 Feb 2026 19:11:00 -0500</pubDate><guid>https://muddy.jprs.me/links/2026-02-12-an-end-to-end-ai-pipeline-for-policy-evaluation-papers/</guid><description>&lt;p&gt;Prof. David Yanagizawa-Drott from the Social Catalyst Lab at the University of Zurich has launched Project APE (Autonomous Policy Evaluation), an end-to-end AI pipeline to generate policy evaluation papers. The vast majority of policies around the world are never rigorously evaluated, so it would certainly be useful if we were able to do so in an automated fashion.&lt;/p&gt;
&lt;p&gt;Claude Code is the heart of the project, but other models are used to review the outputs and provide journal-style referee reports. All the coding is done in R (though Python is called in some scripts). Currently, judging is done by Gemini 3 Flash to compare against published research in top economics journals:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Blind comparison: An LLM judge compares two papers without knowing which is AI-generated
Position swapping: Each pair is judged twice with paper order swapped to control for bias
TrueSkill ratings: Papers accumulate skill ratings that update after each match&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The project&amp;rsquo;s home page lists the AI&amp;rsquo;s current &amp;ldquo;win rate&amp;rdquo; at 3.5% in head-to-head matchups against human-written papers.&lt;/p&gt;
&lt;p&gt;Prof. Yanagizawa-Drott says &amp;ldquo;Currently it requires at a minimum some initial human input for each paper,&amp;rdquo; although he does not specify exactly what. If we look at &lt;a href="https://github.com/SocialCatalystLab/ape-papers/blob/main/apep_0264/v1/initialization.md"&gt;&lt;code&gt;initialization.json&lt;/code&gt;&lt;/a&gt; that can be found in each paper&amp;rsquo;s directory, we see the following questions with user-provided inputs:&lt;/p&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Policy domain: What policy area interests you?&lt;/li&gt;
&lt;li&gt;Method: Which identification method?&lt;/li&gt;
&lt;li&gt;Data era: Modern or historical data?&lt;/li&gt;
&lt;li&gt;API keys: Did you configure data API keys?&lt;/li&gt;
&lt;li&gt;External review: Include external model reviews?&lt;/li&gt;
&lt;li&gt;Risk appetite: Exploration vs exploitation?&lt;/li&gt;
&lt;li&gt;Other preferences: Any other preferences or constraints?&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;p&gt;The code, reviews, manuscript, and even the results of the initial idea generation process are all available on &lt;a href="https://github.com/SocialCatalystLab/ape-papers"&gt;GitHub&lt;/a&gt;. Their immediate goal is to generate a sample of 1,000 papers and run human evaluations on them (at time of posting, there are 264 papers in the GitHub repository).&lt;/p&gt;</description></item></channel></rss>