Skip to content

Adding a script to standardize the notebook versions. #1431

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

Merged
merged 4 commits into from
Nov 13, 2020

Conversation

freddyaboulton
Copy link
Contributor

@freddyaboulton freddyaboulton commented Nov 12, 2020

Pull Request Description

Fixes #1419

This is a test to show that circle ci will fail when the notebook versions don't match: https://app.circleci.com/pipelines/github/alteryx/evalml/7250/workflows/8b47906b-6b9f-4f95-b0ee-c2f78f2a6d9c/jobs/80895

This is what the output looks like when lint fails:

image

Then you can fix with lint-fix:
image


After creating the pull request: in order to pass the release_notes_updated check you will need to update the "Future Release" section of docs/source/release_notes.rst to include this pull request by adding :pr:123.

@codecov
Copy link

codecov bot commented Nov 12, 2020

Codecov Report

Merging #1431 (6891638) into main (dc6acd5) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1431   +/-   ##
=======================================
  Coverage   100.0%   100.0%           
=======================================
  Files         218      218           
  Lines       14433    14433           
=======================================
  Hits        14426    14426           
  Misses          7        7           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dc6acd5...6891638. Read the comment docs.

Copy link
Contributor

@angela97lin angela97lin left a comment

Choose a reason for hiding this comment

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

Amazing, thanks for this!! LGTM 👍 🚢

click.echo(f"Set the notebook version to {desired_version} for:\n {different_versions}")


if __name__ == '__main__':
Copy link
Contributor

Choose a reason for hiding this comment

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

Ooo is this necessary because we're calling python docs/notebook_version_standardizer.py check-versions? Jw cause I know we had something similar for our CLI commands and then removed them :d

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah, @angela97lin I think we had to remove that for codecov, right, before we loosened the coverage thresholding? I'm blanking on whether there was another reason... fundamentally, if this works it works!

Copy link
Contributor Author

@freddyaboulton freddyaboulton Nov 13, 2020

Choose a reason for hiding this comment

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

I think we don't need it for the cli because the setup.py file sets the entry point as __main__.py:cli()? Without this line, the cli won't run if you do python notebook_version_sanitizer.py

Copy link
Contributor

@dsherry dsherry left a comment

Choose a reason for hiding this comment

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

This rocks!! I'm gonna use this all the time locally. Plus I think this means lint will fail if this standardization hasn't been run... neat! Thank you 🙏 I left one comment about having the error message mention make lint-fix


.PHONY: lint-fix
lint-fix:
autopep8 --in-place --recursive --max-line-length=100 --select="E225,E222,E303,E261,E241,E302,E203,E128,E231,E251,E271,E127,E126,E301,W291,W293,E226,E306,E221" evalml
isort --recursive evalml
python docs/notebook_version_standardizer.py standardize
Copy link
Contributor

Choose a reason for hiding this comment

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

Very cool!!

click.echo(f"Set the notebook version to {desired_version} for:\n {different_versions}")


if __name__ == '__main__':
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah, @angela97lin I think we had to remove that for codecov, right, before we loosened the coverage thresholding? I'm blanking on whether there was another reason... fundamentally, if this works it works!



@cli.command()
@click.option('--desired-version', default='3.7.4', help='python version that all notebooks should match')
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we should standardize to the latest 3.8? I guess it doesn't really matter lol, unless there's some ugly version-dependent docs bug which pops up haha. I remember we surveyed the group and most people were running different python versions locally so that doesn't help us decide here 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going for 3.8.2 since that was the version of 3.8 that was in the notebooks before this PR. The good thing is that we can pass in the desired version in the makefile in the future

if different_versions:
different_versions = ['\t' + notebook for notebook in different_versions]
different_versions = "\n".join(different_versions)
raise SystemExit(f"The following notebooks don't match {desired_version}:\n {different_versions}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add something about how to fix? Like "please run make lint-fix to fix". Because this will now show up in the lint job failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

@bchen1116 bchen1116 left a comment

Choose a reason for hiding this comment

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

O this is awesome! LGTM

@freddyaboulton freddyaboulton force-pushed the 1419-sanitize-notebook-versions branch from 5e8f0d2 to 4cc3056 Compare November 13, 2020 16:33
@freddyaboulton freddyaboulton merged commit f098745 into main Nov 13, 2020
@freddyaboulton freddyaboulton deleted the 1419-sanitize-notebook-versions branch November 13, 2020 17:29
@dsherry dsherry mentioned this pull request Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs notebooks: "sanitize" python version to make it easier to change notebooks
4 participants