中文文档:README_CN.md
Bibkit is a command-line toolbox for managing BibTeX (.bib) files in LaTeX projects. It analyzes your .tex source to understand what references are actually used, and provides utilities to keep your bibliography clean and consistent.
Table of Contents
- Installation
- Commands
- Roadmap
- Supported Citation Commands
- Supported BibTeX Features
- Contributing
- License
Installation
git clone https://github.com/ZBigFish/bibkit.git
cd bibkit
pip install -e .
The bibkit command is available globally after installation. You can also use python -m bibkit.
Commands
bibkit clean
Remove or comment out unused entries from your .bib files based on actual \cite usage.
# Run from your LaTeX project root
bibkit clean
# Or specify a path
bibkit clean /path/to/my-paper
# Preview first
bibkit clean --dry-run
Features:
- Auto-detects the main
.texvia\documentclass; prompts for choice when multiple versions exist - Recursively follows
\input/\includeto collect all citations across sub-files - Auto-discovers
.bibfiles from\bibliography{...}and\addbibresource{...} - Non-destructive by default — writes a
new_XXX.bib, never touches originals crossrefparent entries are kept automatically (transitive resolution)- Handles
\nocite{*}— all entries preserved
Options:
| Flag | Effect |
|---|---|
| (none) | Write new_XXX.bib with unused entries removed |
--comment |
Comment out unused entries with % instead of removing |
--in-place |
Modify the original .bib file directly |
--in-place --comment |
Modify original, comment out unused |
--dry-run |
Preview only — no files changed |
--keep "key1,key2" |
Comma-separated list of keys to always preserve |
--bib references.bib |
Process a specific bib file (overrides auto-discovery) |
--no-recursive |
Don't search subdirectories for .tex files |
Example output:
$ bibkit clean /path/to/paper
Main file: main.tex
(with 7 included .tex file(s))
Scanned 8 .tex file(s), found 55 unique citation key(s).
--- refs.bib ---
Total entries: 75
Entries to keep: 55
Entries to removed: 20
- spencer2016causes
- goodfellow2014generative
...
Wrote to new_refs.bib (20 entries removed).
Done.
Roadmap
Commands planned for future releases:
| Command | Description |
|---|---|
bibkit clean |
Done. Remove unused entries from .bib files |
bibkit merge |
Merge multiple .bib files with deduplication |
bibkit check |
Validate .bib entries (missing fields, malformed keys, broken crossrefs) |
bibkit sort |
Sort entries by key, author, or year |
bibkit fmt |
Normalize formatting (capitalize titles, unify venue abbreviations) |
bibkit diff |
Show differences between two .bib files |
Have a feature request? Open an issue.
Supported Citation Commands
\cite \citep \citet \citeauthor \citeyear \citealp \citealt
\parencite \textcite \footcite \autocite \supercite \fullcite
\Cite \Citep \Citet (capitalized) \cite* (starred)
Supports optional arguments (\cite[page 3]{key}), multi-key (\cite{key1,key2}), and \nocite{*}.
Supported BibTeX Features
- All standard entry types:
@article,@inproceedings,@book,@incollection,@misc, and more @string,@comment,@preambleblocks are always preserved- Nested braces in field values (
{CNN},{\L}ukasz) handled correctly crossreffields resolved transitively — parent entries kept automatically
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Star History
License
Metadata
Release files for bibkit 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bibkit-1.0.0.tar.gz | 16.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bibkit-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.6 kB
Release files / bibkit-1.0.0.tar.gz
| Download URL | bibkit-1.0.0.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70759d3c9cfa4df5ef9487171835749196c10777cf6991ade0c9ad1f394cc5ea
|
|
BLAKE2b-256 checksum How to use checksums |
57e52eea9c85e51c50d12ccbbae8c5f8fefc22b488dcb225025eee7cdc705f5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|
Release files / bibkit-1.0.0-py3-none-any.whl
| Download URL | bibkit-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8dcafcef8cfde68160aabf4cb145c19ccb288ac2993f9e2460fb218e713b8fd9
|
|
BLAKE2b-256 checksum How to use checksums |
dd5370f2b6c9ff3e850ea033a25a06d15e5654120f6415447d8d2995fa9779d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.9
|