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

Local testing? #112

Open
leotrs opened this issue Mar 25, 2021 · 9 comments
Open

Local testing? #112

leotrs opened this issue Mar 25, 2021 · 9 comments
Labels
Support Support question

Comments

@leotrs
Copy link

leotrs commented Mar 25, 2021

The documentation says this needs a backend server such as RTD. Is there a way of testing this locally? Thanks

@stsewd
Copy link
Member

stsewd commented Mar 25, 2021

You can set the hoverxref_project and hoverxref_version settings in your conf.py file. Of course, you would need to have a that project and version on RTD, and it would embed the content from the version hosted on RTD, not from your local changes.

@stsewd stsewd added the Support Support question label Mar 25, 2021
@humitos
Copy link
Member

humitos commented Mar 29, 2021

@leotrs are you trying to test the extension to collaborate as a developer? If this is the case, you can take a look at https://sphinx-hoverxref.readthedocs.io/en/latest/development.html

or are you trying to test the extension as a user to see how it looks like? If this is the case, you can import your project on Read the Docs and enable Pull Request build, open a PR that install the extension and check out how it looks.

@leotrs
Copy link
Author

leotrs commented Mar 29, 2021

@humitos thanks for the answer - for now I was interested in local testing as a user. Looking forward to maybe contributing in the future!

@stsewd
Copy link
Member

stsewd commented Apr 15, 2021

@leotrs you can use my solution #112 (comment) or the suggestion from @humitos. Let us know if you have more questions.

@stsewd stsewd closed this as completed Apr 15, 2021
@astrojuanlu
Copy link
Contributor

astrojuanlu commented Aug 15, 2022

or are you trying to test the extension as a user to see how it looks like? If this is the case, you can import your project on Read the Docs and enable Pull Request build, open a PR that install the extension and check out how it looks.

This requirement is a bit too demanding for some use cases and makes any local development workflow incomplete. Would you consider reopening this issue until there's a more lightweight way to test the extension locally in a way that the RTD PR builder is not needed?

Unfortunately, we're dropping this extension in orchest/orchest#1202 mainly because of this.

cc @ricklamers

@humitos
Copy link
Member

humitos commented Aug 16, 2022

@astrojuanlu reading the feedback from that PR, the only mention to hoverxref I found is the following:

Feedback: too easy to accidentally trigger opening a popup and too difficult to test locally (it appears as broken without warning)

  1. what would be a good way to reduce the accidental triggering of a popup without compromising the UX?
  2. would it be enough to update the message from just "Loading ..." to "The content can't be loaded unless running on Read the Docs" or similar? (related to Nicer error when the request produces 404 #132 and Handle AJAX API call error #17)

Are there any other feedback that you could share with us that maybe is not written in that PR description/comments?

Note the extension requires a backend server, so it won't work at all when reading the docs locally. All the suggestions and/or alternatives that we have commented in this issue and under the "Development" section of the docs are workarounds to have a preview of it. However, it's not 100% accurate for different reasons. The most noticeable being "loading outdated content into the tooltip" because the server has an older version of it compared with the local version. That said, even if we find a way to easily allow to test it locally, it could confuse users in a deeper and hard to understand way.

I'm open to suggestions, and I'd appreciate your feedback on this. Thanks 🙏🏼

@humitos humitos reopened this Aug 16, 2022
@astrojuanlu
Copy link
Contributor

Thanks @humitos for taking it into consideration!

Are there any other feedback that you could share with us that maybe is not written in that PR description/comments?

It's basically the two points I raised there.

  1. the only way that comes to mind to reduce the accidental triggering would be a time delay (maybe ~1 second or so, possibly configurable) to trigger the request. there might be other, more creative solutions. I also have no idea what accessibility guidelines are there around this kind of behavior in general.
  2. if I understand correctly, the embed logic is more or less self-contained here https://github.com/readthedocs/readthedocs.org/blob/579ac3b15/readthedocs/embed/v3/views.py wondering if the whole rtd development installation should be needed (I get it's needed now with the current architecture though). having a better error message would be a much-needed step forward indeed, although it wouldn't help recreating the documentation locally as a user would see it.

@wRAR
Copy link

wRAR commented Apr 21, 2024

Related but I think ideologically different issue: docs built without RTD and not deployed there, such as ones built locally or ones built for shipping in various distro packages, cannot display popups, but still make a request to the RTD API, so it would be very nice to just disable making the request in those cases. Is there an easy way for that (maybe as something passed to sphinx-build)? If not, can it be added?

@humitos
Copy link
Member

humitos commented Apr 22, 2024

cannot display popups, but still make a request to the RTD API, so it would be very nice to just disable making the request in those cases. Is there an easy way for that (maybe as something passed to sphinx-build)? If not, can it be added?

@wRAR when building on Read the Docs, an environment variable READTHEDOCS=True is defined (https://docs.readthedocs.io/en/stable/reference/environment-variables.html), so that could be used in the Sphinx process to disable this extension if that variable is not defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Support Support question
Projects
None yet
Development

No branches or pull requests

5 participants