-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow package names to start with "_" #20581
Comments
What would it mean if a package is "private"? Is it just a hit to the user that they probably won't want to use it? What is the use-case for private packages? Something shared between two other packages? If so, could it not just be in one of the packages' src directory, and being used by the other library? |
Use case: B might get rapid major version upgrades, but since X, Y and Z use it only internally, they just use a new major version of B and update their patch version. As soon as other packages depend on B, users might run fast into version constraint conflicts, because B is bumping major versions quickly. => Since B was intended to be shared across X, Y and Z, there is no need that B shows up in search results on pub.dartlang.org or in the editor. The only developers who need to know it exists, are the authors of X, Y and Z. |
My understanding is that B won't need to rev its major version as often because it's private. For example, in a normal package, if you add a required parameter to a method, that's a breaking change because some other package could be using that. In a private package, if you know that the actual packages you control that are using the private package won't be broken by that change, you can consider it non-breaking and don't have to rev the major version.
Clarification here. Users do need to know it exists and should be able to step into it in the debugger, go to definition, etc. This code is part of their application after all. It's just that they should be discouraged from directly depending on it because its API doesn't follow the same semver constraints as normal packages. |
First: "if you know that" -- you obviously cannot know who uses a private package. Packages D, E and F could depend on the private package as well -- how would you like to prevent that from happening? Second: We give packages a semantic version number. Following your logic, private packages are not following the semantic version numbering in this case. We would introduce two different version semantics? Seems pretty fragile to me. The thing we would like to prevent is that normal developers/users discover a private package (=> therefore we do not want to have search results in the editor / on pub.dartlang.org for private packages). This will prevent normal developers/users
It is therefore only an implementation detail of X, Y and Z. It will not cause version constraint conflicts if no other packages depend on it (which is the intent, but not enforced).
I don't think this clarification is necessary. It's obvious, that users can see all code -- including SDK internals. This doesn't mean people should know/care about the SDK internals, does it? |
There's no need to prevent this from happening. It's clear that other users aren't supposed to depend on this package, so it's under no obligation to maintain compatibility for them.
It's up to the authors of the package what versioning semantics they use. Since it's a private package, I don't see how it's anyone's problem but theirs if they decide not to use semantic versioning. |
I got the impression that the version numbers in pubspec.yaml were following the semver spec with our definitions of "breaking change". But maybe pub is only concerned about the syntax of these version numbers, the ordering of versions and constraint solving and the semantics are just rough guidelines we give to users. If that is the case, then you are correct. I really didn't want to get into a discussion here. You're the authors of pub, the feature request is on your plate. |
Set owner to @munificent. |
The package validator when you publish will no longer prohibit a package whose name starts with "_". Added Fixed label. |
This issue has been moved to dart-lang/pub#1098. |
As we discussed with Søren and Martin, we think it's useful to allow "private" packages. Those are indicated by starting their name with an underscore. Right now, the package name validator doesn't allow that.
The text was updated successfully, but these errors were encountered: