builtsimple-jupyter 1.0.0__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.
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: builtsimple-jupyter
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Jupyter magic commands for PubMed, ArXiv, Wikipedia search
|
|
5
|
+
Project-URL: Repository, https://github.com/Built-Simple/jupyter-builtsimple
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Dist: httpx>=0.24.0
|
|
8
|
+
Requires-Dist: ipython>=7.0.0
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# builtsimple-jupyter
|
|
12
|
+
|
|
13
|
+
Jupyter magic commands for searching PubMed, ArXiv, and Wikipedia.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install builtsimple-jupyter
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
# Load the extension
|
|
25
|
+
%load_ext builtsimple_jupyter
|
|
26
|
+
|
|
27
|
+
# Search individual sources
|
|
28
|
+
%pubmed cancer treatment
|
|
29
|
+
%arxiv transformer attention
|
|
30
|
+
%wiki machine learning
|
|
31
|
+
|
|
32
|
+
# Search all sources
|
|
33
|
+
%research neural networks
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Powered By
|
|
37
|
+
|
|
38
|
+
[Built-Simple.ai](https://built-simple.ai) Research APIs
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# builtsimple-jupyter
|
|
2
|
+
|
|
3
|
+
Jupyter magic commands for searching PubMed, ArXiv, and Wikipedia.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install builtsimple-jupyter
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
# Load the extension
|
|
15
|
+
%load_ext builtsimple_jupyter
|
|
16
|
+
|
|
17
|
+
# Search individual sources
|
|
18
|
+
%pubmed cancer treatment
|
|
19
|
+
%arxiv transformer attention
|
|
20
|
+
%wiki machine learning
|
|
21
|
+
|
|
22
|
+
# Search all sources
|
|
23
|
+
%research neural networks
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Powered By
|
|
27
|
+
|
|
28
|
+
[Built-Simple.ai](https://built-simple.ai) Research APIs
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Built Simple Research - Jupyter Magic Commands"""
|
|
2
|
+
from IPython.core.magic import register_line_magic, register_cell_magic
|
|
3
|
+
from IPython.display import display, HTML, Markdown
|
|
4
|
+
import httpx
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
def _search_pubmed(query, limit=5):
|
|
8
|
+
r = httpx.post("https://pubmed.built-simple.ai/search",
|
|
9
|
+
json={"query": query, "limit": limit})
|
|
10
|
+
return r.json().get("results", [])
|
|
11
|
+
|
|
12
|
+
def _search_arxiv(query, limit=5):
|
|
13
|
+
r = httpx.get(f"https://arxiv.built-simple.ai/api/search",
|
|
14
|
+
params={"q": query, "limit": limit})
|
|
15
|
+
return r.json().get("results", [])
|
|
16
|
+
|
|
17
|
+
def _search_wikipedia(query, limit=5):
|
|
18
|
+
r = httpx.post("https://wikipedia.built-simple.ai/api/search",
|
|
19
|
+
json={"query": query, "limit": limit})
|
|
20
|
+
return r.json().get("results", [])
|
|
21
|
+
|
|
22
|
+
def _format_results(results, source):
|
|
23
|
+
html = f"<h4>{source}</h4><ul>"
|
|
24
|
+
for r in results:
|
|
25
|
+
title = r.get("title", "Untitled")
|
|
26
|
+
url = r.get("url") or r.get("link", "#")
|
|
27
|
+
html += f'<li><a href="{url}" target="_blank">{title}</a></li>'
|
|
28
|
+
return html + "</ul>"
|
|
29
|
+
|
|
30
|
+
@register_line_magic
|
|
31
|
+
def pubmed(query):
|
|
32
|
+
"""Search PubMed: %pubmed cancer treatment"""
|
|
33
|
+
results = _search_pubmed(query)
|
|
34
|
+
display(HTML(_format_results(results, "PubMed")))
|
|
35
|
+
|
|
36
|
+
@register_line_magic
|
|
37
|
+
def arxiv(query):
|
|
38
|
+
"""Search ArXiv: %arxiv transformer attention"""
|
|
39
|
+
results = _search_arxiv(query)
|
|
40
|
+
display(HTML(_format_results(results, "ArXiv")))
|
|
41
|
+
|
|
42
|
+
@register_line_magic
|
|
43
|
+
def wiki(query):
|
|
44
|
+
"""Search Wikipedia: %wiki machine learning"""
|
|
45
|
+
results = _search_wikipedia(query)
|
|
46
|
+
display(HTML(_format_results(results, "Wikipedia")))
|
|
47
|
+
|
|
48
|
+
@register_line_magic
|
|
49
|
+
def research(query):
|
|
50
|
+
"""Search all: %research neural networks"""
|
|
51
|
+
pubmed_r = _search_pubmed(query, 3)
|
|
52
|
+
arxiv_r = _search_arxiv(query, 3)
|
|
53
|
+
wiki_r = _search_wikipedia(query, 3)
|
|
54
|
+
|
|
55
|
+
html = f"<h3>Research: {query}</h3>"
|
|
56
|
+
html += _format_results(pubmed_r, "PubMed")
|
|
57
|
+
html += _format_results(arxiv_r, "ArXiv")
|
|
58
|
+
html += _format_results(wiki_r, "Wikipedia")
|
|
59
|
+
display(HTML(html))
|
|
60
|
+
|
|
61
|
+
def load_ipython_extension(ipython):
|
|
62
|
+
pass # Magics are registered automatically
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "builtsimple-jupyter"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Jupyter magic commands for PubMed, ArXiv, Wikipedia search"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
dependencies = ["httpx>=0.24.0", "ipython>=7.0.0"]
|
|
12
|
+
|
|
13
|
+
[project.urls]
|
|
14
|
+
Repository = "https://github.com/Built-Simple/jupyter-builtsimple"
|