bib-optimizer 0.5.0__tar.gz → 0.5.2__tar.gz
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.
- {bib_optimizer-0.5.0/src/bib_optimizer.egg-info → bib_optimizer-0.5.2}/PKG-INFO +5 -10
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/README.md +4 -0
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/pyproject.toml +18 -4
- bib_optimizer-0.5.2/src/bib_optimizer/__init__.py +2 -0
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/src/bib_optimizer/__main__.py +1 -1
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2/src/bib_optimizer.egg-info}/PKG-INFO +5 -10
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/src/bib_optimizer.egg-info/SOURCES.txt +2 -1
- bib_optimizer-0.5.2/src/bib_optimizer.egg-info/requires.txt +1 -0
- bib_optimizer-0.5.2/test/test_cli.py +49 -0
- bib_optimizer-0.5.0/src/bib_optimizer/__init__.py +0 -2
- bib_optimizer-0.5.0/src/bib_optimizer.egg-info/requires.txt +0 -12
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/LICENSE +0 -0
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/setup.cfg +0 -0
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/src/bib_optimizer/helpers.py +0 -0
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/src/bib_optimizer.egg-info/dependency_links.txt +0 -0
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/src/bib_optimizer.egg-info/entry_points.txt +0 -0
- {bib_optimizer-0.5.0 → bib_optimizer-0.5.2}/src/bib_optimizer.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bib_optimizer
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Clean and optimize bib file.
|
|
5
5
|
Author-email: Ka Wa Yip <yipkawa@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -42,15 +42,6 @@ Requires-Python: >=3.8
|
|
|
42
42
|
Description-Content-Type: text/markdown
|
|
43
43
|
License-File: LICENSE
|
|
44
44
|
Requires-Dist: bibtexparser<2,>=1.4.3
|
|
45
|
-
Provides-Extra: build
|
|
46
|
-
Requires-Dist: build; extra == "build"
|
|
47
|
-
Requires-Dist: twine; extra == "build"
|
|
48
|
-
Provides-Extra: dev
|
|
49
|
-
Requires-Dist: black; extra == "dev"
|
|
50
|
-
Requires-Dist: bumpver; extra == "dev"
|
|
51
|
-
Requires-Dist: isort; extra == "dev"
|
|
52
|
-
Requires-Dist: mypy; extra == "dev"
|
|
53
|
-
Requires-Dist: pytest; extra == "dev"
|
|
54
45
|
Dynamic: license-file
|
|
55
46
|
|
|
56
47
|
<figure>
|
|
@@ -192,6 +183,10 @@ _A sample_ `ref_opt.bib` _created after running_ `bibopt sample_main.tex sample_
|
|
|
192
183
|
> Return only the optimized `.bib` file.
|
|
193
184
|
> ```
|
|
194
185
|
|
|
186
|
+
|
|
187
|
+
https://github.com/user-attachments/assets/2b4e3224-2aee-44c1-974c-812dead72e2f
|
|
188
|
+
|
|
189
|
+
|
|
195
190
|
* * *
|
|
196
191
|
|
|
197
192
|
#### New feature (version 0.4.0)
|
|
@@ -137,6 +137,10 @@ _A sample_ `ref_opt.bib` _created after running_ `bibopt sample_main.tex sample_
|
|
|
137
137
|
> Return only the optimized `.bib` file.
|
|
138
138
|
> ```
|
|
139
139
|
|
|
140
|
+
|
|
141
|
+
https://github.com/user-attachments/assets/2b4e3224-2aee-44c1-974c-812dead72e2f
|
|
142
|
+
|
|
143
|
+
|
|
140
144
|
* * *
|
|
141
145
|
|
|
142
146
|
#### New feature (version 0.4.0)
|
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "bib_optimizer"
|
|
9
|
-
version = "0.5.
|
|
9
|
+
version = "0.5.2"
|
|
10
10
|
description = "Clean and optimize bib file."
|
|
11
11
|
authors = [
|
|
12
12
|
{ name="Ka Wa Yip", email="yipkawa@gmail.com" },
|
|
@@ -33,15 +33,29 @@ keywords = ["latex", "bib", "bibliography"]
|
|
|
33
33
|
Homepage = "https://github.com/kwyip/bib_optimizer"
|
|
34
34
|
Issues = "https://github.com/kwyip/bib_optimizer/issues"
|
|
35
35
|
|
|
36
|
-
[
|
|
36
|
+
[dependency-groups]
|
|
37
37
|
build = ["build", "twine"]
|
|
38
|
-
dev = ["black", "
|
|
38
|
+
dev = ["black>=26.10.1", "isort", "mypy", "pytest>=9.0.3"]
|
|
39
|
+
|
|
40
|
+
# Tooling needs newer Python; the installed CLI still supports Python >=3.8.
|
|
41
|
+
[tool.uv.dependency-groups]
|
|
42
|
+
build = { requires-python = ">=3.10" }
|
|
43
|
+
dev = { requires-python = ">=3.10" }
|
|
44
|
+
|
|
45
|
+
# Security floors for transitive tooling dependencies, without adding runtime deps.
|
|
46
|
+
[tool.uv]
|
|
47
|
+
constraint-dependencies = [
|
|
48
|
+
"urllib3>=2.8.0",
|
|
49
|
+
"cryptography>=50.0.0",
|
|
50
|
+
"requests>=2.33.0",
|
|
51
|
+
"pygments>=2.20.0",
|
|
52
|
+
]
|
|
39
53
|
|
|
40
54
|
[project.scripts]
|
|
41
55
|
bibopt = "bib_optimizer.__main__:main"
|
|
42
56
|
|
|
43
57
|
[tool.bumpver]
|
|
44
|
-
current_version = "0.5.
|
|
58
|
+
current_version = "0.5.2"
|
|
45
59
|
version_pattern = "MAJOR.MINOR.PATCH"
|
|
46
60
|
commit_message = "bump version {old_version} -> {new_version}"
|
|
47
61
|
commit = true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bib_optimizer
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Clean and optimize bib file.
|
|
5
5
|
Author-email: Ka Wa Yip <yipkawa@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -42,15 +42,6 @@ Requires-Python: >=3.8
|
|
|
42
42
|
Description-Content-Type: text/markdown
|
|
43
43
|
License-File: LICENSE
|
|
44
44
|
Requires-Dist: bibtexparser<2,>=1.4.3
|
|
45
|
-
Provides-Extra: build
|
|
46
|
-
Requires-Dist: build; extra == "build"
|
|
47
|
-
Requires-Dist: twine; extra == "build"
|
|
48
|
-
Provides-Extra: dev
|
|
49
|
-
Requires-Dist: black; extra == "dev"
|
|
50
|
-
Requires-Dist: bumpver; extra == "dev"
|
|
51
|
-
Requires-Dist: isort; extra == "dev"
|
|
52
|
-
Requires-Dist: mypy; extra == "dev"
|
|
53
|
-
Requires-Dist: pytest; extra == "dev"
|
|
54
45
|
Dynamic: license-file
|
|
55
46
|
|
|
56
47
|
<figure>
|
|
@@ -192,6 +183,10 @@ _A sample_ `ref_opt.bib` _created after running_ `bibopt sample_main.tex sample_
|
|
|
192
183
|
> Return only the optimized `.bib` file.
|
|
193
184
|
> ```
|
|
194
185
|
|
|
186
|
+
|
|
187
|
+
https://github.com/user-attachments/assets/2b4e3224-2aee-44c1-974c-812dead72e2f
|
|
188
|
+
|
|
189
|
+
|
|
195
190
|
* * *
|
|
196
191
|
|
|
197
192
|
#### New feature (version 0.4.0)
|
|
@@ -9,4 +9,5 @@ src/bib_optimizer.egg-info/SOURCES.txt
|
|
|
9
9
|
src/bib_optimizer.egg-info/dependency_links.txt
|
|
10
10
|
src/bib_optimizer.egg-info/entry_points.txt
|
|
11
11
|
src/bib_optimizer.egg-info/requires.txt
|
|
12
|
-
src/bib_optimizer.egg-info/top_level.txt
|
|
12
|
+
src/bib_optimizer.egg-info/top_level.txt
|
|
13
|
+
test/test_cli.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bibtexparser<2,>=1.4.3
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import subprocess
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
import bibtexparser
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def run_cli(cwd, tex, bib, output):
|
|
10
|
+
subprocess.run(
|
|
11
|
+
[sys.executable, "-m", "bib_optimizer", str(tex), str(bib), str(output)],
|
|
12
|
+
cwd=cwd,
|
|
13
|
+
check=True,
|
|
14
|
+
capture_output=True,
|
|
15
|
+
text=True,
|
|
16
|
+
)
|
|
17
|
+
with output.open(encoding="utf-8") as stream:
|
|
18
|
+
return bibtexparser.load(stream).entries
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_sample_cli_preserves_inputs_and_citation_order(tmp_path):
|
|
22
|
+
samples = Path(__file__).parent
|
|
23
|
+
tex = samples / "sample_main.tex"
|
|
24
|
+
bib = samples / "sample_ref.bib"
|
|
25
|
+
originals = (tex.read_bytes(), bib.read_bytes())
|
|
26
|
+
entries = run_cli(samples, tex, bib, tmp_path / "optimized.bib")
|
|
27
|
+
assert [entry["ID"] for entry in entries] == ["firstref", "secondref", "thirdref"]
|
|
28
|
+
assert (tex.read_bytes(), bib.read_bytes()) == originals
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@pytest.mark.parametrize("command", ["input", "include"])
|
|
32
|
+
def test_cli_includes_child_citations_and_skips_missing_files(tmp_path, command):
|
|
33
|
+
tex = tmp_path / "main.tex"
|
|
34
|
+
bib = tmp_path / "refs.bib"
|
|
35
|
+
tex.write_text(
|
|
36
|
+
"\\cite{first}\n\\" + command + "{child}\n\\cite{last}\n" "\\input{missing}\n",
|
|
37
|
+
encoding="utf-8",
|
|
38
|
+
)
|
|
39
|
+
(tmp_path / "child.tex").write_text("\\cite{child,first}\n", encoding="utf-8")
|
|
40
|
+
bib.write_text(
|
|
41
|
+
"\n".join(
|
|
42
|
+
"@article{" + key + ", title={Café}}"
|
|
43
|
+
for key in ["unused", "last", "child", "first"]
|
|
44
|
+
),
|
|
45
|
+
encoding="utf-8",
|
|
46
|
+
)
|
|
47
|
+
entries = run_cli(tmp_path, tex, bib, tmp_path / "optimized.bib")
|
|
48
|
+
assert [entry["ID"] for entry in entries] == ["first", "child", "last"]
|
|
49
|
+
assert all(entry["title"] == "Café" for entry in entries)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|