arxiv-to-prompt 0.1.0__py3-none-any.whl → 0.1.1__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/core.py +31 -1
- {arxiv_to_prompt-0.1.0.dist-info → arxiv_to_prompt-0.1.1.dist-info}/METADATA +6 -31
- arxiv_to_prompt-0.1.1.dist-info/RECORD +9 -0
- {arxiv_to_prompt-0.1.0.dist-info → arxiv_to_prompt-0.1.1.dist-info}/WHEEL +1 -1
- arxiv_to_prompt-0.1.0.dist-info/RECORD +0 -9
- {arxiv_to_prompt-0.1.0.dist-info → arxiv_to_prompt-0.1.1.dist-info}/LICENSE +0 -0
- {arxiv_to_prompt-0.1.0.dist-info → arxiv_to_prompt-0.1.1.dist-info}/entry_points.txt +0 -0
- {arxiv_to_prompt-0.1.0.dist-info → arxiv_to_prompt-0.1.1.dist-info}/top_level.txt +0 -0
arxiv_to_prompt/core.py
CHANGED
|
@@ -151,8 +151,38 @@ def flatten_tex(directory: str, main_file: str) -> str:
|
|
|
151
151
|
with open(file_path, 'r', encoding='utf-8') as f:
|
|
152
152
|
content = f.read()
|
|
153
153
|
|
|
154
|
-
# Process \input and \include commands
|
|
154
|
+
# Process \input and \include commands that are not commented out
|
|
155
155
|
def replace_input(match):
|
|
156
|
+
# Check if the match is preceded by a comment character
|
|
157
|
+
line_start = content.rfind('\n', 0, match.start()) + 1
|
|
158
|
+
line_prefix = content[line_start:match.start()]
|
|
159
|
+
|
|
160
|
+
# If there's a % character in the line prefix that's not escaped,
|
|
161
|
+
# this command is commented out, so return the original text
|
|
162
|
+
comment_pos = -1
|
|
163
|
+
i = 0
|
|
164
|
+
while i < len(line_prefix):
|
|
165
|
+
if line_prefix[i] == '%':
|
|
166
|
+
# Check if the % is escaped with a backslash
|
|
167
|
+
if i > 0 and line_prefix[i-1] == '\\':
|
|
168
|
+
# Count backslashes before %
|
|
169
|
+
backslash_count = 0
|
|
170
|
+
j = i - 1
|
|
171
|
+
while j >= 0 and line_prefix[j] == '\\':
|
|
172
|
+
backslash_count += 1
|
|
173
|
+
j -= 1
|
|
174
|
+
# If odd number of backslashes, % is escaped
|
|
175
|
+
if backslash_count % 2 == 1:
|
|
176
|
+
i += 1
|
|
177
|
+
continue
|
|
178
|
+
comment_pos = i
|
|
179
|
+
break
|
|
180
|
+
i += 1
|
|
181
|
+
|
|
182
|
+
if comment_pos != -1:
|
|
183
|
+
return match.group(0) # Return the original text without processing
|
|
184
|
+
|
|
185
|
+
# Process the command normally
|
|
156
186
|
input_file = match.group(1)
|
|
157
187
|
if not input_file.endswith('.tex'):
|
|
158
188
|
input_file += '.tex'
|
|
@@ -1,41 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: arxiv-to-prompt
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: transform arXiv papers into a single latex prompt for LLMs
|
|
5
5
|
Author: Takashi Ishida
|
|
6
|
-
License: MIT
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2025 Takashi Ishida
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
|
|
6
|
+
License: MIT
|
|
28
7
|
Project-URL: Homepage, https://github.com/takashiishida/arxiv-to-prompt
|
|
29
8
|
Project-URL: Changelog, https://github.com/takashiishida/arxiv-to-prompt/releases
|
|
30
9
|
Project-URL: Issues, https://github.com/takashiishida/arxiv-to-prompt/issues
|
|
31
10
|
Project-URL: CI, https://github.com/takashiishida/arxiv-to-prompt/actions
|
|
32
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
33
|
-
Classifier: Programming Language :: Python :: 3
|
|
34
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
35
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
36
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
-
Classifier: Operating System :: OS Independent
|
|
39
11
|
Requires-Python: >=3.8
|
|
40
12
|
Description-Content-Type: text/markdown
|
|
41
13
|
License-File: LICENSE
|
|
@@ -46,7 +18,7 @@ Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
|
46
18
|
|
|
47
19
|
# arxiv-to-prompt
|
|
48
20
|
|
|
49
|
-
[](https://pypi.org/project/arxiv-to-prompt/)
|
|
21
|
+
[](https://pypi.org/project/arxiv-to-prompt/)
|
|
50
22
|
[](https://github.com/takashiishida/arxiv-to-prompt/actions)
|
|
51
23
|
[](https://opensource.org/licenses/MIT)
|
|
52
24
|
[](https://github.com/takashiishida/arxiv-to-prompt/releases)
|
|
@@ -71,6 +43,9 @@ arxiv-to-prompt 2303.08774 --no-comments
|
|
|
71
43
|
|
|
72
44
|
# Copy to clipboard
|
|
73
45
|
arxiv-to-prompt 2303.08774 | pbcopy
|
|
46
|
+
|
|
47
|
+
# Combine with the `llm` library from https://github.com/simonw/llm to chat about the paper
|
|
48
|
+
arxiv-to-prompt 1706.03762 | llm -s "explain this paper"
|
|
74
49
|
```
|
|
75
50
|
|
|
76
51
|
The arXiv ID can be found in the paper's URL. For example, for `https://arxiv.org/abs/2303.08774`, the ID is `2303.08774`. It will automatically download the latest version of the paper, so you don't need to specify the version.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
arxiv_to_prompt/__init__.py,sha256=oL2bEzZhiFoMqCF-84Xmljqw55lgRkwInBFpExRPCTY,609
|
|
2
|
+
arxiv_to_prompt/cli.py,sha256=WafgKxxpgJrLyeuQ-tnUASoknoNXiaQRWLP-Emsr-ug,977
|
|
3
|
+
arxiv_to_prompt/core.py,sha256=UOFbivdGx470Myh5wzq4SVzh0AOPFldU3thBmwfsd6g,9802
|
|
4
|
+
arxiv_to_prompt-0.1.1.dist-info/LICENSE,sha256=np8L3--VyxwVJa_8D_mfK4RYrtnRMM_eeYN3rM4PMHo,1071
|
|
5
|
+
arxiv_to_prompt-0.1.1.dist-info/METADATA,sha256=IKVSFdYmNdt-YUHA3JBltJsOvLCkxyd90d4_gbcf2ok,2920
|
|
6
|
+
arxiv_to_prompt-0.1.1.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
7
|
+
arxiv_to_prompt-0.1.1.dist-info/entry_points.txt,sha256=iYEEn8xZ_5OkhNIs5HCyHSQBpDRJkbD5h0tlAb16lL0,61
|
|
8
|
+
arxiv_to_prompt-0.1.1.dist-info/top_level.txt,sha256=JClbu_lGGWu3RaTHZlNqTKB1-DUSbYXQNIYmJ9_F7fY,16
|
|
9
|
+
arxiv_to_prompt-0.1.1.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
arxiv_to_prompt/__init__.py,sha256=oL2bEzZhiFoMqCF-84Xmljqw55lgRkwInBFpExRPCTY,609
|
|
2
|
-
arxiv_to_prompt/cli.py,sha256=WafgKxxpgJrLyeuQ-tnUASoknoNXiaQRWLP-Emsr-ug,977
|
|
3
|
-
arxiv_to_prompt/core.py,sha256=cQcMNQJSrRVQAQsy2ULeLVlQlKIDDdgVLHFKJNMR0Sg,8296
|
|
4
|
-
arxiv_to_prompt-0.1.0.dist-info/LICENSE,sha256=np8L3--VyxwVJa_8D_mfK4RYrtnRMM_eeYN3rM4PMHo,1071
|
|
5
|
-
arxiv_to_prompt-0.1.0.dist-info/METADATA,sha256=H8T6HFkP199SK19Jy66MgrVE2S8kTBr-2yYzC9qpQBs,4338
|
|
6
|
-
arxiv_to_prompt-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
7
|
-
arxiv_to_prompt-0.1.0.dist-info/entry_points.txt,sha256=iYEEn8xZ_5OkhNIs5HCyHSQBpDRJkbD5h0tlAb16lL0,61
|
|
8
|
-
arxiv_to_prompt-0.1.0.dist-info/top_level.txt,sha256=JClbu_lGGWu3RaTHZlNqTKB1-DUSbYXQNIYmJ9_F7fY,16
|
|
9
|
-
arxiv_to_prompt-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|