Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ jobs:
working-directory: ./inference_repo

- name: Build block docs
env:
LOAD_ENTERPRISE_BLOCKS: "TRUE"
run: python -m development.docs.build_block_docs
working-directory: ./inference_repo

Expand Down
14 changes: 11 additions & 3 deletions development/docs/build_block_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,17 @@ def _escape_jinja2_dollar_expression(match: re.Match) -> str:

def get_source_link_for_block_class(block_class: Type[WorkflowBlock]) -> str:
try:
filename = inspect.getfile(block_class).split("inference/core/workflows/")[1]
return f"https://github.com/roboflow/inference/blob/main/inference/core/workflows/{filename}"
except Exception as e:
filepath = inspect.getfile(block_class)
# Resolve the path relative to the `inference` package root so that both
# core blocks (inference/core/workflows/...) and enterprise blocks
# (inference/enterprise/workflows/...) produce valid links.
marker = f"{os.sep}inference{os.sep}"
idx = filepath.rfind(marker)
if idx == -1:
return None
relative_path = filepath[idx + 1 :].replace(os.sep, "/")
return f"https://github.com/roboflow/inference/blob/main/{relative_path}"
except Exception:
return None

def get_auto_generation_markers(
Expand Down