paperscraper 0.2.12__tar.gz → 0.2.13__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.
Files changed (43) hide show
  1. {paperscraper-0.2.12 → paperscraper-0.2.13}/PKG-INFO +16 -7
  2. {paperscraper-0.2.12 → paperscraper-0.2.13}/README.md +13 -4
  3. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/__init__.py +1 -1
  4. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/scholar/scholar.py +12 -6
  5. paperscraper-0.2.13/paperscraper/scholar/tests/test_scholar.py +60 -0
  6. paperscraper-0.2.13/paperscraper/tests/__init__.py +0 -0
  7. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper.egg-info/PKG-INFO +16 -7
  8. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper.egg-info/SOURCES.txt +2 -0
  9. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper.egg-info/requires.txt +1 -1
  10. {paperscraper-0.2.12 → paperscraper-0.2.13}/setup.py +3 -2
  11. {paperscraper-0.2.12 → paperscraper-0.2.13}/LICENSE +0 -0
  12. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/arxiv/__init__.py +0 -0
  13. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/arxiv/arxiv.py +0 -0
  14. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/arxiv/utils.py +0 -0
  15. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/get_dumps/__init__.py +0 -0
  16. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/get_dumps/biorxiv.py +0 -0
  17. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/get_dumps/chemrxiv.py +0 -0
  18. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/get_dumps/medrxiv.py +0 -0
  19. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/get_dumps/utils/__init__.py +0 -0
  20. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/get_dumps/utils/chemrxiv/__init__.py +0 -0
  21. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/get_dumps/utils/chemrxiv/chemrxiv_api.py +0 -0
  22. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/get_dumps/utils/chemrxiv/utils.py +0 -0
  23. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/impact.py +0 -0
  24. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/load_dumps.py +0 -0
  25. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/pdf.py +0 -0
  26. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/plotting.py +0 -0
  27. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/postprocessing.py +0 -0
  28. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/pubmed/__init__.py +0 -0
  29. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/pubmed/pubmed.py +0 -0
  30. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/pubmed/utils.py +0 -0
  31. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/scholar/__init__.py +0 -0
  32. {paperscraper-0.2.12/paperscraper → paperscraper-0.2.13/paperscraper/scholar}/tests/__init__.py +0 -0
  33. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/server_dumps/__init__.py +0 -0
  34. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/tests/test_dumpy.py +0 -0
  35. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/tests/test_impactor.py +0 -0
  36. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/utils.py +0 -0
  37. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/xrxiv/__init__.py +0 -0
  38. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/xrxiv/xrxiv_api.py +0 -0
  39. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper/xrxiv/xrxiv_query.py +0 -0
  40. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper.egg-info/dependency_links.txt +0 -0
  41. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper.egg-info/not-zip-safe +0 -0
  42. {paperscraper-0.2.12 → paperscraper-0.2.13}/paperscraper.egg-info/top_level.txt +0 -0
  43. {paperscraper-0.2.12 → paperscraper-0.2.13}/setup.cfg +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: paperscraper
3
- Version: 0.2.12
3
+ Version: 0.2.13
4
4
  Summary: paperscraper: Package to scrape papers.
5
- Home-page: https://github.com/PhosphorylatedRabbits/paperscraper
5
+ Home-page: https://github.com/jannisborn/paperscraper
6
6
  Author: Jannis Born, Matteo Manica
7
7
  Author-email: jannis.born@gmx.de, drugilsberg@gmail.com
8
8
  License: MIT
@@ -22,7 +22,7 @@ Requires-Dist: pymed
22
22
  Requires-Dist: pandas
23
23
  Requires-Dist: requests
24
24
  Requires-Dist: tqdm
25
- Requires-Dist: scholarly==0.5.1
25
+ Requires-Dist: scholarly>=1.0.0
26
26
  Requires-Dist: seaborn
27
27
  Requires-Dist: matplotlib
28
28
  Requires-Dist: matplotlib_venn
@@ -32,8 +32,8 @@ Requires-Dist: thefuzz
32
32
  Requires-Dist: pytest
33
33
 
34
34
 
35
- [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml/badge.svg)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml)
36
- [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml/badge.svg)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml)
35
+ [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml/badge.svg?branch=main)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml?query=branch%3Amain)
36
+ [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml/badge.svg?branch=main)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml?query=branch%3Amain)
37
37
  [![License:
38
38
  MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
39
39
  [![PyPI version](https://badge.fury.io/py/paperscraper.svg)](https://badge.fury.io/py/paperscraper)
@@ -70,9 +70,9 @@ biorxiv() # Takes ~1h and should result in ~350 MB file
70
70
  chemrxiv() # Takes ~45min and should result in ~20 MB file
71
71
  ```
72
72
  *NOTE*: Once the dumps are stored, please make sure to restart the python interpreter so that the changes take effect.
73
- *NOTE*: If you experience API connection issues (`ConnectionError`), since v0.2.12 there are automatic retries which you can even control and raise from the default of 10, as in `biorxiv(max_retries=20)`, thanks to [@memray](https://github.com/memray) for contributions!
73
+ *NOTE*: If you experience API connection issues (`ConnectionError`), since v0.2.12 there are automatic retries which you can even control and raise from the default of 10, as in `biorxiv(max_retries=20)`.
74
74
 
75
- Since v0.2.5 `paperscraper` also allows to scrape {med/bio/chem}rxiv for specific dates! Thanks to [@achouhan93 ](https://github.com/achouhan93 ) for contributions!
75
+ Since v0.2.5 `paperscraper` also allows to scrape {med/bio/chem}rxiv for specific dates.
76
76
  ```py
77
77
  medrxiv(begin_date="2023-04-01", end_date="2023-04-08")
78
78
  ```
@@ -350,3 +350,12 @@ If you use `paperscraper`, please cite the papers that motivated our development
350
350
  author = {Jannis Born and David Beymer and Deepta Rajan and Adam Coy and Vandana V. Mukherjee and Matteo Manica and Prasanth Prasanna and Deddeh Ballah and Michal Guindy and Dorith Shaham and Pallav L. Shah and Emmanouil Karteris and Jan L. Robertus and Maria Gabrani and Michal Rosen-Zvi}
351
351
  }
352
352
  ```
353
+
354
+ ## Contributions
355
+ Thanks to the following contributors:
356
+ - @memray: Since `v0.2.12` there are automatic retries when downloading the {med/bio/chem}rxiv dumps.
357
+ - @achouhan93: Since `v0.2.5` {med/bio/chem}rxiv can be scraped for specific dates!
358
+ - @daenuprobst: Since `v0.2.4` PDF files can be scraped directly (`paperscraper.pdf.save_pdf`)
359
+ - @oppih: Since `v0.2.3` chemRxiv API also provides DOI and URL if available
360
+ - @lukasschwab: Bumped `arxiv` dependency to >`1.4.2` in paperscraper `v0.1.0`.
361
+ - @juliusbierk: Bugfixes
@@ -1,6 +1,6 @@
1
1
 
2
- [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml/badge.svg)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml)
3
- [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml/badge.svg)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml)
2
+ [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml/badge.svg?branch=main)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml?query=branch%3Amain)
3
+ [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml/badge.svg?branch=main)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml?query=branch%3Amain)
4
4
  [![License:
5
5
  MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
  [![PyPI version](https://badge.fury.io/py/paperscraper.svg)](https://badge.fury.io/py/paperscraper)
@@ -37,9 +37,9 @@ biorxiv() # Takes ~1h and should result in ~350 MB file
37
37
  chemrxiv() # Takes ~45min and should result in ~20 MB file
38
38
  ```
39
39
  *NOTE*: Once the dumps are stored, please make sure to restart the python interpreter so that the changes take effect.
40
- *NOTE*: If you experience API connection issues (`ConnectionError`), since v0.2.12 there are automatic retries which you can even control and raise from the default of 10, as in `biorxiv(max_retries=20)`, thanks to [@memray](https://github.com/memray) for contributions!
40
+ *NOTE*: If you experience API connection issues (`ConnectionError`), since v0.2.12 there are automatic retries which you can even control and raise from the default of 10, as in `biorxiv(max_retries=20)`.
41
41
 
42
- Since v0.2.5 `paperscraper` also allows to scrape {med/bio/chem}rxiv for specific dates! Thanks to [@achouhan93 ](https://github.com/achouhan93 ) for contributions!
42
+ Since v0.2.5 `paperscraper` also allows to scrape {med/bio/chem}rxiv for specific dates.
43
43
  ```py
44
44
  medrxiv(begin_date="2023-04-01", end_date="2023-04-08")
45
45
  ```
@@ -317,3 +317,12 @@ If you use `paperscraper`, please cite the papers that motivated our development
317
317
  author = {Jannis Born and David Beymer and Deepta Rajan and Adam Coy and Vandana V. Mukherjee and Matteo Manica and Prasanth Prasanna and Deddeh Ballah and Michal Guindy and Dorith Shaham and Pallav L. Shah and Emmanouil Karteris and Jan L. Robertus and Maria Gabrani and Michal Rosen-Zvi}
318
318
  }
319
319
  ```
320
+
321
+ ## Contributions
322
+ Thanks to the following contributors:
323
+ - @memray: Since `v0.2.12` there are automatic retries when downloading the {med/bio/chem}rxiv dumps.
324
+ - @achouhan93: Since `v0.2.5` {med/bio/chem}rxiv can be scraped for specific dates!
325
+ - @daenuprobst: Since `v0.2.4` PDF files can be scraped directly (`paperscraper.pdf.save_pdf`)
326
+ - @oppih: Since `v0.2.3` chemRxiv API also provides DOI and URL if available
327
+ - @lukasschwab: Bumped `arxiv` dependency to >`1.4.2` in paperscraper `v0.1.0`.
328
+ - @juliusbierk: Bugfixes
@@ -1,7 +1,7 @@
1
1
  """Initialize the module."""
2
2
 
3
3
  __name__ = "paperscraper"
4
- __version__ = "0.2.12"
4
+ __version__ = "0.2.13"
5
5
 
6
6
  import logging
7
7
  import os
@@ -15,6 +15,7 @@ scholar_field_mapper = {
15
15
  "venue": "journal",
16
16
  "author": "authors",
17
17
  "cites": "citations",
18
+ "pub_year": "year",
18
19
  }
19
20
  process_fields = {"year": lambda x: int(x) if x.isdigit() else -1, "citations": int}
20
21
 
@@ -46,16 +47,21 @@ def get_scholar_papers(
46
47
 
47
48
  matches = scholarly.search_pubs(title)
48
49
 
49
- processed = [
50
- {
50
+ processed = []
51
+ for paper in matches:
52
+
53
+ # Extracts title, author, year, journal, abstract
54
+ entry = {
51
55
  scholar_field_mapper.get(key, key): process_fields.get(
52
56
  scholar_field_mapper.get(key, key), lambda x: x
53
57
  )(value)
54
- for key, value in paper.bib.items()
58
+ for key, value in paper["bib"].items()
55
59
  if scholar_field_mapper.get(key, key) in fields
56
60
  }
57
- for paper in matches
58
- ]
61
+
62
+ entry["citations"] = paper["num_citations"]
63
+ processed.append(entry)
64
+
59
65
  return pd.DataFrame(processed)
60
66
 
61
67
 
@@ -99,7 +105,7 @@ def get_citations_from_title(title: str) -> int:
99
105
  title = '"' + title.strip() + '"'
100
106
 
101
107
  matches = scholarly.search_pubs(title)
102
- counts = list(map(lambda p: int(p.bib["cites"]), matches))
108
+ counts = list(map(lambda p: int(p["num_citations"]), matches))
103
109
  if len(counts) == 0:
104
110
  logger.warning(f"Found no match for {title}.")
105
111
  return 0
@@ -0,0 +1,60 @@
1
+ import logging
2
+ import pandas as pd
3
+ import pytest
4
+ from scholarly._proxy_generator import MaxTriesExceededException
5
+ import functools
6
+
7
+ from paperscraper.scholar import (
8
+ get_and_dump_scholar_papers,
9
+ get_citations_from_title,
10
+ get_scholar_papers,
11
+ )
12
+
13
+ logging.disable(logging.INFO)
14
+
15
+
16
+ def handle_scholar_exception(func):
17
+ @functools.wraps(func)
18
+ def wrapper(*args, **kwargs):
19
+ try:
20
+ return func(*args, **kwargs)
21
+ except MaxTriesExceededException as e:
22
+ logging.info(f"MaxTriesExceededException caught: {e}")
23
+ pytest.skip("Skipping test due to MaxTriesExceededException")
24
+
25
+ return wrapper
26
+
27
+
28
+ class TestScholar:
29
+
30
+ @handle_scholar_exception
31
+ def test_citations(self):
32
+ num = get_citations_from_title("GT4SD")
33
+ assert isinstance(num, int)
34
+ assert num > 0
35
+
36
+ @handle_scholar_exception
37
+ def test_dump_search(self, tmpdir):
38
+ temp_dir = tmpdir.mkdir("scholar_papers")
39
+ output_filepath = temp_dir.join("results.jsonl")
40
+ get_and_dump_scholar_papers("GT4SD", str(output_filepath))
41
+ assert output_filepath.check(file=1)
42
+
43
+ @handle_scholar_exception
44
+ def test_basic_search(self):
45
+ results = get_scholar_papers("GT4SD")
46
+ assert len(results) > 0 # Ensure we get some results
47
+ assert isinstance(results, pd.DataFrame)
48
+ assert all(
49
+ [
50
+ x in results.columns
51
+ for x in [
52
+ "title",
53
+ "abstract",
54
+ "citations",
55
+ "year",
56
+ "authors",
57
+ "journal",
58
+ ]
59
+ ]
60
+ )
File without changes
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: paperscraper
3
- Version: 0.2.12
3
+ Version: 0.2.13
4
4
  Summary: paperscraper: Package to scrape papers.
5
- Home-page: https://github.com/PhosphorylatedRabbits/paperscraper
5
+ Home-page: https://github.com/jannisborn/paperscraper
6
6
  Author: Jannis Born, Matteo Manica
7
7
  Author-email: jannis.born@gmx.de, drugilsberg@gmail.com
8
8
  License: MIT
@@ -22,7 +22,7 @@ Requires-Dist: pymed
22
22
  Requires-Dist: pandas
23
23
  Requires-Dist: requests
24
24
  Requires-Dist: tqdm
25
- Requires-Dist: scholarly==0.5.1
25
+ Requires-Dist: scholarly>=1.0.0
26
26
  Requires-Dist: seaborn
27
27
  Requires-Dist: matplotlib
28
28
  Requires-Dist: matplotlib_venn
@@ -32,8 +32,8 @@ Requires-Dist: thefuzz
32
32
  Requires-Dist: pytest
33
33
 
34
34
 
35
- [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml/badge.svg)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml)
36
- [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml/badge.svg)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml)
35
+ [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml/badge.svg?branch=main)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_tip.yml?query=branch%3Amain)
36
+ [![build](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml/badge.svg?branch=main)](https://github.com/PhosphorylatedRabbits/paperscraper/actions/workflows/test_pypi.yml?query=branch%3Amain)
37
37
  [![License:
38
38
  MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
39
39
  [![PyPI version](https://badge.fury.io/py/paperscraper.svg)](https://badge.fury.io/py/paperscraper)
@@ -70,9 +70,9 @@ biorxiv() # Takes ~1h and should result in ~350 MB file
70
70
  chemrxiv() # Takes ~45min and should result in ~20 MB file
71
71
  ```
72
72
  *NOTE*: Once the dumps are stored, please make sure to restart the python interpreter so that the changes take effect.
73
- *NOTE*: If you experience API connection issues (`ConnectionError`), since v0.2.12 there are automatic retries which you can even control and raise from the default of 10, as in `biorxiv(max_retries=20)`, thanks to [@memray](https://github.com/memray) for contributions!
73
+ *NOTE*: If you experience API connection issues (`ConnectionError`), since v0.2.12 there are automatic retries which you can even control and raise from the default of 10, as in `biorxiv(max_retries=20)`.
74
74
 
75
- Since v0.2.5 `paperscraper` also allows to scrape {med/bio/chem}rxiv for specific dates! Thanks to [@achouhan93 ](https://github.com/achouhan93 ) for contributions!
75
+ Since v0.2.5 `paperscraper` also allows to scrape {med/bio/chem}rxiv for specific dates.
76
76
  ```py
77
77
  medrxiv(begin_date="2023-04-01", end_date="2023-04-08")
78
78
  ```
@@ -350,3 +350,12 @@ If you use `paperscraper`, please cite the papers that motivated our development
350
350
  author = {Jannis Born and David Beymer and Deepta Rajan and Adam Coy and Vandana V. Mukherjee and Matteo Manica and Prasanth Prasanna and Deddeh Ballah and Michal Guindy and Dorith Shaham and Pallav L. Shah and Emmanouil Karteris and Jan L. Robertus and Maria Gabrani and Michal Rosen-Zvi}
351
351
  }
352
352
  ```
353
+
354
+ ## Contributions
355
+ Thanks to the following contributors:
356
+ - @memray: Since `v0.2.12` there are automatic retries when downloading the {med/bio/chem}rxiv dumps.
357
+ - @achouhan93: Since `v0.2.5` {med/bio/chem}rxiv can be scraped for specific dates!
358
+ - @daenuprobst: Since `v0.2.4` PDF files can be scraped directly (`paperscraper.pdf.save_pdf`)
359
+ - @oppih: Since `v0.2.3` chemRxiv API also provides DOI and URL if available
360
+ - @lukasschwab: Bumped `arxiv` dependency to >`1.4.2` in paperscraper `v0.1.0`.
361
+ - @juliusbierk: Bugfixes
@@ -30,6 +30,8 @@ paperscraper/pubmed/pubmed.py
30
30
  paperscraper/pubmed/utils.py
31
31
  paperscraper/scholar/__init__.py
32
32
  paperscraper/scholar/scholar.py
33
+ paperscraper/scholar/tests/__init__.py
34
+ paperscraper/scholar/tests/test_scholar.py
33
35
  paperscraper/server_dumps/__init__.py
34
36
  paperscraper/tests/__init__.py
35
37
  paperscraper/tests/test_dumpy.py
@@ -3,7 +3,7 @@ pymed
3
3
  pandas
4
4
  requests
5
5
  tqdm
6
- scholarly==0.5.1
6
+ scholarly>=1.0.0
7
7
  seaborn
8
8
  matplotlib
9
9
  matplotlib_venn
@@ -1,4 +1,5 @@
1
1
  """Install package."""
2
+
2
3
  import io
3
4
  import os
4
5
  import re
@@ -23,7 +24,7 @@ setup(
23
24
  long_description_content_type="text/markdown",
24
25
  author="Jannis Born, Matteo Manica",
25
26
  author_email=("jannis.born@gmx.de, drugilsberg@gmail.com"),
26
- url="https://github.com/PhosphorylatedRabbits/paperscraper",
27
+ url="https://github.com/jannisborn/paperscraper",
27
28
  license="MIT",
28
29
  install_requires=[
29
30
  "arxiv>=1.4.2",
@@ -31,7 +32,7 @@ setup(
31
32
  "pandas",
32
33
  "requests",
33
34
  "tqdm",
34
- "scholarly==0.5.1",
35
+ "scholarly>=1.0.0",
35
36
  "seaborn",
36
37
  "matplotlib",
37
38
  "matplotlib_venn",
File without changes
File without changes