easybib 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.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.
- easybib/cli.py +13 -5
- {easybib-0.1.0.dist-info → easybib-0.2.0.dist-info}/METADATA +22 -5
- easybib-0.2.0.dist-info/RECORD +9 -0
- easybib-0.1.0.dist-info/RECORD +0 -9
- {easybib-0.1.0.dist-info → easybib-0.2.0.dist-info}/WHEEL +0 -0
- {easybib-0.1.0.dist-info → easybib-0.2.0.dist-info}/entry_points.txt +0 -0
- {easybib-0.1.0.dist-info → easybib-0.2.0.dist-info}/top_level.txt +0 -0
easybib/cli.py
CHANGED
|
@@ -17,9 +17,9 @@ def main():
|
|
|
17
17
|
parser = argparse.ArgumentParser(
|
|
18
18
|
description="Extract citations and download BibTeX from NASA/ADS"
|
|
19
19
|
)
|
|
20
|
-
parser.add_argument("
|
|
20
|
+
parser.add_argument("path", help="LaTeX file or directory containing LaTeX files")
|
|
21
21
|
parser.add_argument(
|
|
22
|
-
"-o", "--output", default="references.bib", help="Output BibTeX file"
|
|
22
|
+
"-o", "--output", default="references.bib", help="Output BibTeX file (existing entries are retained)"
|
|
23
23
|
)
|
|
24
24
|
parser.add_argument(
|
|
25
25
|
"-a",
|
|
@@ -46,13 +46,21 @@ def main():
|
|
|
46
46
|
default="ads",
|
|
47
47
|
help="Preferred BibTeX source: 'ads' (default), 'inspire', or 'auto' (based on key format)",
|
|
48
48
|
)
|
|
49
|
+
parser.add_argument(
|
|
50
|
+
"--ads-api-key",
|
|
51
|
+
help="ADS API key (overrides ADS_API_KEY environment variable)",
|
|
52
|
+
)
|
|
49
53
|
args = parser.parse_args()
|
|
50
54
|
|
|
51
55
|
# Collect all citation keys
|
|
52
|
-
|
|
56
|
+
input_path = Path(args.path)
|
|
53
57
|
all_keys = set()
|
|
54
58
|
all_warnings = []
|
|
55
|
-
|
|
59
|
+
if input_path.is_file():
|
|
60
|
+
tex_files = [input_path]
|
|
61
|
+
else:
|
|
62
|
+
tex_files = input_path.glob("**/*.tex")
|
|
63
|
+
for tex_file in tex_files:
|
|
56
64
|
keys, warnings = extract_cite_keys(tex_file)
|
|
57
65
|
all_keys.update(keys)
|
|
58
66
|
all_warnings.extend(warnings)
|
|
@@ -73,7 +81,7 @@ def main():
|
|
|
73
81
|
return 0
|
|
74
82
|
|
|
75
83
|
# Check for ADS API key (not required if using --source inspire)
|
|
76
|
-
api_key = os.getenv("ADS_API_KEY")
|
|
84
|
+
api_key = args.ads_api_key or os.getenv("ADS_API_KEY")
|
|
77
85
|
if not api_key and args.source != "inspire":
|
|
78
86
|
print("Error: ADS_API_KEY environment variable not set")
|
|
79
87
|
print("Get your API key from: https://ui.adsabs.harvard.edu/user/settings/token")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: easybib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Automatically fetch BibTeX entries from INSPIRE and ADS for LaTeX projects
|
|
5
5
|
Author-email: Gregory Ashton <gregory.ashton@ligo.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -9,9 +9,15 @@ Project-URL: Repository, https://github.com/GregoryAshton/easybib
|
|
|
9
9
|
Requires-Python: >=3.9
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
Requires-Dist: requests
|
|
12
|
+
Provides-Extra: test
|
|
13
|
+
Requires-Dist: pytest; extra == "test"
|
|
14
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
12
15
|
|
|
13
16
|
# easybib
|
|
14
17
|
|
|
18
|
+
[](https://github.com/GregoryAshton/easybib/actions/workflows/tests.yml)
|
|
19
|
+
[](https://codecov.io/gh/GregoryAshton/easybib)
|
|
20
|
+
|
|
15
21
|
Automatically fetch BibTeX entries from [INSPIRE](https://inspirehep.net/) and [NASA/ADS](https://ui.adsabs.harvard.edu/) for LaTeX projects.
|
|
16
22
|
|
|
17
23
|
easybib scans your `.tex` files for citation keys, looks them up on INSPIRE and/or ADS, and writes a `.bib` file with the results. It handles INSPIRE texkeys (e.g. `Author:2020abc`) and ADS bibcodes (e.g. `2016PhRvL.116f1102A`).
|
|
@@ -26,9 +32,10 @@ pip install easybib
|
|
|
26
32
|
|
|
27
33
|
```bash
|
|
28
34
|
easybib /path/to/latex/project
|
|
35
|
+
easybib paper.tex
|
|
29
36
|
```
|
|
30
37
|
|
|
31
|
-
|
|
38
|
+
Pass a directory to scan all `.tex` files recursively, or a single `.tex` file. BibTeX entries are fetched and written to `references.bib`.
|
|
32
39
|
|
|
33
40
|
### Options
|
|
34
41
|
|
|
@@ -39,13 +46,17 @@ This will scan all `.tex` files in the directory, fetch BibTeX entries, and writ
|
|
|
39
46
|
| `-a`, `--max-authors` | Truncate author lists (default: 3, use 0 for no limit) |
|
|
40
47
|
| `-l`, `--list-keys` | List found citation keys and exit (no fetching) |
|
|
41
48
|
| `--fresh` | Ignore existing output file and start from scratch |
|
|
49
|
+
| `--ads-api-key` | ADS API key (overrides `ADS_API_KEY` environment variable) |
|
|
42
50
|
|
|
43
51
|
### Examples
|
|
44
52
|
|
|
45
53
|
```bash
|
|
46
|
-
#
|
|
54
|
+
# Scan a directory
|
|
47
55
|
easybib ./paper -s inspire
|
|
48
56
|
|
|
57
|
+
# Scan a single file
|
|
58
|
+
easybib paper.tex
|
|
59
|
+
|
|
49
60
|
# Use a custom output file
|
|
50
61
|
easybib ./paper -o paper.bib
|
|
51
62
|
|
|
@@ -58,13 +69,19 @@ easybib ./paper -a 0
|
|
|
58
69
|
|
|
59
70
|
### ADS API key
|
|
60
71
|
|
|
61
|
-
When using ADS as the source (the default),
|
|
72
|
+
When using ADS as the source (the default), provide your API key either via the command line:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
easybib ./paper --ads-api-key your-key-here
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Or as an environment variable:
|
|
62
79
|
|
|
63
80
|
```bash
|
|
64
81
|
export ADS_API_KEY="your-key-here"
|
|
65
82
|
```
|
|
66
83
|
|
|
67
|
-
Get
|
|
84
|
+
Get a key from https://ui.adsabs.harvard.edu/user/settings/token.
|
|
68
85
|
|
|
69
86
|
## How it works
|
|
70
87
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
easybib/__init__.py,sha256=zCCoB5obi_21h_a_5LK-Zr4G3VkO6XF6Yft5J8pqruU,721
|
|
2
|
+
easybib/__main__.py,sha256=91xpHXOEBRWH-6SL2xquZoAsyDHasxiEPpCK62izpnU,90
|
|
3
|
+
easybib/cli.py,sha256=IBfiZaBgw_-ZqFiY_XzAeODipRdP6XnQJKyFkFRYFXo,4530
|
|
4
|
+
easybib/core.py,sha256=OvXeVF_jV3FZlrdtcztxlbU4tCnN0Voei3luJPe3V_8,10066
|
|
5
|
+
easybib-0.2.0.dist-info/METADATA,sha256=w9_tKSHjtc47nOBgNsDC8PK-6w1XURiHzGRh_Tm6uTY,2982
|
|
6
|
+
easybib-0.2.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
7
|
+
easybib-0.2.0.dist-info/entry_points.txt,sha256=IHBiLzF5bW19fQOGvK3e1LKnGcYIL81icdGsvrvZ_Zs,45
|
|
8
|
+
easybib-0.2.0.dist-info/top_level.txt,sha256=Xi0IA9fNmv68UPp2bZCEEIXiQYQy0NweD0J9iqZ-LdQ,8
|
|
9
|
+
easybib-0.2.0.dist-info/RECORD,,
|
easybib-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
easybib/__init__.py,sha256=zCCoB5obi_21h_a_5LK-Zr4G3VkO6XF6Yft5J8pqruU,721
|
|
2
|
-
easybib/__main__.py,sha256=91xpHXOEBRWH-6SL2xquZoAsyDHasxiEPpCK62izpnU,90
|
|
3
|
-
easybib/cli.py,sha256=nU6DC9IEyycbcjNd7hB7G4OBz4V7R12ETlQTlpdrBng,4237
|
|
4
|
-
easybib/core.py,sha256=OvXeVF_jV3FZlrdtcztxlbU4tCnN0Voei3luJPe3V_8,10066
|
|
5
|
-
easybib-0.1.0.dist-info/METADATA,sha256=Ia24a6a3E73u7LxTndNW9TIIkB3QxkGgIAMwbcbpdBc,2314
|
|
6
|
-
easybib-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
7
|
-
easybib-0.1.0.dist-info/entry_points.txt,sha256=IHBiLzF5bW19fQOGvK3e1LKnGcYIL81icdGsvrvZ_Zs,45
|
|
8
|
-
easybib-0.1.0.dist-info/top_level.txt,sha256=Xi0IA9fNmv68UPp2bZCEEIXiQYQy0NweD0J9iqZ-LdQ,8
|
|
9
|
-
easybib-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|