<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Rust on BlueberryPy</title><description>Recent content in Rust on BlueberryPy</description><link>https://blueberrypy.netlify.app/categories/rust/</link><language>en-us</language><item><title>[PyCon China 2026] It&apos;s Time to Learn (Some) Rust — Starting from a Faster pip install</title><link>https://blueberrypy.netlify.app/post/pycon-china-2026-lightning-talk/</link><guid isPermaLink="true">https://blueberrypy.netlify.app/post/pycon-china-2026-lightning-talk/</guid><description>&lt;h1 id=&quot;its-time-to-learn-some-rust--starting-from-a-faster-pip-install&quot;&gt;It’s Time to Learn (Some) Rust — Starting from a Faster pip install&lt;/h1&gt;
&lt;p&gt;Hi everyone! This post is adapted from my lightning talk at PyCon China 2026, “It’s Time to Learn (Some) Rust — Starting from a Faster pip install”. What the subtitle means — I’ll get to that in a moment.&lt;/p&gt;
&lt;p&gt;Whether you’ve noticed it or not, Rust is already part of your daily life as a Python developer. uv, ruff, and pyrefly — Meta’s open-source type checker — this new generation of Python tooling is all written in Rust. And plenty of Python libraries are bringing Rust in as well: pydantic v2 rewrote its validation core in Rust and got 17x faster; polars’ entire engine is Rust; cryptography uses it to harden its core. So Rust stopped being “the language next door” a long time ago — it’s hiding inside the dependencies of every &lt;code&gt;pip install&lt;/code&gt; you run.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;rust_for_cpython&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;256&quot; height=&quot;256&quot; src=&quot;/_astro/rust_for_cpython.FbDnyHve_ZkJe53.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;Even CPython’s own source code may soon include Rust. Look at the timeline: in November 2025, the pre-PEP discussion thread opened; in March 2026, the forked CPython project’s CI builds went green on all platforms; and at PyCon US 2026 in May, the working group unveiled zlib-py as the first planned pilot module — a drop-in alternative to the existing zlib module, with decompression running 3 to 6 times faster. If it lands, every &lt;code&gt;pip install&lt;/code&gt; you run from then on will decompress faster. That’s where the subtitle comes from.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_04&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1210&quot; height=&quot;905&quot; src=&quot;/_astro/page_04.Drzz-mkR_Po8Ye.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;The bad news: the PEP originally planned for July has slipped. The good news: the reason is nothing external — the design details of the internal Rust API simply deserve to be worked through slowly and carefully. It’s a slip, not a stall. Their target is Python 3.16, in 2027.&lt;/p&gt;
&lt;p&gt;So next, let’s see how simple getting started with Rust can be. It’s like the old joke about putting an elephant into a fridge — three steps in total.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_05&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;2424&quot; height=&quot;956&quot; src=&quot;/_astro/page_05.BtTpUSeY_1BIDnQ.webp&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Step one: install maturin with uv, then run &lt;code&gt;maturin init&lt;/code&gt; — and a Rust project is initialized, ready to be packaged straight into a Python wheel.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt=&quot;page_06&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1280&quot; height=&quot;1146&quot; src=&quot;/_astro/page_06.MevrPFly_RyWNG.webp&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Step two: in &lt;code&gt;lib.rs&lt;/code&gt;, write a function that computes the n-th Fibonacci number. Only two macros in this code really matter: &lt;code&gt;#[pyfunction]&lt;/code&gt; exposes the Rust function to Python, and &lt;code&gt;#[pymodule]&lt;/code&gt; registers it as a Python module. The iterative logic in between is essentially the usual way you’d compute Fibonacci in Python — even with no Rust background, you can follow the gist.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt=&quot;page_07&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;3260&quot; height=&quot;1136&quot; src=&quot;/_astro/page_07.B7AWKxvt_ZenX9R.webp&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Step three: &lt;code&gt;maturin develop&lt;/code&gt;. That single command compiles the Rust package, builds a wheel, and installs it into your current Python virtual environment — building, packaging, and installation all in one go, an experience nearly identical to a pure-Python toolchain. Then it’s back to Python: &lt;code&gt;import fibonacci_rs&lt;/code&gt;, call &lt;code&gt;fibonacci(88)&lt;/code&gt;, and the 88th Fibonacci number comes right out.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One sentence to sum it up: Python handles the orchestration; Rust does the computing.&lt;/p&gt;
&lt;p&gt;Now, some of you may feel that computing Fibonacci numbers is a bit too simple — barely a step above Hello World.&lt;/p&gt;
&lt;p&gt;So let’s look at a somewhat more involved example: the Julia set. In short: take every point in the complex plane, repeatedly apply z = z² + c (with c a fixed complex number), and see which points never fly off to infinity (modulus above a threshold).&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_08&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1000&quot; height=&quot;1000&quot; src=&quot;/_astro/page_08.Cpb8lXAk_Z28sMFd.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;In my concrete example, the canvas is 1000×1000 — one million points in total, each iterated at most 300 times. In the figure, the black areas are points that escaped quickly; the brighter the region, the more iterations it took to escape; and the white, snowflake-shaped region in the middle marks points that still hadn’t escaped after 300 iterations. This is a CPU-bound task — precisely the territory where Python is considered relatively weak.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_09&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1280&quot; height=&quot;1148&quot; src=&quot;/_astro/page_09_1.DnnDrnxZ_Zutpgy.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;We start with the pure-Python version: an honest, plain double loop. A run of line_profiler makes the picture stark: this one function devours 96.1% of the program’s total time, while the two list operations above it — each executed a million times — account for just 1.4% and 1.5% respectively.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_09&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1276&quot; height=&quot;502&quot; src=&quot;/_astro/page_09_2.CspV7Zyu_Z1GnLAD.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_10&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1280&quot; height=&quot;1519&quot; src=&quot;/_astro/page_10_1.DC8rYGFU_Z1R7xEu.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;Still using maturin, we write a Rust function, &lt;code&gt;calculate_z_serial&lt;/code&gt;, that mirrors the pure-Python function roughly one-to-one in logic.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_10&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1280&quot; height=&quot;799&quot; src=&quot;/_astro/page_10_2.BwIqRbyN_Z12a4MK.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;Once it’s written, the Python script needs exactly one added import line and one changed function name — that’s it. From the caller’s point of view, the function signature and behavior are completely unchanged.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_11&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1245&quot; height=&quot;477&quot; src=&quot;/_astro/page_11_1.BO-Yf-kE_ZCIyPq.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;Now we run line_profiler again: the function’s share of runtime drops from 96% straight down to 18% — the biggest time sinks are now Python’s for loops and list operations — and the script’s total runtime falls from 3.008 seconds to 0.144 seconds, a speedup of more than 20x. And that’s with a faithful serial port of the original; bring in Rayon for multithreaded parallelism, and the speedup tops 100x.&lt;/p&gt;
&lt;p&gt;If, after these two examples, you’d like to try building something in Rust, it’s worth first understanding the four mindset hurdles that lie between writing Python and writing Rust.&lt;/p&gt;
&lt;p&gt;First, from recommended explicitness to enforced explicitness: Python’s “explicit is better than implicit” is advice; Rust makes it law — mutating data requires declaring &lt;code&gt;mut&lt;/code&gt;, &lt;code&gt;match&lt;/code&gt; must be exhaustive, and if you don’t comply, it refuses to compile.&lt;/p&gt;
&lt;p&gt;Second, from referencing data to owning it: in Python, assignment is sticking a name tag on an object — share it freely, and the GC cleans up. In Rust, every value has exactly one owner, and whether it’s moved or borrowed is checked with total clarity at compile time.&lt;/p&gt;
&lt;p&gt;Third, from EAFP to LBYL — from “easier to ask forgiveness than permission” to “look before you leap”: Rust writes “can this fail?” into the types. With &lt;code&gt;Option&lt;/code&gt; and &lt;code&gt;Result&lt;/code&gt;, you can’t touch the value without checking it first.&lt;/p&gt;
&lt;p&gt;Fourth, from the GIL to real concurrency: data races become compile errors — if your program compiles, it is guaranteed free of data races.&lt;/p&gt;
&lt;p&gt;Here’s a reference roadmap for learning Rust, in four stages.&lt;/p&gt;
&lt;p&gt;Stage one, syntax bridging — with a Python foundation, you’ll get up to speed quickly.&lt;/p&gt;
&lt;p&gt;Stage two is the climb: ownership, borrowing, error handling, traits, closures — possibly the most painful stretch of the entire journey, but push through it and the change is qualitative.&lt;/p&gt;
&lt;p&gt;Stage three, concurrency. &lt;code&gt;std::thread&lt;/code&gt; has you writing real multithreaded code; shared mutable state gets the standard &lt;code&gt;Arc&lt;/code&gt;-plus-&lt;code&gt;Mutex&lt;/code&gt; combo; and whether data may cross thread boundaries is policed by the compiler through &lt;code&gt;Send&lt;/code&gt;/&lt;code&gt;Sync&lt;/code&gt;. Want to keep it easy? Rayon turns a loop into data-parallel execution with one line; for I/O-bound concurrency, there’s tokio, the async runtime.&lt;/p&gt;
&lt;p&gt;Last and most important: hands-on practice. Use maturin to rewrite a hot function from your own project — profile to locate it, test for parity, benchmark to compare — closing the loop.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_14&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1242&quot; height=&quot;860&quot; src=&quot;/_astro/page_14_1.B8a55GVO_Z22bU5d.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_14&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1073&quot; height=&quot;753&quot; src=&quot;/_astro/page_14_2.IRjiGYt9_2n7dEy.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;As we all know, writing code while you learn is one of the most effective ways to surface problems and consolidate knowledge. These are the three tools I found most helpful as a beginner: Rustlings — around ninety bite-sized exercises straight from the official project, a few minutes each, running locally; and Codewars and LeetCode, which both let you solve problems in Rust directly. Re-solving problems you previously did in Python — this time in Rust — makes the differences between the two languages far easier to internalize.&lt;/p&gt;
&lt;p&gt;So does this mean all your Python code should become Rust? Before you start, remember: profiling first — confirm the bottleneck before talking about a rewrite. Don’t go on a hunch.&lt;/p&gt;
&lt;p&gt;Good candidates for a rewrite: CPU-bound modules with clear boundaries that process untrusted input; I/O-bound code and glue code can often stay as they are.&lt;/p&gt;
&lt;p&gt;Before you dive in, also look at the alternatives: a better algorithm, a free-threaded build, an existing third-party library — or Cython, Numba, or GPU acceleration. Any of these may be the better deal.&lt;/p&gt;
&lt;p&gt;Of course, real-world decisions are more complicated — team skills and migration cost come into play, among other factors. And remember this line: Rust is not a “press for speed” button — speed has always been the reward for choosing the right problem.&lt;/p&gt;
&lt;p&gt;If you still feel Rust is too hard to learn, consider it from another angle: even if you never write production-grade Rust, the time is not wasted. Explicit types, ownership, explicit error handling, exhaustive matching — these habits of mind transfer back and make your Python more rigorous.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;page_17&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;720&quot; height=&quot;393&quot; src=&quot;/_astro/page_17.DbwOY4EL_1Ow9D4.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;OK, to wrap up. Rust is not Python’s rival — it’s Python’s partner: Python for orchestration, Rust for speed and safety. And learning Rust is more than an investment in personal skills: judging by the progress of Rust for CPython, it may be your ticket to contributing to CPython. The next Rust for CPython contributor might well be you, reading this article right now.&lt;/p&gt;
&lt;p&gt;Of course, this talk would not exist without the valuable material left behind by pioneers in the community — Microsoft’s Rust for Python Programmers course, plus several excellent talks and articles, all listed below. My thanks to all of them.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Microsoft — &lt;a href=&quot;https://microsoft.github.io/RustTraining/python-book/&quot;&gt;&lt;em&gt;Rust for Python Programmers&lt;/em&gt;&lt;/a&gt; (open course)&lt;/li&gt;
&lt;li&gt;Daroc Alden — &lt;a href=&quot;https://lwn.net/Articles/1046933/&quot;&gt;“Eventual Rust in CPython”&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Bob Belderbos — &lt;a href=&quot;https://belderbos.dev/blog/rust-made-me-a-better-python-developer/&quot;&gt;“Learning Rust Made Me a Better Python Developer”&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Daniel Szoke — &lt;a href=&quot;https://www.youtube.com/watch?v=lkSxUIdP6Ds&quot;&gt;“Why You, a Python Developer, Should Learn Rust”&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Emma Smith — &lt;a href=&quot;https://www.youtube.com/watch?v=42kibVnUHYE&quot;&gt;“Rust for CPython: Making Python Safer and More Robust for Everyone”&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Micha Gorelick &amp;amp; Ian Ozsvald — &lt;a href=&quot;https://www.oreilly.com/library/view/high-performance-python/9781492055013/&quot;&gt;&lt;em&gt;High Performance Python&lt;/em&gt;, 2nd Edition&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That’s the whole talk. The demo code is on &lt;a href=&quot;https://github.com/linzeyang/pycon-china-2026&quot;&gt;GitHub&lt;/a&gt;, and if you’re interested, you’re welcome to find me on any of these platforms to keep the conversation going. Thanks for reading!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href=&quot;https://github.com/linzeyang&quot;&gt;@linzeyang&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Bluesky: &lt;a href=&quot;https://bsky.app/profile/linzeyang.bsky.social&quot;&gt;@linzeyang.bsky.social&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mastodon: &lt;a href=&quot;https://mastodon.online/@zeyanglin&quot;&gt;@zeyanglin@mastodon.online&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description><pubDate>Sat, 05 Sep 2026 07:10:00 GMT</pubDate><category>python</category><category>rust</category><category>python</category><category>rust</category><category>pycon</category><author>Zeyang Lin</author></item><item><title>UV is the latest attempt to rule All Python tools</title><link>https://blueberrypy.netlify.app/post/uv-is-latest-attempt-to-rule-them-all/</link><guid isPermaLink="true">https://blueberrypy.netlify.app/post/uv-is-latest-attempt-to-rule-them-all/</guid><description>&lt;p&gt;In short, &lt;a href=&quot;https://github.com/astral-sh/uv&quot;&gt;&lt;code&gt;uv&lt;/code&gt;&lt;/a&gt; is a command line tool written in &lt;a href=&quot;https://www.rust-lang.org/&quot;&gt;&lt;code&gt;Rust&lt;/code&gt;&lt;/a&gt; for &lt;code&gt;Python&lt;/code&gt; developers, which aims to be &lt;em&gt;“a comprehensive project and package manager that is extremely fast, reliable, and easy to use”&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;If you are still interested, I hope you can spend a couple of minutes so that I can give you a quick tour of it.&lt;/p&gt;
&lt;h2 id=&quot;quick-fact-sheet&quot;&gt;Quick fact sheet&lt;/h2&gt;
&lt;p&gt;language: Rust&lt;/p&gt;
&lt;p&gt;version: 0.1.13 (at the time of updating this post)&lt;/p&gt;
&lt;p&gt;repo: &lt;a href=&quot;https://github.com/astral-sh/uv&quot;&gt;github&lt;/a&gt; (6k stars)&lt;/p&gt;
&lt;p&gt;pypi: &lt;a href=&quot;https://pypi.org/project/uv/&quot;&gt;pypi&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;docs: N/A&lt;/p&gt;
&lt;p&gt;supported python versions: 3.8 through 3.12 (inclusive)&lt;/p&gt;
&lt;p&gt;supported os: Windows, Linux, MacOS&lt;/p&gt;
&lt;h2 id=&quot;drop-in-replacement-for-pip-and-more&quot;&gt;Drop-in replacement for pip and more&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;uv&lt;/code&gt; is from the creator of &lt;a href=&quot;https://github.com/astral-sh/ruff&quot;&gt;&lt;code&gt;ruff&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://github.com/charliermarsh&quot;&gt;Charlie Marsh&lt;/a&gt; and &lt;a href=&quot;https://github.com/astral-sh/&quot;&gt;astralsh&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ruff&lt;/code&gt;, the linting and formating tool written is Rust as well, has already gain fame and popularity during the past year or so, and I believe many of Python developers have been using it for quite a while.&lt;/p&gt;
&lt;p&gt;And &lt;code&gt;uv&lt;/code&gt; is no doubt their next step in improving the Python toolchain eco.&lt;/p&gt;
&lt;p&gt;Although you can easily install &lt;code&gt;uv&lt;/code&gt; using &lt;code&gt;pip&lt;/code&gt; or &lt;code&gt;pipx&lt;/code&gt; just like any other Python tool,
essentially it does not rely on your Python interpreter to be installed.&lt;/p&gt;
&lt;p&gt;It provides just the binary executable and you can get it easily by running the quick script following
the insructions in its git repo. And that’s it, no Python or Rust runtime required till this point.&lt;/p&gt;
&lt;p&gt;Creating a virtual environment is now as easy as &lt;code&gt;uv venv&lt;/code&gt;, though you now need at least one Python interpreter ready to make it work.&lt;/p&gt;
&lt;p&gt;The virtual env it creates is just a standard Python venv, except it does not include &lt;code&gt;pip&lt;/code&gt; by default (however if you need pip, you can let it be included by using an extra flag, or you could install it manually anytime after).&lt;/p&gt;
&lt;p&gt;Some of your daily commands can then be like (but faster):&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;uv&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; pip&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; install&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -r&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; requirements.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;uv&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; pip&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; install&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; black==&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt;24.2.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;uv&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; pip&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; compile&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; pyprojects.toml&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -o&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; requirements.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;fast-in-deed&quot;&gt;Fast in deed&lt;/h2&gt;
&lt;p&gt;&lt;img alt=&quot;speed-comparison-1&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1136&quot; height=&quot;301&quot; src=&quot;/_astro/image-01.ae05VlAD_SG90D.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;speed-comparison-2&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; width=&quot;1163&quot; height=&quot;275&quot; src=&quot;/_astro/image-02.XSkMg7EH_Z2gbQo8.webp&quot;&gt;&lt;/p&gt;
&lt;p&gt;Just like &lt;code&gt;ruff&lt;/code&gt; is known as being an extremely fast linter, &lt;code&gt;uv&lt;/code&gt;’s speed is also impressive.&lt;/p&gt;
&lt;p&gt;Here is a short &lt;code&gt;requirements.txt&lt;/code&gt; from one of my repos:&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;fastapi==0.109.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;pydantic[email]==2.6.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;python-multipart==0.0.9&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;uvicorn[standard]==0.27.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;coverage&amp;gt;=7.4.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;httpx&amp;gt;=0.26.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;memray&amp;gt;=1.11.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;pytest&amp;gt;=8.0.0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And I gave &lt;code&gt;uv&lt;/code&gt; a try using github actions. The result on &lt;code&gt;ubuntu-latest&lt;/code&gt; with Python 3.12 looks like this&lt;/p&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&amp;gt; Run uv pip install -r requirements.dev.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Resolved 40 packages in 185ms&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Downloaded 40 packages in 268ms&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Installed 40 packages in 24ms&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + annotated-types==0.6.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + anyio==4.3.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + certifi==2024.2.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + click==8.1.7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + coverage==7.4.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + dnspython==2.6.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + email-validator==2.1.0.post1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + fastapi==0.109.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + h11==0.14.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + httpcore==1.0.3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + httptools==0.6.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + httpx==0.26.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + idna==3.6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + iniconfig==2.0.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + jinja2==3.1.3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + linkify-it-py==2.0.3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + markdown-it-py==3.0.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + markupsafe==2.1.5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + mdit-py-plugins==0.4.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + mdurl==0.1.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + memray==1.11.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + packaging==23.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + pluggy==1.4.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + pydantic==2.6.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + pydantic-core==2.16.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + pygments==2.17.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + pytest==8.0.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + python-dotenv==1.0.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + python-multipart==0.0.9&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + pyyaml==6.0.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + rich==13.7.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + sniffio==1.3.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + starlette==0.36.3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + textual==0.52.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + typing-extensions==4.9.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + uc-micro-py==1.0.3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + uvicorn==0.27.1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + uvloop==0.19.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + watchfiles==0.21.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt; + websockets==12.0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see, this process, including solving the dependencies, downloading them and installing them, took just &lt;strong&gt;less than half a second&lt;/strong&gt;!&lt;/p&gt;
&lt;h2 id=&quot;features-in-need&quot;&gt;Features in need&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;uv&lt;/code&gt;’s vision, according to the blog, is&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;a single binary that bootstraps your Python installation and gives you everything you need to be productive with Python, bundling not only pip, pip-tools, and virtualenv, but also pipx, tox, poetry, pyenv, ruff, and more.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And appearantly at the current point, it is still quite far away from that.&lt;/p&gt;
&lt;p&gt;The only two major top-level sub-commands the cli currently supports are&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;venv&lt;/li&gt;
&lt;li&gt;pip&lt;/li&gt;
&lt;li&gt;cache&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It thus can only create a virtual environment, install dependencies into it and outputs a “lock” file, etc.&lt;/p&gt;
&lt;p&gt;I want it to list installed packages, or run commands using the interpreter inside the virtual env, just like what &lt;code&gt;poetry&lt;/code&gt; is capable of right now.&lt;/p&gt;
&lt;p&gt;Not to mention that it cannot run tests, switch virtual environments or lint source files.&lt;/p&gt;
&lt;p&gt;But it’s still in its early age, and the pace is like one patch version every couple of days, isn’t it?&lt;/p&gt;
&lt;h2 id=&quot;what-about-rye&quot;&gt;What about Rye&lt;/h2&gt;
&lt;p&gt;The ambitions of &lt;code&gt;uv&lt;/code&gt; share a lot with those from &lt;code&gt;Rye&lt;/code&gt;, a tool (which happens to be written in Rust as well) created by Armin Ronacher, the creator of &lt;code&gt;Flask&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;What’s more, the team behind &lt;code&gt;uv&lt;/code&gt;, &lt;code&gt;astralsh&lt;/code&gt;, is actually taking over the dev work of &lt;code&gt;Rye&lt;/code&gt; according to their &lt;a href=&quot;https://astral.sh/blog/uv&quot;&gt;blog&lt;/a&gt;, and ultimately going to migrate &lt;code&gt;Rye&lt;/code&gt; to &lt;code&gt;uv&lt;/code&gt; in the future.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We saw this as a rare opportunity to team up, and to avoid fragmenting the Python ecosystem. As such, in collaboration with Armin, we’re excited to be taking over Rye. Our goal is to evolve uv into a production-ready “Cargo for Python”, and to provide a smooth migration path from Rye to uv when the time is right.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;some-thoughts&quot;&gt;Some thoughts&lt;/h2&gt;
&lt;p&gt;The name &lt;code&gt;uv&lt;/code&gt; seems not relevant to &lt;a href=&quot;https://github.com/libuv/libuv&quot;&gt;&lt;code&gt;libuv&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://github.com/MagicStack/uvloop&quot;&gt;&lt;code&gt;uvloop&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;https://github.com/encode/uvicorn&quot;&gt;&lt;code&gt;uvicorn&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Maybe it’s short for “universal/ultimate/unified virtualenv manager”?&lt;/p&gt;
&lt;p&gt;The dedicated docs pages of &lt;code&gt;uv&lt;/code&gt; are not present at the time of writing, which is a pitty.&lt;/p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://astral.sh/blog/uv&quot;&gt;uv: Python packaging in Rust&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/astral-sh/uv&quot;&gt;uv on Github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description><pubDate>Wed, 21 Feb 2024 07:23:13 GMT</pubDate><category>rust</category><category>python</category><category>rust</category><category>python</category><category>pip</category><category>cli</category><category>linux</category><category>windows</category><author>Zeyang Lin</author></item><item><title>[one-liner] Install Rust (Rustup)</title><link>https://blueberrypy.netlify.app/post/one-liner-rust/</link><guid isPermaLink="true">https://blueberrypy.netlify.app/post/one-liner-rust/</guid><description>&lt;h2 id=&quot;one-liner-series-rustup&quot;&gt;One-Liner series: Rustup&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://rust-lang.org/learn/get-started/&quot;&gt;source: rust-lang.org&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;install-on-ubuntu&quot;&gt;Install on Ubuntu&lt;/h3&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; --proto&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; &apos;=https&apos;&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; --tlsv1.2&lt;/span&gt;&lt;span style=&quot;color:#79B8FF&quot;&gt; -sSf&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; https://sh.rustup.rs&lt;/span&gt;&lt;span style=&quot;color:#F97583&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color:#B392F0&quot;&gt; sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;update-on-ubuntu&quot;&gt;Update on Ubuntu&lt;/h3&gt;
&lt;pre class=&quot;astro-code github-dark&quot; style=&quot;background-color:#24292e;color:#e1e4e8; overflow-x: auto;&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color:#B392F0&quot;&gt;rustup&lt;/span&gt;&lt;span style=&quot;color:#9ECBFF&quot;&gt; update&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
</description><pubDate>Tue, 16 May 2023 14:24:06 GMT</pubDate><category>rust</category><category>linux</category><category>rust</category><category>linux</category><category>ubuntu</category><author>Zeyang Lin</author></item></channel></rss>