Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building docs only work the first time (for non-doc modifications) #120

Closed
ewjoachim opened this issue Aug 1, 2020 · 2 comments · Fixed by #121 or #131
Closed

Building docs only work the first time (for non-doc modifications) #120

ewjoachim opened this issue Aug 1, 2020 · 2 comments · Fixed by #121 or #131
Assignees
Labels
bug Something isn't working

Comments

@ewjoachim
Copy link
Contributor

ewjoachim commented Aug 1, 2020

SUMMARY

Maybe I missed something but, (probably depending on the changes you make,) tox -e build-docs only builds the doc the 1st time. Then, it relies on .tox/.tmp/.doctrees, and will read the source again only if a non-changelog-fragment rst file was modified.

ISSUE TYPE
  • Bug Report
PYLISSH and LIBSSH VERSION

457c1e6 and libssh is irrelevant

OS / ENVIRONMENT

Not sure anything is relevant here, but if need be, MacOS.

STEPS TO REPRODUCE
$ tox -e build-docs
$ echo "Hey **there**" > docs/changelog-fragments/12.mist.rst
$ tox -e build-docs
EXPECTED RESULTS

On the second build, the changelog fragment should appear

ACTUAL RESULTS

It doesn't


CAUSED BY

Sphinx relies on .tox/.tmp/.doctrees. If it exists and (I assume) docs rst files have not been modified, then the doc parsing does not occur.
If this folder is deleted then it works normally.
A few things that can modify the doc output and are not triggering a new build:

  • The python code under _ext
  • Changelog fragments
@ewjoachim ewjoachim changed the title Building docs only work the first time Building docs only work the first time (for non-doc modifications) Aug 1, 2020
@webknjaz webknjaz added the bug Something isn't working label Aug 1, 2020
@webknjaz webknjaz self-assigned this Aug 1, 2020
@ewjoachim
Copy link
Contributor Author

ewjoachim commented Aug 1, 2020

I think this could be solved by implementing the proper callbacks to

app.connect('env-get-updated', get_updated)
# and
app.connect('env-get-outdated', get_outdated)

but the lack of docs on the matter makes it hard to understand exactly what would need to be done in those functions.

(The doc : https://www.sphinx-doc.org/en/master/extdev/appapi.html#events )

Just to make it clear, I understand that this is not a real problem for pylibssh and removing the .doctrees might be enough of a workaround to not spend longer on this problem, I'm mainly doing this to get a better understanding of Sphinx :)

@webknjaz
Copy link
Member

webknjaz commented Aug 1, 2020

@ewjoachim good point! FWIW this is something that should be documented when I start moving things to https://github.com/sphinx-contrib/towncrier.

https://stackoverflow.com/a/44758406/595220 suggests to use -a but that will just rebuild everything every time and so it defeats the whole point of having cached doctrees.
https://www.sphinx-doc.org/en/master/man/sphinx-build.html#description says that specifying positional args will force rebuild but it'll only build those files.

So it looks like if I add two invocations to the tox env, first to build just the changelog document and the second one to rebuild anything else that's changed or new, it may work... But yeah, exploring those events is definitely something that needs to be investigated.

webknjaz added a commit that referenced this issue Aug 3, 2020
This is a temporary workaround for
#120
webknjaz added a commit that referenced this issue Aug 3, 2020
This change adds an extra `sphinx-build` command to ensure that the
changelog document is always rebuilt regardless of the doctrees cache
presence.

Ref: #120
@webknjaz webknjaz linked a pull request Aug 3, 2020 that will close this issue
@webknjaz webknjaz linked a pull request Aug 10, 2020 that will close this issue
webknjaz added a commit that referenced this issue Aug 10, 2020
This change hotfixes #120 short-term by forcing docs that use the
towncrier draft entries directive not to hit the cache
unconditionally.
webknjaz added a commit that referenced this issue Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants