Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking-Change-Request: Forbid publishing of packages with git or third party hosted dependencies #36765

Closed
jonasfj opened this issue Apr 26, 2019 · 18 comments
Assignees
Labels
area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). breaking-change-request This tracks requests for feedback on breaking changes

Comments

@jonasfj
Copy link
Member

jonasfj commented Apr 26, 2019

It is currently possible to publish packages to pub.dartlang.org which have
dependencies that are fetched from git or a third party hosted pub repository.

Rationale: This is undesirable as the contents of these dependencies can change, moreover, they might be unavailable at some point in the future. This could happen as a
result of someone deleting or changing their github repo- or username.

Impact: As of April 8th there was around 52 packages whose latest version
had a dependency on a git repository or third-party package repository. About
half of these were last published more than a year ago (before Dart 2.0).

Currently, published packages will remain, we merely forbid publishing of
new packages with git or third party pub repository dependencies. We may
remove these at a later date.

Mitigation: Git dependencies have largely been used to fork an existing
package, and then depend on the git repository until upstream merges the patch.
Going forward we recommend that forked packages be published under a new name
(for example, <github username>_<packageName>).

@jonasfj jonasfj added the breaking-change-request This tracks requests for feedback on breaking changes label Apr 26, 2019
@devoncarew devoncarew added the area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). label Apr 26, 2019
@travissanderson-wf
Copy link

Could this be opt-in (or at least opt-out) for packages published to a private pub repository? If it was opt-in it would be non-breaking for that use case while still giving the gentle suggestion that git dependencies aren't the greatest idea

@jonasfj
Copy link
Member Author

jonasfj commented Apr 29, 2019

@travissanderson-wf, I think we will enforce this server-side on pub.dartlang.org, that way it will not affect third-party pub repositories.

@travissanderson-wf
Copy link

Oh I see, I thought it was getting baked into the pub CLI since the issue was on the SDK. Thanks!

@jonasfj
Copy link
Member Author

jonasfj commented Apr 29, 2019

It might be worthwhile to make the pub CLI command print a warning if publishing with a git dependency (since third party pub repositories might benefit from that). But I see no reason to enforce it on the client, we have to enforce it server-side regardless, and only enforcing server-side gives us more flexibility.

@travissanderson-wf
Copy link

As long as the client forwards the failure reason received from the server, that is true

@aadilmaan
Copy link
Contributor

Request: @Hixie @matanlurey @dgrove for approval.

@aadilmaan aadilmaan changed the title Forbid publishing of packages with git or third party hosted dependencies Breaking-Change-Request: Forbid publishing of packages with git or third party hosted dependencies Apr 29, 2019
@Hixie
Copy link
Contributor

Hixie commented Apr 29, 2019

seems reasonable

@dgrove
Copy link
Contributor

dgrove commented Apr 29, 2019

LGTM

@jaumard
Copy link

jaumard commented Apr 30, 2019

I using git hosted dependency for the use case @jonasfj describe which is I made a PR on flutter camera plugin and need that for my package to work. So I'm using my fork directly as dependency.

Going forward we recommend that forked packages be published under a new name
(for example, _).

So pub will become trash with mostly _ not maintained anymore because only use until that PR was merged :/ and as we can't delete once it's published it will become a nightmare after some time quick imho

@jonasfj
Copy link
Member Author

jonasfj commented Apr 30, 2019

@jaumard, yes, this is the downside, but usage of git dependencies in pub packages is not common, so it's unlikely to create a lot of unmaintained packages.

Alternatively, you could also wait until the patch has landed upstream. Or vendor the patched dependency in lib/src/.../. But publishing as something like <github username>_<packageName> will at-least make it clear that the package is forked. And you can request a package to be flagged discontinued by filling an issue (at some point we'll probably have a self-serve solution for this too).

@pschiffmann
Copy link

I recently started to use a git hosted package to keep my preferred lint rules in sync across packages: https://github.com/pschiffmann/pedantic-pschiffmann.dart

In my packages, I add this to my pubspec.yaml:

dev_dependencies:
  pedantic_pschiffmann:
    git:
      url: https://github.com/pschiffmann/pedantic-pschiffmann.dart
      ref: 97fab6223f4e367ccfade79f998bfc137e2e6131

... and this to my analysis_options.yaml: include: package:pedantic_pschiffmann/analysis_options.yaml

This is not a package I'd publish on pub, because my lint rules are personal preference and not very useful to someone else; but after I change my mind and add or remove a rule, I want to do so in all my projects.

Of course, I can just comment out that dependency before publishing to pub, I don't have strong feelings about this. I just thought I'd share my setup. And if you believe it's a legitimate use case for git dependencies, maybe you could continue to allow them in dev_dependencies?

@jonasfj
Copy link
Member Author

jonasfj commented Apr 30, 2019

You can find many people who publish their personal linter preferences on npm :)

I am inclined to not care about what goes into dev_dependencies as this is ignored when using the package.

@aadilmaan
Copy link
Contributor

@matanlurey any objections to this, if applicable.

@aadilmaan
Copy link
Contributor

No concerns from Matan. Jonas - I am assigning this back to you for landing.

@jonasfj
Copy link
Member Author

jonasfj commented Jul 9, 2019

Changes for this have landed server-side and has been deployed to pub.dev.

It's no longer possible to publish new packages with git dependencies.

@jonasfj jonasfj closed this as completed Jul 9, 2019
dart-bot pushed a commit that referenced this issue Jul 9, 2019
 * This change is being enforced server-side on pub.dev.
 * This CHANGELOG entry is added for compliance with
   `docs/process/breaking-changes.md`.

Change-Id: I9e10c4f224e084db6b6c78d637bb01a2a59565b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108409
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Auto-Submit: Jonas Jensen <jonasfj@google.com>
jonasfj added a commit to jonasfj/site-www that referenced this issue Jul 15, 2019
This was announced through breaking change process in:
dart-lang/sdk#36765

It serves to ensure that dependencies of a package cannot
become unavailable in the future. Thus, if you can `pub get`
something once, then you can `pub get` the exact same thing
if you retain the `pubspec.lock`.

Existing packages with git dependencies remain on `pub.dev`,
but new packages containing git dependencies will not be
permitted.
jonasfj added a commit to jonasfj/site-www that referenced this issue Jul 16, 2019
This was announced through breaking change process in:
dart-lang/sdk#36765

It serves to ensure that dependencies of a package cannot
become unavailable in the future. Thus, if you can `pub get`
something once, then you can `pub get` the exact same thing
if you retain the `pubspec.lock`.

Existing packages with git dependencies remain on `pub.dev`,
but new packages containing git dependencies will not be
permitted.
kwalrath pushed a commit to dart-lang/site-www that referenced this issue Jul 16, 2019
This was announced through breaking change process in:
dart-lang/sdk#36765

It serves to ensure that dependencies of a package cannot
become unavailable in the future. Thus, if you can `pub get`
something once, then you can `pub get` the exact same thing
if you retain the `pubspec.lock`.

Existing packages with git dependencies remain on `pub.dev`,
but new packages containing git dependencies will not be
permitted.
@Stargator
Copy link
Contributor

Stargator commented Jul 30, 2019

@jonasfj I just saw this is in the pipeline. I have a question related to internal/private instances of pub.dev for corporate/government use.

I don't have a project that depends on this, but I patched a project, web-server, to point to a fork I made of dart2_constant that @nex3 used to maintain. It now sits in dart-archive.

I would love if my changes could make it in there. But I doubt it. Anyway...

My company is still using Angular 4, thus Dart 1.0. The client is government and has a lot of resistance to upgrading new technology like Dart they are unfamiliar with.

So my question is, will this setting (allow git dependencies) be configurable if we clone pub.dev and setup our own internal version of it so we can maintain packages even if they depend on git repos?

@jonasfj
Copy link
Member Author

jonasfj commented Jul 30, 2019

@Stargator,
This is enforced on the server, thus, this change does not apply to third-party pub servers.
(Does that answer your question?)

@Stargator
Copy link
Contributor

@jonasfj It does, thank you. I didn't catch that it was on the server end. I'll have to go back and look at the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-sdk Use area-sdk for general purpose SDK issues (packaging, distribution, …). breaking-change-request This tracks requests for feedback on breaking changes
Projects
None yet
Development

No branches or pull requests

9 participants