Skip to content

Skip API reference generation for non-Python projects - #264

Merged
has2k1 merged 1 commit into
posit-dev:mainfrom
jeroenjanssens:fix-api-reference-non-python
Jul 17, 2026
Merged

Skip API reference generation for non-Python projects#264
has2k1 merged 1 commit into
posit-dev:mainfrom
jeroenjanssens:fix-api-reference-non-python

Conversation

@jeroenjanssens

Copy link
Copy Markdown
Contributor

Problem

Running great-docs build in a Go-only project (project_type: go) blocks on an interactive prompt:

Could not auto-detect package name. Enter package name for API reference (or press Enter to skip):

_add_api_reference_config() ran for every project regardless of type. For a Go project there is no root pyproject.toml or top-level Python package, so _detect_package_name() returns None and the build drops into an input() prompt — which hangs non-interactive and uvx-driven builds.

Fix

Gate the API-reference step on the existing Config.is_python_project, so non-Python projects skip it cleanly. This mirrors how the PyPI link already defaults off for non-Python projects, and needs no new config key — project_type already carries the necessary information. The separate Go CLI reference path is unaffected.

if not self._config.is_python_project:
    print("API reference skipped (non-Python project)")
    self._has_api_reference = False
    return

Testing

  • Added test_add_api_reference_config_non_python_project, which patches builtins.input to fail loudly if the prompt is ever reached for a Go project.
  • All 8 add_api_reference_config tests pass.
  • Verified end-to-end: great-docs build on a Go project (velocirepo) now completes without prompting, prints API reference skipped (non-Python project), and still generates the Go CLI reference.

The 23 pre-existing failures in tests/test_synthetic.py are unrelated to this change (confirmed by reproducing them on main).

_add_api_reference_config() ran for every project regardless of type.
For a Go-only project (project_type: go) there is no root pyproject.toml
or top-level Python package, so _detect_package_name() returned None and
the build dropped into an interactive input() prompt asking the user to
type a package name — blocking non-interactive and uvx-driven builds.

Gate the step on the existing Config.is_python_project so non-Python
projects skip it cleanly (mirroring how the PyPI link already defaults
off for non-Python projects). This needs no new config key: project_type
already carries the necessary information. The separate Go CLI reference
path is unaffected.

Add a regression test that patches builtins.input to fail loudly if the
prompt is ever reached for a Go project.
@has2k1

has2k1 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

LGTM

@has2k1
has2k1 merged commit b4d7e11 into posit-dev:main Jul 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants