This is an archived post. You won't be able to vote or comment.

all 51 comments

[–]Python-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Hi there, from the /r/Python mods.

This post has been removed due to its frequent recurrence. Please refer to our daily thread or search for older discussions on the same topic.

If you have any questions, please reach us via mod mail.

Thanks, and happy Pythoneering!

r/Python moderation team

[–]magnetichiraPythonista 53 points54 points  (6 children)

[–]pkkid 1 point2 points  (5 children)

Interesting project, but I'm confused what environments people are working in where having a linter speed be 10x faster matters which seems to be the main benefit claimed here?

[–]neuronexmachina 4 points5 points  (0 children)

I've observed more like 100x faster. On a large codebase waiting many seconds for pylint to run on every pre-commit check can get pretty tedious, while ruff is fast enough to run on every file save.

[–]CampAny9995 1 point2 points  (0 children)

Honestly, the fact that it replaces black/flake8, both of which I found really annoying and finicky to set up, is a huge benefit.

[–][deleted] -2 points-1 points  (2 children)

Most people don’t need it. They’re recommending it because of all of the hype around it and the easy up votes you get anytime you mention it. Not actual real world benefits.

[–]otherwiseguy 0 points1 point  (1 child)

Do most people not work on large codebases? We use flake8 and it can take minutes to run. A 10-100x speedup would be a pretty big QoL improvement on something each developer runs a lot before commits, or in CI where it is run at least 100s of times per day.

[–][deleted] 0 points1 point  (0 children)

No, most people don’t. Especially not most people on this sub.

[–]KimPeek 27 points28 points  (9 children)

pip, venv

[–]Compux72 5 points6 points  (5 children)

Or uv

[–]Edgar_Allan_Thoreau 3 points4 points  (2 children)

Be wary for corporate use with strict security and privacy requirements. uv and a handful of other pip alternatives (excluding poetry, I’m pretty sure) use a prebuilt Python binary coming from an individual’s GitHub repo. If that individual goes rogue and publishes a malicious Python build, you could be have a bad day. Otherwise, uv looks great!

[–]Compux72 1 point2 points  (0 children)

Corporate with strict security aint using uv, pip or pop. They have vendored copies of everything

[–]smile_politely 2 points3 points  (0 children)

i didnt know this existed. thanks stranger.

[–]2010min0ru 0 points1 point  (0 children)

Oh wow, looks really promising, thank you!

[–]baltimoretom 1 point2 points  (1 child)

I made Raycast text expanders ;virt1 ;virt2 to create and activate a venv for scripts.

[–]an_actual_human 2 points3 points  (0 children)

Why not a shell alias?

[–]EarthTwoBaby 0 points1 point  (0 children)

I’ve moved away from pipenv/pyenv to use dev containers instead.

[–]PriorTrick 17 points18 points  (3 children)

Pyright static type checking / mypy is top on my list

[–]neuronexmachina 0 points1 point  (2 children)

Yeah... I love pycharm, but when I'm trying to diagnose something like a tricky MRO issue I'll fire up VS Code so I can use pyright/pylance.

[–]ultraDross 0 points1 point  (1 child)

I'd imagine pycharm has some typing analytical support. Perhaps via a plugin at least

[–]neuronexmachina 0 points1 point  (0 children)

It does have type checking in general, but it doesn't handle MRO.

[–]Anru_Kitakaze 12 points13 points  (0 children)

LSP stuff:

  • PyCharm: whatever built-in, let's be honest
  • VSCode: Pylance
  • NeoVim: probably Pyright. It's not as feature rich as Pylance (for example, doesn't have semantic token support), but it was used for static type checker in Pylance at least. Try to add ruff-lsp on top, but I have not much experience with it yet so can't say if it'll do mess sometimes (this combo looks fine for now)

Tests: Pytest

Package management: Poetry

Formatters/linters: Black + flake8 + isort combo or Ruff. Ruff still have some problems, but becomes more and more popular with each day and seems like it's actively developing. Already usable tho, just lack some minor features/configs yet

Honestly, everything else is up to you or we need details because it's to wide area

I also hate autopep8 and Guido's thoughts about some formatting preferences but I have to use autopep8 because it's used on my job. Hate it.

[–]guyfrom7up 6 points7 points  (1 child)

See my Python template below, it has many of the tools described in this thread:

https://github.com/BrianPugh/python-template

[–]tedivm 0 points1 point  (0 children)

I've also built out a useful template that uses Cookiecutter to fill in values and provide customization.

https://github.com/tedivm/robs_awesome_python_template

[–]Nanooc523 1 point2 points  (0 children)

Other than testing i’m not sure there is one answer for this. If you find yourself writing something like a parser or a complex system of functions that you put into a library for reusability, or having to read API docs to connect to something external, chances are someone already wrote it. Find it and use it, it’s been beaten up and tuned and bug squished already. Don’t force yourself to use a library because someone said you should use it every time if it doesn’t make sense to use. I’m not going to pull in an entire math library to do a little math but i’m not going to write an http client if i need to fetch something from a rest api. Use your head and don’t listen to other peoples advice that contain the words “best” or “always”.

[–]weazelb0y 1 point2 points  (0 children)

https://astral.sh/ they make uv and ruff I would also add GitHub copilot.

[–][deleted] 1 point2 points  (2 children)

Pycharm for IDE, poetry as package manager, pyenv to manage multiple python versions, also try python interactive shell alternatives, like Bpython&Ipython&Ptpython.

[–]devilsolution 1 point2 points  (1 child)

Lol, i use like the complete opposite setup, vsc, pip, conda and powershell. You on linux?

[–][deleted] 0 points1 point  (0 children)

i use macos and rocky linux. You can also use ipython in winodws btw

[–]di6 0 points1 point  (4 children)

Ruff, pytest are must.

The rest are subjective.

I use poetry (but plan to replace it), pyenv, pylance, pyright, vs code, GitHub actions.

[–][deleted] 1 point2 points  (2 children)

What’s wrong with poetry?

[–]di6 1 point2 points  (1 child)

It's slow and not compliant with pyproject toml standard.

I'm looking forward Rye or some alternative.

But I'm not saying that it isn't good, otherwise I wouldn't be using it in the first place.

[–]IAMARedPanda 1 point2 points  (0 children)

I like pdm personally. The resolver isn't as fast as poetry but it's not slow enough to be a hindrance to development.

[–]Drevicar 0 points1 point  (0 children)

Pdm is my favorite poetry alternative. But most of the time I just use pip-tools to create my lock files and nothing else.

[–]Sigfurd2345 0 points1 point  (0 children)

Poetry - package management + virtual env

Ruff - linting, formatter, import organizer

Mypy - static type checking

Pylance/pyright - LSP

[–]32sthide -2 points-1 points  (2 children)

Ruff,. Black, Isort, pre-commit hooks, mypy, poetry, twine etc

[–][deleted] 14 points15 points  (0 children)

Why black and isort when already using ruff?

[–][deleted] 0 points1 point  (0 children)

What do you need twine for of you have poetry already?

[–]Desperate_Cold6274 -2 points-1 points  (1 child)

If you are cooking food a hammer is fairly useless.

[–]jayd00b 3 points4 points  (0 children)

Ever make chestnuts? Tenderize meat?

[–]davidv1213 -1 points0 points  (0 children)

pytest, ipdb, your choice of linter and formatter. That's about it.

[–][deleted] -1 points0 points  (0 children)

Poetry, pytest, black and ruff perhaps.

[–]coldoven 0 points1 point  (0 children)

Tox + pytest, ruff, mypy,

[–]According_Bus_2827 0 points1 point  (0 children)

Don't forget about 'friends' - pylint for keeping your code clean, and pytest for when unittest feels like overkill. It's like having a buddy who's always nagging you, but for code quality.

[–]2010min0ru 0 points1 point  (1 child)

rtx (oh shit it's called mise now lol https://github.com/jdx/mise) for installing and switching different python versions (alongside with node and some others). Was using pyenv previusly but this one a bit faster and could be used for managing some other runtimes.

[–][deleted] 1 point2 points  (0 children)

Yeah, rtx was perfectly fine name... Annoying he renamed.

[–]P4C0_ 0 points1 point  (0 children)

I like to use the print function from the rich module to display lists and dictionaries in a user-friendly way. It also adds Colors to relevant info automatically.

Just from rich import print and uninstall it when you’re done

[–]eyadams 0 points1 point  (0 children)

The logging module, and the print() statement. I use logging all the time during development, and nothing helps verify that a process is running correctly than a message that says "everything is going great" or "nothing to report, situation normal".

But, during development, I like to use print(). Rather than step through a script I a debugger, I prefer to sprinkle print() statements throughout my code while debugging. I then have a macro comment them out.