bibsync 1.0.0__cp313-abi3-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
bibsync/__init__.py ADDED
@@ -0,0 +1,18 @@
1
+ """Python bindings for bibsync."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+ from collections.abc import Sequence
7
+
8
+ from ._bibsync import run_cli as _run_cli
9
+ from ._bibsync import sync_files
10
+
11
+ __all__ = ["main", "sync_files"]
12
+
13
+
14
+ def main(argv: Sequence[str] | None = None) -> int:
15
+ """Run the Rust CLI implementation."""
16
+ if argv is None:
17
+ argv = sys.argv
18
+ return _run_cli(list(argv))
bibsync/__init__.pyi ADDED
@@ -0,0 +1,30 @@
1
+ from collections.abc import Sequence
2
+ from typing import TypedDict
3
+
4
+ class SyncReport(TypedDict):
5
+ output: str
6
+ added: list[str]
7
+ updated: list[str]
8
+ existing: list[str]
9
+ found_in_other: list[str]
10
+ unresolved: list[str]
11
+ unresolved_details: list[dict[str, str]]
12
+ changed: bool
13
+ check_mode: bool
14
+
15
+ def sync_files(
16
+ files: list[str],
17
+ output: str | None = None,
18
+ other_bibliographies: list[str] | None = None,
19
+ provider: str = "auto",
20
+ update_mode: str = "preprints-only",
21
+ force_regenerate: bool = False,
22
+ merge_other: bool = False,
23
+ backup: bool = True,
24
+ check: bool = True,
25
+ cache: bool = False,
26
+ refresh_cache: bool = False,
27
+ cache_dir: str | None = None,
28
+ ignore_file: str | None = None,
29
+ ) -> SyncReport: ...
30
+ def main(argv: Sequence[str] | None = None) -> int: ...
bibsync/__main__.py ADDED
@@ -0,0 +1,7 @@
1
+ """Module entry point for bibsync."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from . import main
6
+
7
+ raise SystemExit(main())
bibsync/_bibsync.pyd ADDED
Binary file
bibsync/py.typed ADDED
File without changes
@@ -0,0 +1,379 @@
1
+ Metadata-Version: 2.4
2
+ Name: bibsync
3
+ Version: 1.0.0
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Environment :: Console
6
+ Classifier: Intended Audience :: Science/Research
7
+ Classifier: License :: OSI Approved :: BSD License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Classifier: Programming Language :: Python :: 3.14
11
+ Classifier: Programming Language :: Python :: 3.15
12
+ Classifier: Programming Language :: Rust
13
+ Classifier: Topic :: Scientific/Engineering
14
+ Classifier: Topic :: Text Processing :: Markup :: LaTeX
15
+ License-File: LICENSE
16
+ Summary: Synchronize BibTeX files from citation keys in LaTeX sources
17
+ Keywords: bibtex,latex,arxiv,ads,inspirehep
18
+ Home-Page: https://github.com/isaac-cf-wong/bibsync
19
+ Author: Isaac C. F. Wong
20
+ License-Expression: BSD-3-Clause
21
+ Requires-Python: >=3.13
22
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
23
+ Project-URL: Documentation, https://isaac-cf-wong.github.io/bibsync
24
+ Project-URL: Homepage, https://github.com/isaac-cf-wong/bibsync
25
+ Project-URL: Issues, https://github.com/isaac-cf-wong/bibsync/issues
26
+ Project-URL: Repository, https://github.com/isaac-cf-wong/bibsync
27
+
28
+ # bibsync
29
+
30
+ [![CI](https://github.com/isaac-cf-wong/bibsync/actions/workflows/ci.yml/badge.svg)](https://github.com/isaac-cf-wong/bibsync/actions/workflows/ci.yml)
31
+ [![Documentation Status](https://github.com/isaac-cf-wong/bibsync/actions/workflows/documentation.yml/badge.svg)](https://isaac-cf-wong.github.io/bibsync/)
32
+ [![Crates.io](https://img.shields.io/crates/v/bibsync)](https://crates.io/crates/bibsync)
33
+ [![Docs.rs](https://docs.rs/bibsync/badge.svg)](https://docs.rs/bibsync)
34
+ [![PyPI Version](https://img.shields.io/pypi/v/bibsync)](https://pypi.org/project/bibsync/)
35
+ [![Python Versions](https://img.shields.io/pypi/pyversions/bibsync)](https://pypi.org/project/bibsync/)
36
+ [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](LICENSE)
37
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
38
+ [![DOI](https://zenodo.org/badge/1251520994.svg)](https://doi.org/10.5281/zenodo.20422622)
39
+ [![SPEC 0 — Minimum Supported Dependencies](https://img.shields.io/badge/SPEC-0-green?labelColor=%23004811&color=%235CA038)](https://scientific-python.org/specs/spec-0000/)
40
+
41
+ `bibsync` synchronizes BibTeX files from citation keys in LaTeX sources. It is
42
+ inspired by `adstex`, with provider support for both NASA ADS and InspireHEP.
43
+
44
+ The primary workflow is to cite papers by identifier, especially arXiv ID:
45
+
46
+ ```tex
47
+ \citep{2404.14498}
48
+ \citet{arXiv:2312.00752}
49
+ ```
50
+
51
+ Then check the bibliography:
52
+
53
+ ```shell
54
+ bibsync main.tex -o references.bib
55
+ ```
56
+
57
+ To update the file, add `--fix`:
58
+
59
+ ```shell
60
+ bibsync --fix main.tex -o references.bib
61
+ ```
62
+
63
+ `bibsync` scans the TeX file, resolves missing identifier-like citekeys through
64
+ NASA ADS and/or InspireHEP, rewrites provider BibTeX entries so the citekey stays
65
+ the key used in TeX, and reports whether the output `.bib` file is current. With
66
+ `--fix`, it writes the merged bibliography.
67
+
68
+ Markdown sources are supported too, including
69
+ [Journal of Open Source Software](https://joss.theoj.org/) `paper.md` files.
70
+ `bibsync` reads pandoc citations and the `bibliography` field from the YAML
71
+ frontmatter:
72
+
73
+ ```markdown
74
+ ---
75
+ bibliography: paper.bib
76
+ ---
77
+
78
+ Prior work [@1602.03837; @10.1103/PhysRevLett.116.061102].
79
+ ```
80
+
81
+ ```shell
82
+ bibsync --fix paper.md
83
+ ```
84
+
85
+ When a citekey cannot be resolved, the command prints the key together with a
86
+ reason and the likely fix. For example, an unsupported citekey is reported as an
87
+ identifier-format problem, while an arXiv ID or DOI that the provider cannot find
88
+ is reported as a provider miss.
89
+
90
+ ## Installation
91
+
92
+ Install the Rust CLI from crates.io:
93
+
94
+ ```shell
95
+ cargo install bibsync
96
+ ```
97
+
98
+ Install the Python package from PyPI:
99
+
100
+ ```shell
101
+ pip install bibsync
102
+ ```
103
+
104
+ The PyPI package includes Python bindings and installs the `bibsync` command.
105
+ Python 3.13 or newer is required.
106
+
107
+ You can also download a pre-built binary from the
108
+ [GitHub releases page](https://github.com/isaac-cf-wong/bibsync/releases). Pick
109
+ the archive for your platform, extract it, and place the `bibsync` executable
110
+ somewhere on your `PATH`.
111
+
112
+ To compile from source:
113
+
114
+ ```shell
115
+ git clone https://github.com/isaac-cf-wong/bibsync.git
116
+ cd bibsync
117
+ cargo build --release
118
+ ```
119
+
120
+ The compiled binary is written to `target/release/bibsync` on Unix-like systems
121
+ or `target\release\bibsync.exe` on Windows.
122
+
123
+ ## Citing
124
+
125
+ If `bibsync` contributes to a scientific publication, please cite it using the
126
+ Zenodo record:
127
+
128
+ [https://doi.org/10.5281/zenodo.20422622](https://doi.org/10.5281/zenodo.20422622)
129
+
130
+ Citation formats including BibTeX can be exported directly from the Zenodo page.
131
+ For convenience, you can also use:
132
+
133
+ ```bibtex
134
+ @software{wong2026bibsync,
135
+ author = {Wong, Isaac C. F.},
136
+ title = {bibsync: A Rust package to automatically resolve, synchronize, and validate LaTeX citations across BibTeX databases},
137
+ version = {v1.0.0},
138
+ year = {2026},
139
+ month = oct,
140
+ doi = {10.5281/zenodo.20422622},
141
+ url = {https://doi.org/10.5281/zenodo.20422622}
142
+ }
143
+ ```
144
+
145
+ ## Providers
146
+
147
+ By default `bibsync` tries NASA ADS first and InspireHEP second:
148
+
149
+ ```shell
150
+ bibsync --fix main.tex -o references.bib --provider auto
151
+ ```
152
+
153
+ NASA ADS requires an API token:
154
+
155
+ ```shell
156
+ export ADS_API_TOKEN="..."
157
+ ```
158
+
159
+ You can choose a single provider:
160
+
161
+ ```shell
162
+ bibsync --fix main.tex -o references.bib --provider ads
163
+ bibsync --fix main.tex -o references.bib --provider inspire
164
+ ```
165
+
166
+ InspireHEP supports arXiv IDs and DOIs. NASA ADS supports arXiv IDs, DOIs, and
167
+ ADS bibcodes.
168
+
169
+ ## Python API
170
+
171
+ `bibsync` can also be installed from PyPI:
172
+
173
+ ```shell
174
+ pip install bibsync
175
+ ```
176
+
177
+ The PyPI package provides Python bindings backed by the Rust implementation:
178
+
179
+ ```python
180
+ import bibsync
181
+
182
+ report = bibsync.sync_files(
183
+ ["main.tex"],
184
+ output="references.bib",
185
+ provider="inspire",
186
+ check=True,
187
+ )
188
+ ```
189
+
190
+ It also installs the `bibsync` command. The command delegates to the same Rust
191
+ CLI implementation as the Cargo-installed binary, so command-line behavior is
192
+ kept in one place.
193
+
194
+ ## Existing Bibliographies
195
+
196
+ If the TeX source contains `\bibliography{references}`, `bibsync` can discover
197
+ `references.bib` automatically:
198
+
199
+ ```shell
200
+ bibsync --fix main.tex
201
+ ```
202
+
203
+ Additional read-only bibliographies can be used to avoid duplicating entries:
204
+
205
+ ```shell
206
+ bibsync --fix main.tex -o references.bib -r shared.bib software.bib
207
+ ```
208
+
209
+ Use `--merge-other` to copy matching entries from those read-only files into the
210
+ main output file.
211
+
212
+ To update a bibliography in place, pass a single `.bib` file:
213
+
214
+ ```shell
215
+ bibsync --fix references.bib --force-regenerate
216
+ ```
217
+
218
+ Existing input files are validated before resolution. A missing single `.bib`
219
+ input, `--other` bibliography, or `--ignore-file` is reported as an error with
220
+ the path that could not be read. Existing bibliography files are also parsed
221
+ strictly, so malformed BibTeX reports the file and the approximate failing
222
+ entry instead of being treated as an empty or partial bibliography.
223
+
224
+ ### Update Behavior
225
+
226
+ By default `bibsync` leaves published entries untouched. Only entries that look
227
+ like unpublished preprints — those with an `archivePrefix` or `eprinttype` field
228
+ but no `journal` field — are re-queried to check whether they have been
229
+ published. If so, the entry is updated; otherwise it is preserved.
230
+
231
+ | Flag | Behavior |
232
+ | -------------------- | --------------------------------------------- |
233
+ | _(default)_ | Re-check preprints; skip published entries |
234
+ | `--no-update` | Skip all existing entries |
235
+ | `--update-all` | Re-resolve all existing entries |
236
+ | `--force-regenerate` | Re-resolve and overwrite all existing entries |
237
+
238
+ ### Ignoring Entries
239
+
240
+ To exclude specific entries from all resolution — for example, books or theses
241
+ you have curated by hand — list their citekeys in a `.bibsyncignore` file:
242
+
243
+ ```text
244
+ # .bibsyncignore
245
+ knuth1997art
246
+ smith2024thesis
247
+ ```
248
+
249
+ Pass the file with `--ignore-file`:
250
+
251
+ ```shell
252
+ bibsync --fix main.tex -o references.bib --ignore-file .bibsyncignore
253
+ ```
254
+
255
+ ## Cache
256
+
257
+ Use `--cache` to avoid repeated provider API calls:
258
+
259
+ ```shell
260
+ bibsync --cache main.tex -o references.bib
261
+ bibsync --fix --cache main.tex -o references.bib
262
+ ```
263
+
264
+ The cache stores provider records and mappings from arXiv IDs or DOIs to the
265
+ provider's canonical record ID. Preprint entries that are re-checked for
266
+ publication always bypass the cache and fetch a fresh result, then write it back.
267
+ Use `--refresh-cache` to force a fresh fetch for all entries:
268
+
269
+ ```shell
270
+ bibsync --fix --refresh-cache main.tex -o references.bib
271
+ ```
272
+
273
+ Override the cache location with `--cache-dir DIR`.
274
+
275
+ If a cache file is corrupt, `bibsync` reports the exact cache path and asks you
276
+ to refresh or remove the bad cache entry. Provider request failures include the
277
+ provider and citekey or batch being resolved.
278
+
279
+ ## Pre-commit
280
+
281
+ The repository includes `.pre-commit-hooks.yaml`, so other projects can use
282
+ `bibsync` as a pre-commit hook.
283
+
284
+ Both hooks run on TeX (`.tex`), BibTeX (`.bib`), and Markdown (`.md`) files.
285
+ Every `@key` in a scanned file is treated as a citation, so scanning unrelated
286
+ Markdown can raise false positives — for example a `README.md` that uses GitHub
287
+ `@mentions`. **The recommended setup is to scope the hook to your citation
288
+ sources with `files:`** rather than relying on the default file matching.
289
+
290
+ For a JOSS paper (`paper.md` + `paper.bib`):
291
+
292
+ ```yaml
293
+ repos:
294
+ - repo: https://github.com/isaac-cf-wong/bibsync
295
+ rev: v1.0.0
296
+ hooks:
297
+ - id: bibsync-bin
298
+ files: ^paper\.md$
299
+ args: [--fix, --cache, --provider, inspire, --output, paper.bib]
300
+ ```
301
+
302
+ The `--output` bibliography is read and written even when it is not itself
303
+ matched by `files:`, so scoping to `paper.md` still keeps `paper.bib` in sync.
304
+
305
+ The remaining examples below omit `files:` for brevity; add it to match your
306
+ project layout.
307
+
308
+ Use the pre-built binary hook for faster installs:
309
+
310
+ ```yaml
311
+ repos:
312
+ - repo: https://github.com/isaac-cf-wong/bibsync
313
+ rev: v1.0.0
314
+ hooks:
315
+ - id: bibsync-bin
316
+ args: [--cache, --provider, inspire, --output, references.bib]
317
+ ```
318
+
319
+ The binary hook downloads a platform-specific archive from the GitHub release
320
+ matching `rev` and caches it under pre-commit's cache directory. The source hook
321
+ is available for Linux x86_64/aarch64, macOS x86_64/aarch64, and Windows x86_64.
322
+ The source hook is still available, but it compiles the Rust crate during hook
323
+ installation:
324
+
325
+ ```yaml
326
+ repos:
327
+ - repo: https://github.com/isaac-cf-wong/bibsync
328
+ rev: v1.0.0
329
+ hooks:
330
+ - id: bibsync
331
+ args: [--provider, inspire, --output, references.bib]
332
+ ```
333
+
334
+ By default, the hook checks whether the bibliography is current and fails without
335
+ writing changes. To let the hook update files, add `--fix` to the hook args:
336
+
337
+ ```yaml
338
+ repos:
339
+ - repo: https://github.com/isaac-cf-wong/bibsync
340
+ rev: v1.0.0
341
+ hooks:
342
+ - id: bibsync-bin
343
+ args: [--fix, --cache, --provider, inspire, --output, references.bib]
344
+ ```
345
+
346
+ To skip manually curated entries, add `--ignore-file`:
347
+
348
+ ```yaml
349
+ repos:
350
+ - repo: https://github.com/isaac-cf-wong/bibsync
351
+ rev: v1.0.0
352
+ hooks:
353
+ - id: bibsync-bin
354
+ args:
355
+ [
356
+ --fix,
357
+ --cache,
358
+ --provider,
359
+ inspire,
360
+ --output,
361
+ references.bib,
362
+ --ignore-file,
363
+ .bibsyncignore,
364
+ ]
365
+ ```
366
+
367
+ For a project-local hook while developing `bibsync` itself:
368
+
369
+ ```yaml
370
+ repos:
371
+ - repo: local
372
+ hooks:
373
+ - id: bibsync
374
+ name: bibsync
375
+ entry: cargo run -- --fix --provider inspire --output references.bib
376
+ language: system
377
+ files: \.tex$
378
+ ```
379
+
@@ -0,0 +1,11 @@
1
+ bibsync/__init__.py,sha256=r_DcWMjQdN7wtF5b2sQ4BpDorAPZBzoPa0ebP_ZnxU0,422
2
+ bibsync/__init__.pyi,sha256=wTPE8EBAPlfErC9y_YSzYtqEEdp2BOdbNyCJxyoj0r8,861
3
+ bibsync/__main__.py,sha256=d3gBrSrdkev1nvTAZ4bpwxopSWyEc8nsJqznoB0SHyM,127
4
+ bibsync/_bibsync.pyd,sha256=MmPk_ZFuXjIpfBq7i8VNm0HSiD1DgM0Nd0hWLS6I8NY,7030272
5
+ bibsync/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ bibsync-1.0.0.dist-info/METADATA,sha256=neEoSzx5dkgYgKs3EGlOeJQVpeFk9f1P8UWEohNDiAo,12369
7
+ bibsync-1.0.0.dist-info/WHEEL,sha256=g-6foYlXtBfHzCxIMk3srQEqex488rhfAPh9HaYAjEM,96
8
+ bibsync-1.0.0.dist-info/entry_points.txt,sha256=rQ1lpGFpHFGehXkIKePObYE24LIOeYg2-4NCTcT-zKI,39
9
+ bibsync-1.0.0.dist-info/licenses/LICENSE,sha256=rmxdpykl5e6Pg6hov7Ql6_6hwiq7ybqUUyF2O2SkH1o,1507
10
+ bibsync-1.0.0.dist-info/sboms/bibsync.cyclonedx.json,sha256=NwcpWCLwEXCr7naftP0v6QUA2JNK7tjTHxze_n42zoA,168751
11
+ bibsync-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.15.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-abi3-win_amd64
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ bibsync=bibsync:main
@@ -0,0 +1,26 @@
1
+ Copyright 2026, Isaac C. F. Wong
2
+
3
+ Redistribution and use in source and binary forms, with or without modification,
4
+ are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ 3. Neither the name of the copyright holder nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software without
15
+ specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.