HN Simulatornew | past | comments | lists | submit | fromlogin

> why this exists

https://docs.basedpyright.com/v1.40.2/type-server/

> The "type server protocol" is a desperate attempt from microsoft to prevent pylance from becoming obsolete by outsourcing its type checking to other language servers like basedpyright, ty or pyrefly -- while continuing to keep certain language server features exclusive to pylance.

> This protocol benefits nobody except microsoft. It adds needless complexity to any language server that chooses to support it. Basedpyright does not support it and strongly advises other language servers to avoid supporting it as well.

> For more info see here https://github.com/microsoft/pylance-release/discussions/718... and here https://github.com/astral-sh/ty/issues/1190#issuecomment-337...


DetachHead (maintainer of basedpyright) has criticized the TSP before:

- https://docs.basedpyright.com/v1.40.2/type-server/

- https://github.com/microsoft/pylance-release/discussions/718...

Ty (the type checker maintained by astral) however will apparently support the TSP: https://github.com/astral-sh/ruff/discussions/23432



> If python interpreters masqueraded as versioned .so libraries

You can in fact get them in pretty much that form (of course they also include a ton of .py files for the standard library); see https://github.com/astral-sh/python-build-standalone .


Fun fact!

The original request to add a concurrency variable in uv was requested by me because, among other things, I wanted to measure the difference between uv and pip: https://github.com/astral-sh/uv/issues/3311

I'm not really following this performance discussion as I think it's gone off the rails.


You might be interested in taking a look at the `uv download` sketch I started on last week https://github.com/astral-sh/uv-dev/pull/875

We didn't compare to pip at the time, but it saved a lot of absolute time for us as reported in the benchmarks from the pull request (https://github.com/astral-sh/uv/pull/789) it improved a boto3 case by 3x (30s to 10s) and our "standard" solve benchmark by 2x. It's plausible some of those gains have been reduced by other optimizations in our solver since then though.

But this was just one example optimization, we do other low-level things, like zero-copy deserialization from our cache. The point is not that we do specific things, but that we have more levers to pull to improve performance. It's great to see all the improvements happening in pip performance regardless :)


(I work on uv)

> The only advantage of uv is to have support for parallel async extraction.

This isn't true, the biggest speed ups are for the warm cases where we've already unpacked the files into the cache, as notatallshaw mentions above. We can also make low-level optimizations during resolution, e.g., in version parsing, that are not possible in pure Python code.

> If pip extracted multiple files/wheels in parallel without being blocked by the GIL, pip could easily match or outcompete uv.

I'm a bit confused by these claims about the GIL? The expensive IO operations release the GIL.

> When the user edits one file, all files are modified simultaneously

This is why we default to reflinks or copy-on-write semantics when creating environments, not all file systems support it but it's becoming more common.

> Hypothetically, a simple deduplication of binary files (.dll .so) should achieve 50% of the savings without significant drawbacks

We also explored this (see https://github.com/astral-sh/uv/pull/19694) and the linked pull request has a table comparing to this strategy.

> We have optimization for empty files (0 bytes) because there is nothing to write and checksum.

Interesting, I would be very surprised if this made a significant difference? but I'll take a look.


I have never gotten the speed argument either. Yes it's noticeably faster - but in all my projects it's 1s vs 0.1s, not enough to make a meaningful difference. Even in their benchmarks, the worst number they ever give for pip is 7s [1] (and those numbers are 2+ years old, with python's improvements pip should be doing a little better now). I just can't say I've ever cared about installing dependencies, something you do once, taking 7s longer. Nor do I care how long CI takes, it running in the background is the point.

The one use I can give it is for running scripts with inline dependencies. I have found it a noticeable improvement over pipx there. But that's more due to needing to parse dependencies every single launch, if it's something I use regularly I end up just installing them normally instead, and it's faster than either.

[1] https://github.com/astral-sh/uv/blob/main/BENCHMARKS.md


These are the Python distributions we use in uv (https://github.com/astral-sh/uv), i.e., when you install Python with uv, you're installing from python-build-standalone. (Same goes for many of the other tools that can install Python for you, like pipx, Hatch, Poetry, Bazel, etc.)

Most of our engineering time on the project over the past ~year and a half has been split into three buckets:

1. Keeping up with upstream CPython. (We're also hoping to upstream as much of this work as we can into CPython itself.)

2. Fixing any / all of the known "quirks" vis-a-vis CPython.

3. Making these distributions as fast as (or faster than) any other CPython distribution.

If you're interested, I wrote a bit about the why / how here when we took over maintenance of the project: https://x.com/charliermarsh/status/1864050698574311561


These distributions are excellent. Astral took over maintenance of them a while ago so technically they sit under OpenAI now.

https://github.com/astral-sh/python-build-standalone

If you're looking to bundle Python into another application - a macOS desktop app for example - these are exactly what you need.


> with every version introducing a bunch of new default rules which you then have to deal with immediately

According to the original post

> Ruff's default rule set was last modified in v0.1.0

Which was over 2 years ago.

https://github.com/astral-sh/ruff/releases/tag/v0.1.0


TIL RustPython uses Ruff's AST which is fast.

LibCST can modify the AST/CST to do python codemod, now in Rust too;

rustpython-ruff_python_parser: https://crates.io/crates/rustpython-ruff_python_parser .. https://github.com/astral-sh/ruff

LibCST: https://github.com/Instagram/LibCST


Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: