Skip to content

docs: fix conf after _build.py changes#4647

Closed
mjg wants to merge 1 commit into
pymupdf:mainfrom
mjg:docs-fix-conf-after-_build.py-changes
Closed

docs: fix conf after _build.py changes#4647
mjg wants to merge 1 commit into
pymupdf:mainfrom
mjg:docs-fix-conf-after-_build.py-changes

Conversation

@mjg
Copy link
Copy Markdown
Contributor

@mjg mjg commented Aug 11, 2025

docs/conf.py tries to read version info from src/__init__py using an expression match. This breaks after e439a0f ("setup.py src/ tests/: auto-generate pymupdf.pymupdf_version and add git info.", 2025-08-08) makes src/__init__py import that info from _build.py, which is generated during build in the build directory.

Make the build process generate a copy of _build.py in docs and let docs/conf.py import version info from there.

Alternative fixes:

  • pointing docs/conf.py at the build directory; this may no longer exist after a wheel build, though
  • reading from the generated wheel; oh well ;-)
  • installing the build and importing _build.py from there; this would mean intermingling build and install steps

`docs/conf.py` tries to read version info from `src/__init__py` using
an expression match. This breaks after e439a0f ("setup.py src/ tests/:
auto-generate pymupdf.pymupdf_version and add git info.", 2025-08-08)
makes `src/__init__py` import that info from `_build.py`, which is
generated during build in the build directory.

Make the build process generate a copy of `_build.py` in `docs` and let
`docs/conf.py` import version info from there.

Alternative fixes:
- pointing `docs/conf.py` at the build directory; this may no longer
  exist after a wheel build, though
- reading from the generated wheel; oh well ;-)
- installing the build and importing `_build.py` from there; this would
  mean intermingling build and install steps
@julian-smith-artifex-com
Copy link
Copy Markdown
Collaborator

Thanks for this. Oddly enough i came across the same problem earlier today.

My fix is slightly different - it makes docs/conf.py import PyMuPDF's setup.py and then use setup.version_p directly.

I think this is slightly better because it doesn't require that a build has been done. And it gets the required information directly from the primary source setup.py.

@mjg
Copy link
Copy Markdown
Contributor Author

mjg commented Aug 11, 2025

If that has no unwanted side-effects it should be fine. I saw no commit fixing this, that's why I went ahead.

@mjg
Copy link
Copy Markdown
Contributor Author

mjg commented Aug 11, 2025

Works with your patch, btw, so I'll close this one. Thanks!

@mjg mjg closed this Aug 11, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 11, 2025
@julian-smith-artifex-com
Copy link
Copy Markdown
Collaborator

Thanks, we've merged the docs fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants