Skip to content

Commit 1ee68fa

Browse files
authored
Merge pull request #11 from AnswerDotAI/no-nbdev
delete nbdev
2 parents 3e12f49 + c86a79a commit 1ee68fa

File tree

4 files changed

+93
-94
lines changed

4 files changed

+93
-94
lines changed

llms_txt/_modidx.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
'git_url': 'https://github.com/AnswerDotAI/llms-txt',
77
'lib_path': 'llms_txt'},
88
'syms': { 'llms_txt.core': { 'llms_txt.core._doc': ('core.html#_doc', 'llms_txt/core.py'),
9+
'llms_txt.core._get_config': ('core.html#_get_config', 'llms_txt/core.py'),
910
'llms_txt.core._local_docs_pth': ('core.html#_local_docs_pth', 'llms_txt/core.py'),
1011
'llms_txt.core._parse_links': ('core.html#_parse_links', 'llms_txt/core.py'),
1112
'llms_txt.core._parse_llms': ('core.html#_parse_llms', 'llms_txt/core.py'),

llms_txt/core.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from fastcore.script import *
1616
import httpx
1717
from urllib.parse import urlparse
18-
from nbdev.config import *
1918

2019
# %% ../nbs/01_core.ipynb
2120
def opt_re(s):
@@ -69,12 +68,12 @@ def parse_llms_file(txt):
6968
from fastcore.xml import Sections,Project,Doc
7069

7170
# %% ../nbs/01_core.ipynb
72-
def _local_docs_pth(cfg): return cfg.config_path/'_proc'/cfg.doc_path.name
71+
def _local_docs_pth(cfg): return cfg.config_path/'_proc'/cfg.doc_path
72+
def _get_config(): return Config.find('settings.ini')
7373

7474
def get_doc_content(url):
7575
"Fetch content from local file if in nbdev repo."
76-
cfg = get_config()
77-
if is_nbdev() and url.startswith(cfg.doc_host):
76+
if (cfg:=_get_config()) and url.startswith(cfg.doc_host):
7877
relative_path = urlparse(url).path.lstrip('/')
7978
local_path = _local_docs_pth(cfg) / relative_path
8079
if local_path.exists(): return local_path.read_text()
@@ -124,7 +123,6 @@ def llms_txt2ctx(
124123
):
125124
"Print a `Project` with a `Section` for each H2 part in file read from `fname`, optionally skipping the 'optional' section."
126125
ctx = create_ctx(Path(fname).read_text(), optional=optional, n_workers=n_workers)
127-
if save_nbdev_fname:
128-
cfg = get_config()
126+
if save_nbdev_fname and (cfg:=_get_config()):
129127
(_local_docs_pth(cfg) / save_nbdev_fname).mk_write(ctx)
130128
else: print(ctx)

0 commit comments

Comments
 (0)