-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Build: output _readthedocs/
directories feedback after deploy
#9931
Comments
I just realized that we had another issue: the build process raised an exception at I've already moved this to the right place in #9800
|
I'm not convinced about how to remove this restriction, yet. I don't want to rename the file on behalf the user because that would be incompatible with "Multiple pdf files for single project" since we don't want to rename all the user's PDF filenames (e.g. if they have We may want to prefix/suffix the project/version slug, tho. In any case, we will need to save the filename in our database to know what's the PDF the user wants to download. However, for now, we could do a |
I think my initial proposal to solve this problem would be to return a
This is the simpler implementation for this, since we don't have to change the UI (add one link per |
It checks for `_readthedocs/<format>` output directory to be a directory. If it's not a directory, it silently skip that format for now. This behavior will change once we move out `store_build_artifacts` from `on_success` and we can communicate errors easily to the user. Related #9931
I've done this in #9941 👍🏼 |
@humitos What about doing this more explicitly and adding a zip file output download format instead? It feels maybe a bit hacky to do this automatically for projects. It seems like we might be building an edge case that will frustrate us at some point -- indeterminately returning non-pdf content from our pdf endpoints. If our long term plan does not include distributing zip archives, this will be something we have to work around later too. If we do ever support multiple output files natively, we'll have single pdf builds, multiple pdf builds, and legacy zip archive pdfs too. Supporting zip archives for downloads actually might be a fine way to solve this UX for good. Instead of supporting arbitrary numbers of arbitrary files in our UX, users can just opt to output a zip file with whatever they want. I might lean towards this approach at this point. In the case we support multiple PDF files in output, we have to change all the UI/UX around "Download PDF" to now also list the PDFs to download. If we add a zip format, we don't, and this batch of work is infinitely easier. Also, it's worth noting that we don't need to rush on supporting multiple PDF files. We don't support this now, and it's fine if our first implementation of |
@agjohnson what I'm proposing here in this issue comes from a small chat we had with Eric at #9888 (comment) |
I won't remove this restriction yet without more conversation. For now, I think it will be enough by documenting how it works. Basically, people need to use cd _readthedocs ; zip -r -j htmlzip/$READTHEDOCS_PROJECT.zip $READTHEDOCS_PROJECT
mv _readthedocs/simplepdf/"Test Builds.pdf" _readthedocs/pdf/$READTHEDOCS_PROJECT.pdf (example from https://readthedocs.org/projects/test-builds/builds/19268359/) |
Requiring a specific filename still seems like a straightforward approach, I agree that documenting this behavior is enough for this first pass. It keeps the implementation outcome the same, but is still a step towards more user control. I'm also still fine taking more time on multiple pdf/epub support, we don't need this feature to wrap up this change. There are UI and UX questions for both maintainers and readers with all three approaches here, and I'm not very convinced on any of them yet. |
* Build: check if the output directory is a directory It checks for `_readthedocs/<format>` output directory to be a directory. If it's not a directory, it silently skip that format for now. This behavior will change once we move out `store_build_artifacts` from `on_success` and we can communicate errors easily to the user. Related #9931 * Build: refactor logic to validate artifacts output paths Wrap all the logic into a class method so it's easier to follow and read. It also remove some duplicated checks of `os.path.exists`, making sure we are always using _validated_ paths already. * Build: communicate uploading errors to users Running `store_build_artifacts` from inside `.execute()` method instead of from `.on_sucess()` allow us to raise any exception and handle it properly. We can raise a `BuildUserError` to clearly communicate the specific error to the user, or any other exception to show the generic message: "Try again or contact us". Besides, this allows us to *fail the build* instead of continuing silently without the user noticing this: - there more than 1 file of formats that don't support multiple files - the output path is not a directory - there were errors uploading the artifacts to the storage * Build: validate the output directory has at least 1 file In case the `_readthedocs/<format>` directory is created by it contains 0 files, we fail the build and communicate this to the user. * Build: constant for artifact types that don't support multiple files
This is already fixed. We've created other issues to track the missing parts. I'm closing it. |
We were able build other formats (PDF, HTMLZip) by outputting the files into
_readthedocs/{pdf,htmlzip}
directories: https://test-builds.readthedocs.io/en/all-formats-build-jobs/We found some limitations:
_readthedocs/pdf/<project-slug>.pdf
_readthedocs/htmlzip/project-slug>.zip
_readthedocs/<format>
but we are not checking if it's a directory atreadthedocs.org/readthedocs/projects/tasks/builds.py
Line 539 in e1e7a18
Also, while debugging this we hit #9468
The text was updated successfully, but these errors were encountered: