Skip to content

[MRG+1] build pdf before pushing docs. - #7671

Closed
amueller wants to merge 2 commits into
scikit-learn:masterfrom
amueller:pdf_doc_build
Closed

amueller wants to merge 2 commits into
scikit-learn:masterfrom
amueller:pdf_doc_build

Conversation

@amueller

Copy link
Copy Markdown
Member

Fixed #7543.

This builds the PDF for the release branches and master.
The html was already built do I don't do that again.

@jnothman

jnothman commented Oct 15, 2016 •

Copy link
Copy Markdown
Member

Should be using make dist to copy into correct place. make dist also uses optipng to make the PDF file much smaller. Not sure how to install optipng on circle.

@jnothman

jnothman commented Oct 15, 2016 •

Copy link
Copy Markdown
Member

Sorry. make dist only uses optipng after my PR regarding such, #5232, is merged.

@amueller

Copy link
Copy Markdown
Member Author

Missed the copy, sorry.
And I wanted to merge this asap so we get pdfs, even without optipng (which we are currently not using anyhow).

@GaelVaroquaux GaelVaroquaux changed the title build pdf before pushing docs. [MRG+1] build pdf before pushing docs. Oct 18, 2016
@GaelVaroquaux

Copy link
Copy Markdown
Member

LGTM. Thanks

@jnothman

jnothman commented Oct 18, 2016 •

Copy link
Copy Markdown
Member

Yes, but the PDF without optipng is enormous, IIRC... Will we need to extend the timeout as in #7693?

@jnothman

Copy link
Copy Markdown
Member

PDF without optipng is 45MB

@GaelVaroquaux

GaelVaroquaux commented Oct 18, 2016 via email

Copy link
Copy Markdown
Member

@jnothman

Copy link
Copy Markdown
Member

Probably nothing is preventing us from getting optipng... if we don't need to download a whole series of C/++ dependencies. I suppose it could be tested in build_doc.sh then moved to push_doc.sh.

@lesteve

lesteve commented Oct 19, 2016 •

Copy link
Copy Markdown
Member

Would it not make more sense to build the pdf doc in build_doc.sh rather than push_doc.sh, i.e. do something like this in build_doc.sh:

if [[ "$CIRCLE_BRANCH" =~ '^master$|^[0-9]+\.[0-9]+\.X$' ]]; then
    MAKE_TARGET=dist
else
    MAKE_TARGET=html
fi

set -o pipefail && cd doc && make $MAKE_TARGET 2>&1 | tee ~/log.txt

Maybe we need to make sure that the build is not for a PR via the CIRCLE_PULL_REQUESTS environment variable for example (https://circleci.com/docs/environment-variables/)

@lesteve

lesteve commented Oct 19, 2016

Copy link
Copy Markdown
Member

Not sure how to install optipng on circle.

Some LaTeX-related packages get installed via apt-get already in build_doc.sh (IIRC they are needed for the html build, maybe for maths). So it would be a matter of adding optipng to the list.

@jnothman

Copy link
Copy Markdown
Member

If we agree that it doesn't happen with every push to a PR, does it matter
whether it's done in build_doc rather than push_doc? It helps to do it in
build_doc if we want to test what later gets moved to the push handler.

On 19 October 2016 at 23:00, Loïc Estève [email protected] wrote:

Not sure how to install optipng on circle.

Some LaTeX-related packages get installed via apt-get already in
build_doc.sh (IIRC they are needed for the html build, maybe for maths). So
it would be a matter of adding optipng to the list.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#7671 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEz63sOpII1OtmzkCvkpBAafuEx4fDDks5q1gZ3gaJpZM4KXOQT
.

@lesteve

lesteve commented Oct 19, 2016

Copy link
Copy Markdown
Member

If we agree that it doesn't happen with every push to a PR, does it matter whether it's done in build_doc rather than push_doc?

It's mainly that building the doc in push_doc is rather misleading given the names of the scripts. Also log.txt gets overriden the way it is done right now, and it's not great that you have a copy and paste of almost the same command in build_doc and push_doc.

@jnothman

Copy link
Copy Markdown
Member

Shrug. Feel like submitting a PR?

On 19 October 2016 at 23:37, Loïc Estève [email protected] wrote:

If we agree that it doesn't happen with every push to a PR, does it matter
whether it's done in build_doc rather than push_doc?

It's mainly that building the doc in push_doc is rather misleading given
the names of the scripts. Also log.txt gets overriden the way it is done
right now, and it's not great that you have a copy and paste of almost the
same command in build_doc and push_doc.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#7671 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEz69REhkVp6EGXvkV2_3de0g5x4MUIks5q1g8NgaJpZM4KXOQT
.

@waterponey

Copy link
Copy Markdown
Contributor

If you put the make dist in the push doc, failures won't be caught and you might push corrupted documentation so it's not really a good idea. @lesteve solution is better I think.

@lesteve

lesteve commented Oct 24, 2016 •

Copy link
Copy Markdown
Member

@waterponey I don't have too much time right now so if you do have time to do a PR, be my guest!

@waterponey

Copy link
Copy Markdown
Contributor

Ok I'll do that. Should I open a new PR here or do a PR on @amueller repo ?

@lesteve

lesteve commented Oct 24, 2016 •

Copy link
Copy Markdown
Member

Open a new PR, I think it will be quicker and you'll get the CI running on your PR.

I think the main thing to do is to double-check that the CI_PULL_REQUEST environment variable is populated as expected, so that only the html is built inside a PR and not the pdf.

@waterponey

Copy link
Copy Markdown
Contributor

Actually there is already a script that's taking care of looking at CI_PULL_REQUEST (the check_build_doc).

Maybe I can alter it to add the possibility that when we add [pdf build] in the commit message, it forces the build ? Or just change the current behavior that makes it build the html version when [doc build] is passed.

@lesteve

lesteve commented Oct 24, 2016 •

Copy link
Copy Markdown
Member

My understanding is that we should never build the pdf in pull requests because it takes too much time, what I would do is tweak slightly my snippet above and do (still in build_doc.sh rather than push_docs.sh):

if [[ "$CIRCLE_BRANCH" =~ '^master$|^[0-9]+\.[0-9]+\.X$' && -z "$CI_PULL_REQUEST" ]]; then
    MAKE_TARGET=dist
else
    MAKE_TARGET=html
fi

set -o pipefail && cd doc && make $MAKE_TARGET 2>&1 | tee ~/log.txt

Since check_build_doc.py is already using CI_PULL_REQUEST, it does give confidence that the environment variable is populated correctly and it should all just work ...

@lesteve

lesteve commented Oct 24, 2016

Copy link
Copy Markdown
Member

As it is, we'll build the pdf documentation for the versions 0.6.X but we won't send them anywhere. Is that wanted ?

I am not sure what you mean by "we won't send them anywhere" and I am not sure why you picked 0.6.X as an example. I don't think anyone is going to push into old (meaning at the time of the writing 0.17.X and older) release branches if that's what you are worrying about so let's stick to the simplest thing that works.

@amueller

Copy link
Copy Markdown
Member Author

I'd like to be able to push into the 0.18.X branch and have the stable website update. That should be the same case as pushing to 0.17.X or 0.6.X, right?

@waterponey

Copy link
Copy Markdown
Contributor

New PR #7747

@waterponey

Copy link
Copy Markdown
Contributor

No my bad. It will work in both cases.

On 24 October 2016 at 19:55, Andreas Mueller [email protected]
wrote:

I'd like to be able to push into the 0.18.X branch and have the stable
website update. That should be the same case as pushing to 0.17.X or 0.6.X,
right?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7671 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFhu2ik3oDabiZUeM_RCZsGbx8zpUwpjks5q3PEjgaJpZM4KXOQT
.

@waterponey

Copy link
Copy Markdown
Contributor

This PR should be closed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants