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

bpo-37860: Add netlify deploy preview for docs #15288

Merged
merged 14 commits into from
Aug 21, 2019
Merged

Conversation

epicfaace
Copy link
Contributor

@epicfaace epicfaace commented Aug 14, 2019

Add netlify deploy preview for docs. Once you add Netlify as an app to this github repo, then with these files added in, it should build the docs properly.

Here is an example PR with netlify enabled: epicfaace#5
And the corresponding deploy preview: https://deploy-preview-5--priceless-newton-e3c22b.netlify.com/

https://bugs.python.org/issue37860

Fixes python/core-workflow#348

Copy link
Contributor

@aeros aeros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epicfaace Thanks for the PR!

This will definitely be much more convenient than having to manually use make html to preview rich formatting changes.

Edit: Also, as far as I can tell, the netlify preview seems to be working correctly in the PR within the author's forked repository: https://deploy-preview-5--priceless-newton-e3c22b.netlify.com.

Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @epicfaace 👍

@@ -0,0 +1,4 @@
# Requirements for docs build on netlify
sphinx==2.0.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mariatta Do you think that this should be pinned or float upward?

Copy link
Contributor Author

@epicfaace epicfaace Aug 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pinned it because that's how it was in .travis.yml.

https://github.com/python/cpython/blob/master/.travis.yml#L58

Actually, do you think it might be better to make .travis.yml to read from Doc/requirements.txt instead of specifying its own versions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this. Keep it pinned for now but add a comment: # Pin sphinx to version specified in .travis.yml on the line above Sphinx in requirements.txt

Copy link
Contributor Author

@epicfaace epicfaace Aug 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I think it might be better to just include python -m pip install -r Docs/requirements.txt in .travis.yml though, so that we don't have to keep two files in sync, unless there's a reason not to do so?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epicfaace For now, the least disruptive change was to make the modification here. Ideally, there wouldn't be duplication. Would you like to open an issue suggesting the above.

@aeros
Copy link
Contributor

aeros commented Aug 21, 2019

If it's not much of a hassle, I would appreciate it if someone could @ mention me when this PR is merged. I'll be mentioning the netlify preview in my PR for the devguide as a part of verifying rich formatting in NEWS entries.

It might be worthwhile to also mention it somewhere in https://devguide.python.org/documenting/.

@willingc
Copy link
Contributor

If it's not much of a hassle, I would appreciate it if someone could @ mention me when this PR is merged. I'll be mentioning the netlify preview in my PR for the devguide as a part of verifying rich formatting in NEWS entries.

@aeros167 It's probably better for you to click Notifications on the right sidebar which will subscribe you to changes in the PR 😄

It might be worthwhile to also mention it somewhere in https://devguide.python.org/documenting/.

Yes it would 👍

@aeros
Copy link
Contributor

aeros commented Aug 21, 2019

@aeros167 It's probably better for you to click Notifications on the right sidebar which will subscribe you to changes in the PR smile

Haha, good point. I recently changed my notification settings to only notify me via email for @ mentions (since I was getting a bit over-flooded w/ GitHub emails), but I could probably have it different for specific PRs. I previously had it set to "Watching" for any PR that I reviewed or commented in.

Also, I hadn't realized that the "Releases only" setting was an option, which notifies only for @ mentions and releases. That should do the trick. (:

@aeros
Copy link
Contributor

aeros commented Aug 21, 2019

Since this change is involving the addition of a development tool to the repository and it wouldn't affect users of Python, I'll add a skip news label.

@aeros aeros added skip issue docs Documentation in the Doc dir skip news and removed skip issue labels Aug 21, 2019
@aeros
Copy link
Contributor

aeros commented Aug 21, 2019

Thanks again for the PR @epicfaace and thanks for merging it @willingc. I'll go update my PR for the devguide.

@epicfaace
Copy link
Contributor Author

An admin now needs to actually add Netlify as an app to this repository so that it can start running and building the docs.

@aeros
Copy link
Contributor

aeros commented Aug 21, 2019

An admin now needs to actually add Netlify as an app to this repository so that it can start running and building the docs.

I'm not certain if there's a specific person that manages the repository's apps, so I'll notify all of the admins for CPython.

/cc @python/cpython-repository-admins

@brettcannon
Copy link
Member

brettcannon commented Aug 21, 2019

@epicfaace have a link to the GitHub App for Netlify?

@@ -0,0 +1 @@
3.7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be specified in netlify.toml too instead of a special-purpose file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epicfaace
Copy link
Contributor Author

@epicfaace have a link to the GitHub App for Netlify?

@brettcannon I think the easiest way to integrate it is to sign in to netlify.com with whichever account Python is using. You can use the same Netlify account that's being used with https://github.com/python/devguide. Then, you can add this repo as a "site" on netlify, and then it should ask for permission with the appropriate scopes. See https://www.netlify.com/docs/github-permissions/

@brettcannon
Copy link
Member

@epicfaace not aware of any account, so I don't know what you're talking about. 😄 @ewdurbin do you know/control the netlify account for the org?

@aeros aeros mentioned this pull request Aug 22, 2019
@epicfaace
Copy link
Contributor Author

For reference, here's the original thread where it was set up for devguide: python/devguide#463

@Mariatta
Copy link
Member

😟 the devguide netlify was actually set up under my personal netlify account.
I could not figure out how to transfer that to a different account.

If the PSF can create the netlify account and add me to it as a team member, I can help manage and create the netlify for CPython.

@epicfaace
Copy link
Contributor Author

epicfaace commented Aug 23, 2019

I've set up an open source site on Netlify before. You need to contact Support and then they will give your account access to create a "Team". Then, you can add people to the team and create sites on it.

Note that in order to qualify for this, you must have a badge that links to Netlify on the deployed site. (They suggest you add a "deploys by Netlify" badge, so it seems like this requirement would only apply to the version of the site that is deployed by Netlify, i.e. the deploy previews)

https://www.netlify.com/legal/open-source-policy/

Otherwise, using a personal account on Netlify doesn't give you the ability to share permissions/management with others.

lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
* add netlify deploy preview

* fix publish path

* install python3 venv

* add sudo

* try without venv

* install right dependencies

* use python3, not python

* use pip3

* python3.7

* use requirements.txt

* move requirements.txt to Doc

* use python 3.7 in runtime.txt

* move runtime.txt

* Update requirements.txt
@jaraco
Copy link
Member

jaraco commented Dec 29, 2019

I'm eager to see this feature employed. Today, I'm reviewing GH-17730, and I'd love to see the rendered output without building the toolchain or downloading the zip file and expanding it locally.

@epicfaace
Copy link
Contributor Author

@Mariatta how could we go forward with this? Could we just set this up as part of your personal netlify account (although it's not ideal, at least then the devguide and cpython repos will both be under your account, so that they could later be transferred together to a PSF account)?

@brettcannon
Copy link
Member

@epicfaace we would need @ewdurbin to set up a PSF-managed Netlify account.

@ewdurbin
Copy link
Member

ewdurbin commented Jan 6, 2020

I've contacted Netlify to inquire about setting up a PSF team on the service. It looks like their free tier has changed and probably would not support the needs of this repo both in build minutes and collaborator count.

@epicfaace
Copy link
Contributor Author

@ewdurbin I assume you're talking about the "Pro" tier, correct (which is what Netlify provides to open-source teams for free) (1000 build minutes included/month and 3 collaborators included)? What values of build minutes / collaborator count do you think would be required for this repo?

DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
* add netlify deploy preview

* fix publish path

* install python3 venv

* add sudo

* try without venv

* install right dependencies

* use python3, not python

* use pip3

* python3.7

* use requirements.txt

* move requirements.txt to Doc

* use python 3.7 in runtime.txt

* move runtime.txt

* Update requirements.txt
@ewdurbin
Copy link
Member

Howdy! I heard back from netlify and we have access to a Pro level account now through their Open Source Plan Policy.

To get some bearings, I temporarily enabled it for this repository and opened a test pull request at #18242, which resulted in a working preview build 🎉.

Overall it seems to work with that minor tweak, but the limitations of the Pro level plan will likely need to be addressed:

1000 build minutes per month

I'm not sure if it's a cold cache kind of situation, but from the logs of a few test deploys (example) I noticed that cloning alone is taking over a minute per build, followed by another 5-6 minutes to install dependencies and build the docs.

This means that we can currently expect to get ~170 preview builds per month before reaching our limit and beginning to incur charges of $7/500 additional build minutes.

3 concurrent builds

This is a pretty active repository, so this would likely just be a headache at times. Probably not a blocker.

3 team members

Probably not an issue, I'd just need to know who to add.

Given those, I think we'd need to investigate some way to handle the limitations above (and figure out why the change in #18242 was necessary) before turning this on.

@aeros
Copy link
Contributor

aeros commented Jan 29, 2020

Thanks for reaching out to netlify on this @ewdurbin!

Assuming we can find a way around the monthly build time limits, this will be an awesome feature for documentation PRs; especially for larger ones that include a significant amount of markdown. For example, the "What's New" documentation often contains broken Sphinx roles (with correct syntax, but an incorrect link). These could be caught much easier with the netlify preview.

One possible solution would be to use the preview selectively for documentation PRs, via a manually applied label (which would be configured to trigger a webhook). For example: test-with-netlify, similar to the recently added test-with-buildbots. As long as the limit is a concern, the label would have to be manually added by either Python core developers or members of the Triage team for PRs that would substantially benefit from having the netlify preview.

In the future if we're able to increase the monthly build limit substantially (to either unlimited or high enough that we'd never reasonably reach it), we could potentially configure @bedevere-bot to automatically add the above test-with-netlify whenever a PR includes changes to any file to the Doc/ directory in the CPython repository.

@epicfaace
Copy link
Contributor Author

epicfaace commented Mar 15, 2020

Given the limitations of using Netlify, I've added a PR with an alternative approach using GitHub Actions in the issue (https://bugs.python.org/issue37860). Any thoughts on this approach?

websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
* add netlify deploy preview

* fix publish path

* install python3 venv

* add sudo

* try without venv

* install right dependencies

* use python3, not python

* use pip3

* python3.7

* use requirements.txt

* move requirements.txt to Doc

* use python 3.7 in runtime.txt

* move runtime.txt

* Update requirements.txt
@epicfaace epicfaace mannequin mentioned this pull request Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preview CPython documentation build in PR via netlify
10 participants