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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bib_optimizer
3
- Version: 0.5.0
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.0"
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
- [project.optional-dependencies]
36
+ [dependency-groups]
37
37
  build = ["build", "twine"]
38
- dev = ["black", "bumpver", "isort", "mypy", "pytest"]
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.0"
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
@@ -0,0 +1,2 @@
1
+ # Version
2
+ __version__ = "0.5.2"
@@ -1,7 +1,7 @@
1
1
  """Version:
2
2
  --------
3
3
 
4
- - bib_optimizer v0.5.0
4
+ - bib_optimizer v0.5.2
5
5
  """
6
6
  import sys
7
7
  from bib_optimizer import helpers
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bib_optimizer
3
- Version: 0.5.0
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)
@@ -1,2 +0,0 @@
1
- # Version
2
- __version__ = "0.5.0"
@@ -1,12 +0,0 @@
1
- bibtexparser<2,>=1.4.3
2
-
3
- [build]
4
- build
5
- twine
6
-
7
- [dev]
8
- black
9
- bumpver
10
- isort
11
- mypy
12
- pytest
File without changes
File without changes