Humming Along Analyzing RubyGems Stats for 2017

analyzing-rubygems-stats-v2017-0

2017 was a stable year for the Ruby ecosystem. There weren’t any new libraries that exploded in popularity, but work on existing gems hummed along.

Humming along - Analyzing RubyGems stats for 2017

As for the language itself, we got Ruby 2.5 which continued with performance optimizations and incremental changes which make our lives easier. These changes are in line with Ruby 3×3 goals which were announced back in 2016, and there are future enhancements in the works like a JIT compiler, but that will be a topic for some other year.

Sources

We collected gem downloads data (thanks Vedran for the help) from BestGems which comes with a nice API, and PG-dump of rubygems.org.

These are pretty much the staples when making an overview of the Ruby ecosystem. The numbers are presented as is, we have to take into account that gem mirroring services and similar make a number of downloads, but general trends should still hold. Keep in mind that we can’t conclude the actual gem usage from this data – many gems are used as dependencies in another gem and so may not be used directly.

Gem creation falls again

gem creation in 2017

Number of newly created gems in 2017 dropped to the levels last seen in 2011. This can be reasonably expected as the ecosystem matures and there are already gems for many things, but it also signals that there are less people creating gems for learning purposes and experimentation.

Number of gem releases falls too

gem releases in 2017

In 2017, the number of gem versions released has also dropped, however the drop was much less in percentage points when compared to gem creation (around 10% vs 20%) – this would indicate that existing libraries are still being maintained frequently.

Rails downloads continue their trek upwards

rails downloads graph

Rails downloads increased in 2017 in comparison to 2016, although in the second part of the year the increase stopped – probably after 5.1 was released. Judging by this graph though, the clickbait headlines about death of Rails seem to be premature.

Other web frameworks in 2017

sinatra downloads in 2017

The most popular Ruby web microframework Sinatra got a new maintainer in 2017 and a 2.0 release, so it’s not a surprise that it exhibited healthy growth. Downloads per month were up almost 40% when compared with 2016. Development is still active and ongoing, so kudos to the new maintainers!

hanami roda downloads in 2017

Hanami downloads were up slightly in 2017 while Roda had good growth rates and is the more popular of the two. Their download numbers are still incomparable to the likes of Rails and Sinatra. However these are signs that some parts of the Ruby community are considering Rails alternatives more seriously – we should consider this a good sign for the ecosystem which can at times be seen as too Rails-centric.

Database adapters

database adapters in 2017

PG continued to be the most popular database adapter, as it has increased its lead over MySQL. Mongo is still 50% less popular than MySQL, although there was a spike in December 2017 – looking at the data for 2018 it was a one off.

Application servers

application servers in 2017

It’s not a surprise that Puma became the most popular application server in 2017, as it’s included as the default development server with Rails 5. Thin is still holding on steadily while Unicorn and Passenger dropped a bit in popularity, but keep in mind that Passenger is available as a standalone Unix package. The good news is that all of the main application servers continued development in 2017 with Unicorn and Thin being the laggards in the number of releases.

Other ORMs

sequel in 2017

When it comes to other ORMs – Sequel ended the year where it started in number of downloads. I would also mention rom-rb – which is not strictly an ORM, but serves the same function. It had decent growth in 2017 (4k to 6k monthly downloads) which can’t be compared to Sequel. The interesting thing about rom-rb is that it can be used not only with SQL databases, but with pretty much any data storage e.g. ElasticSearch, Mongo, CSV, JSON etc.

Testing

rspec in 2017

Number of downloads for Rspec has more than doubled on a monthly basis in 2017 and it’s now triple the number of Rails downloads. This growth is a bit puzzling – while Rspec is included as a development dependency for a lot of popular gems, it’s not used as a runtime dependency that often.

I’ll take the optimistic route and conclude that this indicates that people are writing tests for their applications more often.

Background workers

background workers in 2017

In the world of background workers – Sidekiq is the clear winner. With its healthy 35% growth in monthly downloads since the beginning of the year and a major version release that has certainly helped this efficient and easy to use library. Resque and delayed_job went through the year being neck and neck in popularity, with delayed_job coming out on top.

Authorization

authorization in 2017

In the Authorization category CanCanCan is still in the lead and growing. It got a 2.0 release in 2017 – but Pundit is holding well even though the latest version was released in January of 2016.

Personally, I prefer the Pundit OOP approach as opposed to the DSL of CanCanCan, but it’s also not too big of a step to roll your own authorization.

Administration

administration in 2017

Administration gems can save a lot of time with typical CRUD operations, but can also be a bit of a pain when you need custom functionality. That being said, administration frameworks continued their growth in 2017 with Active Admin coming out on top while nearly doubling in monthly downloads. Rails Admin is not far away in popularity, while Administrate is still quite behind but growing. It’s interesting to mention it’s the only one that has yet to reach the 1.0 version.

File uploaders

When it comes to file uploaders – Carrierwave is still no. 1 in downloads, but Paperclip has caught up. In this category I would also mention Shrine which is my personal preference due to its modularity and the way it incorporated lessons learned from other file uploaders. The number of monthly downloads has tripled in 2017, from around 5,000 to 15,000, but the numbers are still far away from the two most popular file uploading gems. Carrierwave and Paperclip are runtime dependencies in a lot of gems, including various CMSes which helps their popularity.

This space will be interesting to watch in 2018, because Rails 5.2 will be coming with its own file upload solution – Active Storage. Will Rails users stick to their preferred libraries, or will they use the out-of-the-box solution?

rails aggregated downloads in 2017
  • The number of Rails downloads increased to over 34 million
  • 44 gems were released per day
  • 332 gem versions were released per day

Conclusion

2017 was a good year for Ruby. As we are all aware, Rails which is the backbone of Ruby popularity in the west is not the cool new shiny thing anymore, but download numbers are still going up.

Rails is still a really good tool for rapidly prototyping a project, and with time the community has learned how to scale these projects. For those who are tired of or disagree with the Rails way there are other options like dry-rb and Trailblazer, and obviously, there’s always an option to create your own architecture.

Naturally, there are scenarios where Ruby is not the best fit. Especially when it comes to concurrency and CPU/memory intensive operations.

Another thing to note is that I wrote this article from a western, web-centric perspective but that doesn’t mean Ruby is only used in the web domain.

In Japan, where most of the core Ruby contributors come from, Ruby is used in a more versatile fashion like embedded systems via the mruby implementation. It’s enough to see the list of talks from RubyKaigi 2017 to notice there are much less web-centric talks than at most of the conferences in the western world. There are also a growing number of ML and Data Science libraries although it can’t be compared to the likes of Python.

To sum up – Ruby as a whole is continuing its maturation process, you might even say it’s become a bit boring – but I consider that a good thing as there is much less churn in the tools used. Best of all, we have better performance to look forward to in the future – and it will only improve the platform we all know very well by now.