arxiv-to-prompt 0.3.0__py3-none-any.whl → 0.4.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.
- arxiv_to_prompt/cli.py +15 -3
- {arxiv_to_prompt-0.3.0.dist-info → arxiv_to_prompt-0.4.0.dist-info}/METADATA +2 -2
- arxiv_to_prompt-0.4.0.dist-info/RECORD +9 -0
- {arxiv_to_prompt-0.3.0.dist-info → arxiv_to_prompt-0.4.0.dist-info}/WHEEL +1 -1
- arxiv_to_prompt-0.3.0.dist-info/RECORD +0 -9
- {arxiv_to_prompt-0.3.0.dist-info → arxiv_to_prompt-0.4.0.dist-info}/entry_points.txt +0 -0
- {arxiv_to_prompt-0.3.0.dist-info → arxiv_to_prompt-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {arxiv_to_prompt-0.3.0.dist-info → arxiv_to_prompt-0.4.0.dist-info}/top_level.txt +0 -0
arxiv_to_prompt/cli.py
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import argparse
|
|
2
|
+
import re
|
|
2
3
|
from .core import process_latex_source, get_default_cache_dir
|
|
3
4
|
|
|
5
|
+
|
|
6
|
+
def extract_arxiv_id(input_str: str) -> str:
|
|
7
|
+
"""Extract arxiv ID from URL or return input as-is if already an ID."""
|
|
8
|
+
if "arxiv.org" in input_str:
|
|
9
|
+
match = re.search(r'arxiv\.org/(?:abs|pdf)/(\d{4}\.\d{4,5})(?:v\d+)?(?:\.pdf)?', input_str)
|
|
10
|
+
if match:
|
|
11
|
+
return match.group(1)
|
|
12
|
+
return input_str
|
|
13
|
+
|
|
4
14
|
def main():
|
|
5
15
|
default_cache = str(get_default_cache_dir())
|
|
6
16
|
|
|
@@ -11,7 +21,7 @@ def main():
|
|
|
11
21
|
"arxiv_id",
|
|
12
22
|
nargs="?",
|
|
13
23
|
default=None,
|
|
14
|
-
help="The arXiv ID
|
|
24
|
+
help="The arXiv ID (e.g. 2303.08774) or URL (e.g. https://arxiv.org/abs/2303.08774). Not needed if --local-folder is provided."
|
|
15
25
|
)
|
|
16
26
|
parser.add_argument(
|
|
17
27
|
"--no-comments",
|
|
@@ -44,9 +54,11 @@ def main():
|
|
|
44
54
|
|
|
45
55
|
if args.arxiv_id and args.local_folder:
|
|
46
56
|
parser.error("Cannot specify both arXiv ID and --local-folder")
|
|
47
|
-
|
|
57
|
+
|
|
58
|
+
arxiv_id = extract_arxiv_id(args.arxiv_id) if args.arxiv_id else None
|
|
59
|
+
|
|
48
60
|
content = process_latex_source(
|
|
49
|
-
arxiv_id=
|
|
61
|
+
arxiv_id=arxiv_id,
|
|
50
62
|
keep_comments=not args.no_comments,
|
|
51
63
|
cache_dir=args.cache_dir,
|
|
52
64
|
remove_appendix_section=args.no_appendix,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arxiv-to-prompt
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: transform arXiv papers into a single latex prompt for LLMs
|
|
5
5
|
Author: Takashi Ishida
|
|
6
6
|
License: MIT
|
|
@@ -61,7 +61,7 @@ arxiv-to-prompt 2303.08774 | pbcopy
|
|
|
61
61
|
arxiv-to-prompt 1706.03762 | llm -s "explain this paper"
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
You can use either the arXiv ID (e.g., `2303.08774`) or the full URL (e.g., `https://arxiv.org/abs/2303.08774`). It will automatically download the latest version of the paper, so you don't need to specify the version.
|
|
65
65
|
|
|
66
66
|
### Python API
|
|
67
67
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
arxiv_to_prompt/__init__.py,sha256=riK7TcTaKDleP5g5rjf2jkmLtXZu7irNZDujyAVDnKM,1093
|
|
2
|
+
arxiv_to_prompt/cli.py,sha256=np6mv2iCkLiVLawyix1vXP4bVFzRmZlkfjxb07ee89Q,2276
|
|
3
|
+
arxiv_to_prompt/core.py,sha256=pgb8PGiOqgbPTW5rIJwLlmS9n3nnlYa5UVQ5YSvCIuo,12077
|
|
4
|
+
arxiv_to_prompt-0.4.0.dist-info/licenses/LICENSE,sha256=np8L3--VyxwVJa_8D_mfK4RYrtnRMM_eeYN3rM4PMHo,1071
|
|
5
|
+
arxiv_to_prompt-0.4.0.dist-info/METADATA,sha256=_G2nwz5NSnKPMpS6UowWqCe2WSpJBjHqOMshmtGOdak,4598
|
|
6
|
+
arxiv_to_prompt-0.4.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
7
|
+
arxiv_to_prompt-0.4.0.dist-info/entry_points.txt,sha256=iYEEn8xZ_5OkhNIs5HCyHSQBpDRJkbD5h0tlAb16lL0,61
|
|
8
|
+
arxiv_to_prompt-0.4.0.dist-info/top_level.txt,sha256=JClbu_lGGWu3RaTHZlNqTKB1-DUSbYXQNIYmJ9_F7fY,16
|
|
9
|
+
arxiv_to_prompt-0.4.0.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
arxiv_to_prompt/__init__.py,sha256=riK7TcTaKDleP5g5rjf2jkmLtXZu7irNZDujyAVDnKM,1093
|
|
2
|
-
arxiv_to_prompt/cli.py,sha256=TUnHsGolF5zhiexW5RXBPhNL0HODmfppEkXzC8z65NE,1861
|
|
3
|
-
arxiv_to_prompt/core.py,sha256=pgb8PGiOqgbPTW5rIJwLlmS9n3nnlYa5UVQ5YSvCIuo,12077
|
|
4
|
-
arxiv_to_prompt-0.3.0.dist-info/licenses/LICENSE,sha256=np8L3--VyxwVJa_8D_mfK4RYrtnRMM_eeYN3rM4PMHo,1071
|
|
5
|
-
arxiv_to_prompt-0.3.0.dist-info/METADATA,sha256=CNOBI0du7Yj9Hyr6JElWhohvLgd4jLUvlZEn9c8NexU,4608
|
|
6
|
-
arxiv_to_prompt-0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
arxiv_to_prompt-0.3.0.dist-info/entry_points.txt,sha256=iYEEn8xZ_5OkhNIs5HCyHSQBpDRJkbD5h0tlAb16lL0,61
|
|
8
|
-
arxiv_to_prompt-0.3.0.dist-info/top_level.txt,sha256=JClbu_lGGWu3RaTHZlNqTKB1-DUSbYXQNIYmJ9_F7fY,16
|
|
9
|
-
arxiv_to_prompt-0.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|