Skip to content

Extracted Markdown converter to a separate package#3292

Open
mnocon wants to merge 1 commit into
5.0from
extract-llmstxt-shared-package
Open

Extracted Markdown converter to a separate package#3292
mnocon wants to merge 1 commit into
5.0from
extract-llmstxt-shared-package

Conversation

@mnocon

@mnocon mnocon commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Extracted the Markdown converter so that it can be reused in the user doc.

Follow-up to github.com//pull/3161
User doc PR: ibexa/documentation-user#414

@github-actions

Copy link
Copy Markdown

Preview of modified files: no change to preview.

Comment thread tools/llms_txt/hooks.py
@@ -0,0 +1,92 @@
"""

@mnocon mnocon Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from hooks.py with minimal changes

@@ -0,0 +1,550 @@
"""

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@github-actions

Copy link
Copy Markdown

Summary

Status Count
🔍 Total 761791
🔗 Unique 15026
✅ Successful 6426
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 755364
❓ Unknown 0
🚫 Errors 1
⛔ Unsupported 0

Errors per input

Errors in site/templating/twig_function_reference/recommendations_twig_functions/index.html

Full Github Actions output

Comment thread requirements.txt
mkdocs-autolinks-plugin==0.7.1
Jinja2==3.1.6
mkdocs-llmstxt
-e .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation from Claude for this change:

Prompt: Explain the "-e ." change

The -e . line in requirements.txt (requirements.txt:11 after the diff) tells pip: install the package defined by the pyproject.toml in this directory, in "editable" mode.

Here's why it's there:

Why a package install is needed at all

The refactor made hooks.py and friends into thin shims:

from llms_txt.hooks import on_config, on_page_content

For import llms_txt to work, Python needs llms_txt to be an installed package on sys.path — it's not enough for tools/llms_txt/ to just exist as a directory in the repo, because nothing adds tools/ to sys.path by default. The old code manually did sys.path.insert(0, ...); the new code relies on the package being properly installed instead.

pyproject.toml declares where that package physically lives:

[tool.setuptools]
package-dir = {"" = "tools"}
packages = ["llms_txt"]

So pip install . (run from the repo root, where pyproject.toml is — that's what the bare . means) installs the tools/llms_txt/ directory as the top-level importable module llms_txt.

Why -e (editable) instead of a plain install

A normal pip install . copies the package files into your Python environment's site-packages. If you then edit tools/llms_txt/hooks.py, your installed copy is stale until you reinstall.

pip install -e . instead installs a pointer back to tools/llms_txt/ in the repo. Editing the source is picked up immediately — no reinstall needed. That matters here because this is source code actively being edited (docs build hooks), not a third-party dependency.

Why it's in requirements.txt (not just requirements-dev.txt)

hooks.py is required for every mkdocs build, not just for running tests — so whatever installs dependencies for a real doc build (local, CI, ReadTheDocs) also needs llms_txt importable. Since requirements-dev.txt does -r requirements.txt, adding it to the base file covers both.

@@ -0,0 +1,131 @@
#!/usr/bin/env python3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@mnocon mnocon marked this pull request as ready for review July 15, 2026 14:58
@mnocon mnocon requested a review from a team July 15, 2026 14:59
@ibexa-workflow-automation-1 ibexa-workflow-automation-1 Bot requested review from adriendupuis, dabrt and julitafalcondusza and removed request for a team July 15, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant