Skip to content

Single-Version Packages. #73

Closed
Closed

Description

@TyOverby

In Piston, we have a pattern where in order to decouple dependencies and achieve maximum independence, we split up a interface and it's implementation(s) into multiple projects.

The interface does not depend on the implementations, but the opposite is true. For example:

  • My App
    • piston
    • some_piston_backend
      • piston

What we would really like is a way to make sure that the two piston repositories in the tree are the exact same version. A user could theoretically pick piston-3.0 and some_piston_backend-1.0 (that depends on piston-1.0).

I'm not sure what resolution strategy Cargo is planning on using for this, but I would like the option as a maintainer of piston to be able to say "THERE CAN ONLY BE ONE" and fail at the cargo package fetching stage. Anything else would either run (and have terrible bugs) or fail at compile time with confusing error messages.

Edit: A more detailed example of what could go wrong: PistonDevelopers/piston#430

Activity

  1. changed the title [-]Single Version Packages.[/-] [+]Single-Version Packages.[/+] on Jun 27, 2014
  2. bvssvni commented on Jun 27, 2014

    @bvssvni

    It would be nice to have a command in Cargo for getting a summary of the dependencies. Perhaps it could generate a graph or something. Maybe we could use the API and create a tool on top of Cargo.

    I think we will manage to plan releases with check lists to get everything correctly. However, dependencies gets very complex over time.

  3. steveklabnik commented on Jun 27, 2014

    @steveklabnik
    Contributor

    Eventually, Cargo will write out the resolved dependencies to a lockfile.

  4. wycats commented on Jul 8, 2014

    @wycats
    Contributor

    This problem is the kind of thing that led npm to peerDependencies. I suspect there are better solutions, and node folk consider peer dependencies a failure. I will continue to think about our available options.

  5. tomjakubowski commented on Jul 8, 2014

    @tomjakubowski
    Contributor

    Maven has a similar notion called 'provided dependencies'. It works pretty nicely.

  6. added
    A-features
    on Jul 27, 2015
  7. added
    A-crate-dependencies
    C-enhancement
    and removed
    A-features
    on May 10, 2017
  8. carols10cents commented on Sep 12, 2017

    @carols10cents
    Member

    This sounds like public dependencies, that is, once that RFC is implemented, some_piston_backend would list piston as a public dependency and cargo would reject resolutions for the crate graph of My App if they have different versions of the direct piston dependency and the some_piston_backend public piston dependency.

    Please reopen if I'm missing something!

  9. added a commit that references this issue on Mar 7, 2019
  10. added a commit that references this issue on Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-crate-dependenciesC-enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions