Skip to content

Should the project's package file support direct dependencies only? #38

Description

@agross

Currently there's the idea to use a project-specific packages file to define the subset of package IDs that paket needs to reference in the respective project. This is to have any number of dependencies in the packages.fsx but only reference the test-specific subset among these for test projects.

Definition direct dependency: A dependency that is declared in packages.fsx
Definition indirect dependency: A dependency of a direct dependency. Indirect dependencies might change with future releases of direct dependencies (adding or removing indirect dependencies).

Both direct and indirect dependencies and their calculated versions will to be downloaded to <packages.fsx location>/packages/ and saved to packages.lock.

My question is whether it's a good idea to restrict the dependencies that are allowed in the project-specific packages file to direct dependencies.

Now on to the discussion, assuming there is no packages.lock (see below why this is a good idea):

Restricting packages to direct dependencies

Pros

  • The user must be very explicit what packages all of the projects need
  • Future package updates of direct dependencies removing indirect dependencies won't cause any harm. Paket will still download them according to packages.fsx, thus making them available.

Cons

  • If the user requires an indirect dependency that is downloaded through virtue of the fact that a direct dependency requires it, the indirect dependency would have to become a direct dependency for it to be allowed in the project-specific packages file. I.e. both the direct and the indirect dependencies need to be put in packages.fsx.

Allowing direct and indirect dependencies

Pros

  • The packages.fsx might become a bit shorter, listing only high-level direct dependencies.

Cons

  • Future updates of direct dependency removing indirect dependencies will cause paket to not download it, thereby break the build. The user would then have to update packages.fsx to make the previously-indirect dependency a direct dependency.

Why not having a lockfile sometimes is a good idea

In Ruby (with bundler) there is the notion that library developers should not check in their Gemfile.lock files (= packages.lock). The reason is that reproducible builds are generally not that much important for libraries and that you rather want to know whether the library still works with the latest dependencies according to the version constrains in the Gemfile (= packages.fsx).

This makes it very easy to just rerun bundle install and your test suite (even in CI) from time to time without the need to change any files.

I think for .NET libraries the same pattern may emerge, with services like https://gemnasium.com/ that check your libraries' dependencies weekly and notify you about (semver) breaking changes in your libraries' dependency set.

For applications, on the other hand, the situation is a bit different. For them you want reproducible builds, regardless of dependency updates (according to `packages.fsx´). This is where the lockfile comes into play. It records the fact that you proved your app works against a specific set of dependencies in specific versions. Using the lockfile enables you to recreate the same runtime environment over and over again.

You can read more about the way Ruby handles this here:
http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
http://bundler.io/v1.3/rationale.html#checking-your-code-into-version-control

I hope I could get my point across. Looking forward to your feedback!

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions