Fast sharded-index replacement for apt-file search on Debian/Ubuntu.
Project description
apt-file-fast
A fast replacement for apt-file search on Debian/Ubuntu — with dramatically faster index creation.
apt-file-fast builds and maintains a local search index of the files provided by your
installed packages. Updates are incremental: only the data for packages added, removed, or
changed since the last run is rewritten, so refreshing after apt install / apt upgrade
is orders of magnitude faster than apt-file update.
Requirements
- Debian or Ubuntu
- Python 3.10+
ripgrep(apt install ripgrep)
Install
From PyPI (recommended)
uv tool install apt-file-fast
Or run it one-shot without installing:
uvx apt-file-fast --help
From source
git clone https://github.com/izumo-m/apt-file-fast.git
cd apt-file-fast
uv sync
uv run apt-file-fast --help
Usage
Build or refresh the index (run once, then after every apt install/apt upgrade):
apt-file-fast update
Search for a file across all installed packages:
apt-file-fast search ls
apt-file-fast search -i README # case-insensitive
apt-file-fast search -x '^/usr/bin/py.*' # regex
Search without building the index — scan /var/lib/dpkg/info/*.list
directly. Useful right after install (no update needed) or when you
want a result that always reflects current dpkg state:
apt-file-fast search --no-cache /bin/ls
Clear the cache:
apt-file-fast clean
Options
| Option | Scope | Description |
|---|---|---|
--cache-dir PATH |
all commands | Override cache location |
-i, --ignore-case |
search |
Case-insensitive match |
-x, --regexp |
search |
Treat the query as a regex |
--no-cache |
search |
Skip the index; grep dpkg state directly |
Index settings (compression, shard size, etc.) live in manifest.json and
are edited via config set rather than update flags — see below.
Run apt-file-fast --help for the full list of options.
Configuration
Index settings are stored in the cache's manifest.json. View them or
change individual fields without rebuilding the index:
apt-file-fast config show
apt-file-fast config set --compression zstd --compression-level 7
apt-file-fast config set --search-threads 4
apt-file-fast config set --target-shard-bytes 1M
config set only persists the fields you pass; everything else is left
alone. A first-time update with no manifest auto-generates one with
the built-in defaults, so config set is optional.
Compression
Shards are zstd-compressed by default — both compression and decompression
are several times faster than gzip at comparable ratios for this kind of
repetitive TSV data. Each shard's filename (shard-NNNN.tsv.zst / .tsv.gz
/ .tsv) reflects how it is encoded, so a single cache directory can
legitimately hold a mix of formats during a migration — search
transparently handles all three via rg -z.
Migrating after a config change
Changing compression, compression_level, or target_shard_bytes only
affects shards written after the change. Existing shards are carried
verbatim by update until the packages they hold are added, removed, or
changed. To force every shard onto the new setting:
apt-file-fast config set --compression zstd
apt-file-fast clean && apt-file-fast update
config set prints a reminder to stderr when it detects that a
cache-affecting field changed against an existing index.
License
MIT © 2026 Masanao Izumo
Contributors and maintainers: see
docs/development.md
for internals and the release process.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apt_file_fast-1.0.0.tar.gz.
File metadata
- Download URL: apt_file_fast-1.0.0.tar.gz
- Upload date:
- Size: 59.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e2200a963fd5996717178677740b367885dd887570dfedeb7665d3e54323806
|
|
| MD5 |
3325d915985a9cfaa42f9d17b1944f4a
|
|
| BLAKE2b-256 |
699a05f3aef439bff3e1686bd06c1ee3efe11f3f263ddd677bc420a815011c90
|
File details
Details for the file apt_file_fast-1.0.0-py3-none-any.whl.
File metadata
- Download URL: apt_file_fast-1.0.0-py3-none-any.whl
- Upload date:
- Size: 33.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4f47ac8d0989fe1f10e78f15a37f087d263322c9ff3f97f7ee078290c1bbccf
|
|
| MD5 |
ad33e465f076cb40b693e36a587befdd
|
|
| BLAKE2b-256 |
5ff90ad64b449f1a5b18fbac5167e4e5d58adfd99af7a39b9d26e7bf067645c2
|