Crates.io | db-dump |
lib.rs | db-dump |
version | |
source | src |
created_at | 2021-03-16 22:49:30.618111 |
updated_at | 2024-10-29 03:41:19.212235 |
description | Library for scripting analyses against crates.io's database dumps |
homepage | |
repository | https://github.com/dtolnay/db-dump |
max_upload_size | |
id | 369986 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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();
db_dump::Loader::new()
.version_downloads(|row| {
*downloads.entry(row.date).or_default() += row.downloads;
})
.load("./db-dump.tar.gz")?;
for (date, count) in downloads {
println!("{},{}", date, count);
}
Ok(())
}
Here is a graph from the user-downloads example: