#dump #io #crates-io #download #scripting #time-series #tar


Library for scripting analyses against crates.io's database dumps

34 releases

0.7.2 May 6, 2024
0.6.0 Mar 9, 2024
0.4.10 Oct 18, 2023
0.4.8 Jul 21, 2023
0.1.0 Mar 16, 2021

#139 in Database interfaces

Download history 91/week @ 2024-01-28 125/week @ 2024-02-04 165/week @ 2024-02-11 566/week @ 2024-02-18 189/week @ 2024-02-25 416/week @ 2024-03-03 306/week @ 2024-03-10 145/week @ 2024-03-17 157/week @ 2024-03-24 174/week @ 2024-03-31 122/week @ 2024-04-07 360/week @ 2024-04-14 311/week @ 2024-04-21 208/week @ 2024-04-28 268/week @ 2024-05-05 206/week @ 2024-05-12

1,015 downloads per month
Used in cargo-tally


1.5K SLoC

crates.io database dumps

github crates.io docs.rs build status

Library for scripting analyses against crates.io's database dumps.

These database dumps contain all information exposed by the crates.io API packaged into a single download. An updated dump is published every 24 hours. The latest dump is available at https://static.crates.io/db-dump.tar.gz.


The examples/ directory of this repo contains several runnable example analyses.

total‑downloads Computes time series of total downloads by day across all crates on crates.io
crate‑downloads Computes time series of downloads of one specific crate
top‑crates Computes the top few most directly depended upon crates
user‑dependencies Computes the percentage of crates.io which depends directly on at least one crate by the specified user
user‑downloads Computes time series of the fraction of crates.io downloads attributed to a single given user's crates

Each of these examples can be run using Cargo once you've downloaded a recent database dump:

$ wget https://static.crates.io/db-dump.tar.gz
$ cargo run --release --example total-downloads

Here is the implementation of the most basic example, total-downloads, and graph of the resulting table. It shows crates.io download rate doubling every 9 months, or equivalently 10× every 2.5 years!

use chrono::Utc;
use db_dump::Date;
use std::collections::BTreeMap as Map;

fn main() -> db_dump::Result<()> {
    let mut downloads = Map::<Date<Utc>, u64>::new();
        .version_downloads(|row| {
            *downloads.entry(row.date).or_default() += row.downloads;

    for (date, count) in downloads {
        println!("{},{}", date, count);

Crates.io downloads per day (log scale)

Here is a graph from the user-downloads example:

Fraction of crates.io downloads that are dtolnay's crates


Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~207K SLoC