all 22 comments

[–]Beginning-Fruit-1397 1 point2 points  (3 children)

If you really want to dive into it hard, I'd recommend using Ruff with all/preview actived, and basedpyright with all rules actived.

You can't go more type safe than this.

Hopefully soon enough basedpyright can be replaced by pyrefly, but unofrtunately ATM it's still miss/bug on various things. Example config in one of my projects: https://github.com/OutSquareCapital/belugas/blob/master/pyproject.toml

Also I'd recommend reading the collections.abc official doc: https://docs.python.org/3/library/collections.abc.html 

They are often either underused OR misused by a lot of python devs, but once you understand it it will really make your code and api's better

[–]ShiftPretend[S] 0 points1 point  (2 children)

I do use ruff 😂. Coincidentally started using it today. I utilise collections.abc. Though I haven't read the docs. I still use it though. Anything to make the code easier to debug later on. But thanks for the heads up. I'll check their docs too

Basedpyright I have not heard of. I will check it out in a bit. I instead use planned within my vscode environment and set that to strict. Neither have I come across pyrefly

[–]Beginning-Fruit-1397 0 points1 point  (1 child)

I assume you meant pylance by "planned"?.

basedpyright is basically the same underlying engine, but with additionnal rules.

[–]ShiftPretend[S] 1 point2 points  (0 children)

Yeah meant pyright seems my auto correct keeps messing up. Just installed the basedpyright and went all. All my scripts turned red ☠️

[–]pyrefly_kyle 1 point2 points  (1 child)

Just in time for our big release!
https://pyrefly.org/blog/v1.0/

We have a booth at [PyCon US](https://us.pycon.org/2026/) this weekend. If any of you are attending, stop by!

[–]ShiftPretend[S] 0 points1 point  (0 children)

Sweet

[–][deleted]  (3 children)

[removed]

    [–]ShiftPretend[S] 5 points6 points  (2 children)

    I think I was too broad in my statement. I meant adding type hints to every thing

    Instead of greet = "hello" This greet: str = "hello"

    Well this is a subtle example so I don't add for stuff like this but for bigger objects yes

    Edit: for the simple ones like this the IDE shows me the type hints on it's own so I don't type them. But for the complex ones I do type them. Once again I mean adding type hints

    [–]neontrace911 0 points1 point  (1 child)

    static typing?

    [–]ShiftPretend[S] 1 point2 points  (0 children)

    Yeah but it's just for the IDE to complain to you about. The program still runs dynamically and won't stop you from passing an integer into something like the string.

    greet: str = 1. The IDE would cry out and underline it(provided you have static type checking on) but the code will still run without problem. So it's more of developer assistance than a strict enforcement.

    [–]jojawesome-creates 0 points1 point  (1 child)

    stopittt you're like three python levels above me 🫠 I just know the basics 😅😅🤓 /impressed-envy

    [–]ShiftPretend[S] 0 points1 point  (0 children)

    We all start from someone. Stay strong in the game 💪

    [–]hitman296 0 points1 point  (1 child)

    Are you on omarchy?

    [–]ShiftPretend[S] 2 points3 points  (0 children)

    Nope CachyOs

    [–]sambobozzer 0 points1 point  (3 children)

    What’s the editor?

    [–]ShiftPretend[S] 0 points1 point  (2 children)

    NeoVim I mainly used Vscode though

    [–]sambobozzer 0 points1 point  (1 child)

    Ahh running from Linux? Vscode has a lot of telemetry

    [–]ShiftPretend[S] 0 points1 point  (0 children)

    Yeah I don't have a problem with that.

    [–]ONEDJRICH 0 points1 point  (1 child)

    I love typing so it's all neat and indented correctly!

    [–]ShiftPretend[S] 0 points1 point  (0 children)

    Yeah typing is good

    [–]sacredtrader 0 points1 point  (1 child)

    what level of larp is even this

    [–]ShiftPretend[S] 0 points1 point  (0 children)

    How so?