cross-posted from: https://sh.itjust.works/post/64685863

Lots of programming languages have their own package manager, separate from the distribution or OS package manager.

Going loosely from the TIOBE index:

  • Python has Pip
  • C# has NuGet
  • Javascript has npm for Node.js
  • Visual Basic also uses NuGet
  • R has a repository of packages that can be installed by running install.packages("something") in R
  • Rust has Cargo/Crates
  • Go has the go get command
  • Swift has its own package manager swift package
  • Ruby has RubyGems
  • Java has Maven and Gradle (not sure if they are full package managers, or build automation tools with dependency resolution)
  • PHP has Composer for managing libraries and dependencies
  • C and C++ are the only exceptions I can think of, off the top of my head; libraries are managed by, and coupled to, the operating system
  • dohpaz42@lemmy.world
    link
    fedilink
    English
    arrow-up
    6
    ·
    3 hours ago

    Throwing in my two cents:

    I would imagine package managers are because of C and C++ not having package managers. I remember 20+ years ago before package managers were a thing, before the Debians, Ubuntus, and Arch (btw)s (before autoconf and configure), when we would download software and have to compile it ourselves, and the lack of reliable means of knowing what dependencies were needed to compile said software. Repeat this ad nauseam for each dependency that itself had dependencies.

    It was Hell.

    ~I for one am grateful for my dependency-resolving overlords. 🙇‍♂️~

  • bluGill@fedia.io
    link
    fedilink
    arrow-up
    3
    ·
    3 hours ago

    For the simple cases, a language package manager is easier to write and makes things easy. However, simple cases aren’t at everything and for the more complex cases, such as what C and C++ is commonly used for, a language package manager is not complex enough to handle all the little weird special cases and so it would be a bad idea.

    Those who use a language for something complex will not use the built-in package manager. Realistically though, very few people are writing complex software and so this objection, although real, is probably a pedantic thing that doesn’t affect you.

  • staircase@programming.dev
    link
    fedilink
    arrow-up
    25
    ·
    edit-2
    6 hours ago

    If you’ve ever tried using bazel, you might understand why writing a single package manager for multiple languages is a bad idea (at least, that’s why I assume bazel is so god-awful)

  • terabyterex@lemmy.world
    link
    fedilink
    arrow-up
    21
    ·
    edit-2
    6 hours ago

    i dont understand why you are confused. are you suggesting they should be in the OS? so each library has to be managed at least 6 times and then the ides and language tools have to support all these different stores? i bet ci/cd would just be awesome

    or are you suggesting that all language maintainers work together in harmony and support one another?

    C and C++ dont have package managers because they are older than the concept.

  • thingsiplay@lemmy.ml
    link
    fedilink
    arrow-up
    16
    ·
    6 hours ago

    Because you don’t want a single operating system manage the entirety of the Rust eco system. They need to be its own thing, so it can be used and managed by an individual team independent from any operating system.

  • Feyd@programming.dev
    link
    fedilink
    arrow-up
    13
    ·
    edit-2
    6 hours ago

    CPAN for perl was the first one and it was very successful so got copied.

    separate from the distribution or OS package manager.

    Because it is way easier to manage them this way rather than have every distro package repo also support them. Additionally, windows and Mac are also targets and they don’t have built in package managers.

    C and C++ are the only exceptions

    It is not as popular but https://conan.io/ exists. Personally, I miss working in c++ because the lack of a built in package manager made people manage dependencies more thoughtfully. It was not without tradeoffs but I preferred that world to adding a dependency being one command away.

  • arran 🇦🇺@aussie.zone
    link
    fedilink
    arrow-up
    3
    ·
    4 hours ago

    The OS package manager is basically the C/C++ package manager. :P They all have OS level aspirations. Don’t let them.

  • hallettj@leminal.space
    link
    fedilink
    English
    arrow-up
    2
    ·
    4 hours ago

    I agree that this doesn’t seem necessary. Personally I think Nix would be a good candidate for dependency management that works consistently between languages. I think that may be partway set up for Haskell, and I’ve noticed that nixpkgs has a good collection of Python dependencies. But for most cases the Nix flow currently usually involves using the language’s bespoke dependency manifest to generate a Nix expression that downloads dependencies from the language’s bespoke package repo.

    One advantage of Nix is that you don’t need all packages in one repo. Nixpkgs is mostly geared for the NixOS Linux distro. Each language ecosystem could have its own repo if that makes the most sense, with Nix being the common connective language.

  • CameronDev@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    5 hours ago

    Do any serious portable project with C and you’ll see why. You’ll either need to vendor in all the code you want to link against, or you’ll constantly have compilation issues when the OS provided library differs (or doesn’t exist at all) from the one you have on your dev box.

  • spj@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    ·
    5 hours ago

    Reminder that TIOBE is ass and shouldn’t be used for basically anything except for who to target advertising to.

  • rumschlumpel@feddit.org
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    6 hours ago

    A language’s packages need to be in lockstep with the language’s version, and they usually depend on each other, too (to a much higher degree than they depend on programs/libraries from other languages, not counting stuff like C that many higher-level languages are built on).