• namingthingsiseasy@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    1 month ago

    What is so bad about virtual environments? I found them to be really nice and useful when I developed in Python over about 5-ish years. It was really nice being able to have separate clean environments for installing libraries and executing things.

    Granted, I only used Python as a solo developer, so if there are shortcomings that emerge when working with other developers, then I would not be aware of them…

    Edit: also, performance is a bit more of a subtle topic. For numerical logic, Python actually is (probably) much better than a lot of its competitors thanks to numpy and numexpr. For conditional logic, I would agree that it’s not the best, but when you consider developer velocity, it’s a clearly worthwhile tradeoff since frameworks like Django are so popular.

    • vithigar@lemmy.ca
      link
      fedilink
      arrow-up
      5
      ·
      1 month ago

      What is so bad about virtual environments?

      They’re a solution to a self-inflicted problem. They’re only “really nice and useful” if you accept that having your projects stomp all over each others’ libraries and environments is normal.

      If projects were self-contained from the outset then you wouldn’t need an additional tool to make them so.

      • Eager Eagle@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 month ago

        thankfully Python seems to be moving away from the “activating your venv” nonsense. If you use poetry or uv, you don’t necessarily need to “activate” it before running your code; though a lot of people still try to do it because of learning inertia I guess.

    • Gamma@beehaw.org
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 month ago

      If I need to keep my Python environment separate I’d rather spin up a docker container. They make virtual environments pointless

      • rothaine@beehaw.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 month ago

        But then you need to connect your IDE to the docker container. Doable, but often a PITA IME

        • Gamma@beehaw.org
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          1 month ago

          A single extension and 1-2 clicks isn’t that much to me 🤷 I’ve been doing it painfree for a few years now

          • rothaine@beehaw.org
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 month ago

            Maybe it’s gotten better in recent times…it was always disconnecting and needing to be restarted