dart-lang / pub-dev

The pub.dev website
https://pub.dev
BSD 3-Clause "New" or "Revised" License
799 stars 147 forks source link

Experience of using pub in 2024: Top package quality, discoverability issues #7581

Open matanlurey opened 8 months ago

matanlurey commented 8 months ago

I tried to make this actionable, but if filing sub-issues is more useful, or this isn't useful to y'all, feel free to close it.


I'm posting this fairly abstract problem just to mostly share my experiences finding (and using) Flutter plugins - it's plausible the exact same concerns carry over to plain Dart packages but I intentionally am not adding many of these in my projects (Flutter plugins do something non-trivial for me for a platform I don't totally understand, Dart is typically platform agnostic so it's easier for me to just roll my own).

I don't want to pick on a specific author or package, so use anything linked below as an example only.

Some suggestions have already been made in the past by @jayoung-lee:

  1. Mark commercial packages: Incentivize individual and agencies to produce high-quality supported packages (I would have been happy to pay for a better package, but I can't find one). One interesting bit I saw in the React Native ecosystem was additional docs and examples being behind "sponsor" (paid) gates.

  2. Show GitHub metrics for packages, some of the packages I use upon looking at GitHub were more clear they were under-maintained, and I might have made better decisions if pub displayed some metrics for me.

  3. Explain popularity metrics to me. This could be done multiple ways, but anything that could (even relative #s versus absolute) explain "this package was popular in the past, but is being used less and less" or "this package is not very popular overall, but is trending" would help me make a decision.

  4. Something other than thumbs up to indicate qualitative quality. @mit-mit originally filed https://github.com/dart-lang/pub-dev/issues/1517, which certainly helps, but how do I help future package authors avoid (or make better decisions) using a package?

  5. Keep pushing on good native interop. In the case of what I wanted (file picker), I would have happily written the "native" code and used a combination of FFI and JS Interop over using a package/plugin, but I was scared away by the fact I'm not familiar with tools like jni_gen and they aren't seamless the way the dart or flutter CLI is. Maybe I should try them anyway?

  6. Have a stricter bar for judging package quality, i.e. a higher % of public APIs documented, test coverage (?), stricter lints/a stricter style-guide.


The file_picker plugin is a top 20 package across all of pub:

image

However, it upon casual use, is (IMO) much harder to use and less idiomatic than I'd expect for such a package:

  1. The default API allows a single file, but is called pickFiles and returns a List.
  2. Nullability is non-idiomatic. There are 3 nullable fields that aren't explained well at all.
  3. Documentation doesn't exist on many of the public members, sometimes by mistake.

These might seem like nit-picks, but this is probably a package than N% of all Flutter users and companies try when evaluating or developing an app (exporting/importing data to the file system is relatively common, particularly in some app types), but the quality is much lower than you'd expect for something so high in the ranking.

As an example, I looked at "what is the top 20 package in other ecosystems":

I also looked at the React Native Directory to make sure I was making a more fair comparison to a similar ecosystem. The top 20 package is X, which is fairly different than file_picker, but anecdotally appears high[er] quality. I found some of the data of how popularity is determined here pretty interesting (https://reactnative.directory/scoring):

-10 Not recently updated Libraries that have not been updated in the last 180 days meet this criterion. -20 Lots of open issues Libraries with more than 75 open issues meet this criterion. +20 Recommended The maintainers of React Native Directory hand pick select recommended libraries.

Fwiw, I also looked for the top ranking file_picker-like package, which is document-picker. It appears to be higher quality, and is well documented, though interestingly only sponsors (on GitHub) have access to the example app.

matanlurey commented 8 months ago

Also I know sometimes this side of the Dash ecosystem lacks dedicated folks contributing frontend (user-facing) features and website upgrades, so if there is something that would help some of the frictions above and it just lacks resourcing, feel free to reach out privately, this is something I'd contribute to.

benthillerkus commented 8 months ago

Here's some more ideas:

matanlurey commented 8 months ago

Some of those ideas like transitive dependency cost are solid!

sigurdm commented 8 months ago

I tried to make this actionable, but if filing sub-issues is more useful, or this isn't useful to y'all, feel free to close it.

I'm hesitating to close this straight away - it clearly has a lot of thought behind it and contains many useful ideas.

But as an item on the issue tracker it is almost useless to us. I don't think it works well to discuss all of these things in the same thread. A lot of these issues are known and have their own issue already.

Please comment/vote on existing issues, or open new ones if something is not all covered.

jonasfj commented 8 months ago

I'm happy to see that we are working on some of this or have loose ideas about what we might do for other parts.

Some thoughts:


To be clear, I think I agree with most of the problems / issues you highlight. I'm not sure how to address all of them. And some of it certainly harder than it seems.

JaffaKetchup commented 3 months ago

Encourage authors to write comparisons between their own package and similar packages.

How would this be done, in terms of how would maintainers be encouraged, how would this be monitored/detected, and also, would this be qualitative or quantitative? And how can a user be sure the comparison is unbiased?

Make the size of the package and how many transitive dependencies it carries more visible

In terms of transitive dependencies, I think the current listing of them is good enough. Otherwise packages that perform any kind of network and IO already have a disadvantage (http, path, path_provider are basically a given). I don't think an absolute metric would be very beneficial.

Whilst some of those ideas are good and potentially useful, I think some care needs to be taken. Whilst useful for users looking for packages, they could be a pain for maintainers.