7 ms·
Ruff v0.1.0
- cornstalks 3y agoFor those who don’t know what Ruff is (like me, 5 minutes ago), here’s what the GitHub project describes it as: > An extremely fast Python linter, written in Rust. Pro-tip to announcement authors: it’s helpful when there’s a one-sentence description of the project at the top of a post/article for newcomers who aren’t familiar with the project.
- zanie 3y agoThanks, I've added this now! We have a similar message on all of our other posts, but it got removed on this one.
- deleted 3y ago[deleted]
- kstrauser 3y agoI love Ruff. It's amazing. It's blindingly fast. I dig it. But. v0.1.0 comes with a breaking change: the old `--output` option is now named `--output-format`, and it was only deprecated 3 weeks ago in version 0.0.291 (https://github.com/astral-sh/ruff/releases/tag/v0.0.291 https://github.com/astral-sh/ruff/releases/tag/v0.0.291). That's bound to break some CI pipelines, and definitely breaks the python-lsp-ruff language server plugin. If you use the latter, I have a PR at https://github.com/python-lsp/python-lsp-ruff/pull/48 https://github.com/python-lsp/python-lsp-ruff/pull/48 that will get you running again for now. To be super clear, the Ruff team doesn't owe it to anyone to make the command line stable. This is a little inconvenient, but that's our problem, not theirs. They've made an amazing free tool we can all use. Still, it's something you'll need to know about and deal with. Edit: “our” as in “us end users”. I’m also just an end user of python-lsp-ruff and not associated with it. I realized on re-reading that it might sound like I’m one of its developers. Nope!
- JulianWasTaken 3y agoWhat's keeping you using `python-lsp-ruff` instead of using ruff's own language server?
- kstrauser 3y agoAs of right now, pylsp has some nice features that ruff doesn’t cover yet, like the jedi, rope, and black stuff. The editor I’m currently using doesn’t easily — at all? — support multiple servers at once. Today, that means it’s easiest for me to use it as a plugin under pylsp.
- drekipus 3y agoRuff ls doesn't have code formatting.
- Hasnep 3y agoIf they're using semver, having a major version number of zero means that any change can be breaking. Additionally, while it's not part of the semver spec, to me having the minor version be zero as well is an even bigger indicator that nothing is stable.
- epage 3y agoSounds like they'll be using the cargo variant of semver where changing the leading digit is a breaking change with a common expectation that fewer leading digits implies "better" for varying metrics of "better" (fewer breaking changes, more production ready, etc).
- heavyset_go 3y agoAgree with this as both someone who depends on projects that introduce breaking changes, and as an author of libraries that follow this convention. Introducing breaking changes can be a hard decision to make, especially knowing that downstream consumers might disagree and their things might break, but the version numbers let you know that it's still unstable and introduced breaking changes.
- 3y ago
- ehsankia 3y ago> We also released an alpha version of our Black-compatible code formatter. Interesting that Ruff has replaced so many linters, and now going for formatter next. One tool to rule them all! Extra interesting that Ruff appears to provide more knobs than Black, which will likely be a big plus for those not happy with how opinionated Black is.
- abenga 3y agoFor teams, I'm not sure the knobs are a good thing. Sounds like it will just be another source of infinite bikeshedding arguments. I am a big fan of "set up Black and forget about it", even if I dislike some things it does (like the space after the colon in one-sided slices).
- wartijn_ 3y agoIt doesn’t look like ruff will get too many options, since its maintainers (or at least one of them) agree with you https://github.com/astral-sh/ruff/discussions/7310#discussioncomment-7066290 https://github.com/astral-sh/ruff/discussions/7310#discussio...
- silverwind 3y agoConfigurability is good. Ruff has thousands of linter options to bikeshed over, a few for the formatter won't hurt much more.
- SOLAR_FIELDS 3y agoFor every bikeshedder there are those of us who just set it to the defaults and disable one or two rules and call it a day. I run mypy in strict mode and vanilla ruff with only the line length rule adjusted and it’s been great and sensible
- abenga 3y agoNo it isn't good (in this case). All the options are pointless aesthetic choices that don't make a difference in correctness or performance, and the time spent tweaking them is far better spent pushing features and fixes.
- erikcw 3y agoI’ve been meaning to find time to get ruff-lap working on Doom Emacs side by side with pyright. Is anyone who’s already managed to get it working willing to share their config?
- mdellavo 3y agoOne suggestion to the authors - every serious codebase I've ever worked on had their own set of linters and plugins for whatever linter they were using. How do I extend Ruff? Can I extend Ruff? How do I write plugins and linters? It's Rust in Python and I am generally leery of such things. The fact that it's one tool to do all these things makes believe it's because the tool is inflexible so it must be able to do all these things.
- heavyset_go 3y agoHere's an issue on extending Ruff: https://github.com/astral-sh/ruff/issues/283 https://github.com/astral-sh/ruff/issues/283 I think the philosophy right now is to treat it like Black, but I'm not going to speak for the authors or maintainers, it's just my opinion.
- zeroCalories 3y agoLooks very cool, but I don't feel like I've had many problems with tool speed. Is this actually better than all of those listed tools in terms of features? I feel like I might just end up using all of them.
- jxi 3y agoBlack takes a good 3-5 seconds each time to format for me. Very noticeable.
- kstrauser 3y agoSame. The difference between ruff and, say, pylint, is night and day. The tools it replaces are amazing in their own right. However, having ruff and a language server point out problems the moment I type them is wonderful.
- aobdev 3y agoJust curious, how are you using black? I would expect it to take 3-5 seconds for 10k LoC, but how frequently do you need to format that much code to notice 3-5 seconds at all?
- stavros 3y agoYeah, with pre-commit, it basically only takes <startup cost> seconds for me.
- twunde 3y agoRuff isn't quite at feature priority with the tools it's replacing (although it's close). The main benefits to using ruff is that it's great enough to run regularly locally without being noticable, even on large codebases and it provides tool chain consolidation (although the latter can be achieved with other tools like pants). The speed difference is more noticable in monorepos. If you instead have many smaller repos it probably makes sense to just implement the original tools
- acdha 3y ago
- nmca 3y agoI'll be ecstatic when the inevitable rust-backed python typechecker arrives, python type checking has been excruciatingly slow in the various places I've used it. Ruff is a great start though!
- cricalix 3y agoHave you seen Pyre[0]? Not Rust, OCaml, and pretty fast. Made by a team at Meta and open sourced on GitHub. If you use python-lsp, I wrote an extension[1] to enable integration (though I haven't tested it recently, been programming in rust; it is mostly a "for me" extension). 0: https://pyre-check.org/ https://pyre-check.org/ 1: https://github.com/cricalix/python-lsp-pyre https://github.com/cricalix/python-lsp-pyre
- mdaniel 3y agoThat looks cool, thanks for posting it. I notice that you have a contributing section <https://github.com/cricalix/python-lsp-pyre#contributing https://github.com/cricalix/python-lsp-pyre#contributing> but no obvious licensing information (I checked some files, too, in case the license was in the file headers)
- cricalix 3y agoOh, right, I'll fix that - thanks for pointing it out.
- hkmaxpro 3y agoI’ve just found out pylyzer https://github.com/mtshiba/pylyzer https://github.com/mtshiba/pylyzer Not sure how good it is.
- diarrhea 3y agoMypy in daemon mode has been good enough for me. But yeah, a reimplementation in a fast language would be great.
- samdg 3y agoI was an early adopter of Ruff, what sold me wasn't even the performance win, but the advantage of having a single configuration file without third-party plugins, making it much easier to run the linter in my editor, CLI, pre-commit hooks, and CI without any fuss. The speed of the tool and its development pace astound me. If the authors/maintainers are lurking here: know that you're doing an amazing job.
- LarsDu88 3y agoRuff is amazing. Makes me want to rewrite a commonly used python package in Rust!
- qup 3y agoFind one that takes advantage of the speedup. A great many probably wouldn't.
- feydaykyn 3y agoDoes anyone knows about the business model of the company making Ruff, Astral?
- SOLAR_FIELDS 3y agoThis is also my question. I think ruff is a great tool. I love it and use it on all my new projects. It is an insanely fast and enjoyable tool in a Python world where tools are frequently very slow and a pain to use. But how are you going to make money as a linting tool? I will say that seeing from afar Charlie has been hiring some very smart people. Not sure how it will turn out but hopefully something good will come of it.
- throwawake 3y agoThis seems to be their business model. > In the future, we’ll build and sell services on top of our tools — but the tools themselves will remain free and open-source. > Our plan is to provide paid services that are better and easier to use than the alternatives by integrating our open-source offerings directly. Our goal is for these services to be as impactful as Ruff itself — but you may choose not to use them. Either way, Ruff will remain free and open-source, just as it is today. It's there in their announcement post. https://astral.sh/blog/announcing-astral-the-company-behind-ruff https://astral.sh/blog/announcing-astral-the-company-behind-...
- SushiHippie 3y ago> Our plan is to provide paid services that are better and easier to use than the alternatives by integrating our open-source offerings directly. What are the paid alternative services they are talking about?
- ShadowBanThis01 3y agoIs what?
- frou_dh 3y agoI'm impressed by Ruff. I heard about it a while ago and just assumed I wouldn't be able to use it because it's not just flake8 I like, but a bunch of third-party flake8-* plugin packages too. Turns out Ruff went and reimplemented the majority of those I use, from scratch. https://docs.astral.sh/ruff/faq/#how-does-ruff-compare-to-flake8 https://docs.astral.sh/ruff/faq/#how-does-ruff-compare-to-fl...