[go: up one dir, main page]

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

Replace flake8 with ruff #12605

Merged
merged 6 commits into from
Nov 16, 2022
Merged

Replace flake8 with ruff #12605

merged 6 commits into from
Nov 16, 2022

Conversation

bryevdv
Copy link
Member
@bryevdv bryevdv commented Nov 13, 2022

Hi @bokeh/core I became aware of ruff as a possible alternative to flake8 implemented in Rust, and created a branch just to experiment. I quickly became convinced that ruff is a dramatically better alternative, and I would very strongly encourage us to switch entirely.

  • Ruff is ~150-200x faster than flake8 on my machine, scanning the whole repo takes ~0.2s instead of ~20s. This is an enormous quality of life improvement for local dev. It's fast enough that I added it as an actual commit hook, which is terrific.
  • Shaving tens of seconds off several CI jobs will be nice as well
  • Ruff replaces two packages flake8 and flake8-pyi with a single package, and also allows top-level configuration to be further consolidated in to pyproject.toml
  • Ruff supports many more checks that we could consider adding over time
  • Ruff has finer grained exclusions, we can now properly check all the __init__.py we were skipping entirely, previously
  • Ruff detected several problems and improvements that flake8 was not, including at least one legitimate bug (see comment inline)

It's also potentially possible that Ruff could replace isort at some point as well. isort is the other very slow codebase check, so that would be nice. But I think it's too early for that (esp since we have different configs in different subdirs)

@@ -93,7 +93,7 @@
built_in_themes = {
CALIBER : Theme(json=_caliber.json),
DARK_MINIMAL : Theme(json=_dark_minimal.json),
LIGHT_MINIMAL : Theme(json=_caliber.json),
LIGHT_MINIMAL : Theme(json=_light_minimal.json),
Copy link
Member Author

Choose a reason for hiding this comment

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

This was an actual bug, not sure how long it has been this way

:refs: :ref:`ug_topics_images_colormapped`
:keywords: color, tools, scatter, data_map

'''
''' # noqa: E501
Copy link
Member Author

Choose a reason for hiding this comment

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

Some day we will get automatic api-linking in example code and do away with :apis: alogether, but until then, this is much nicer to work with long docstring lines.

@codecov
Copy link
codecov bot commented Nov 13, 2022

Codecov Report

Merging #12605 (9c1d360) into branch-3.1 (4627189) will not change coverage.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           branch-3.1   #12605   +/-   ##
===========================================
  Coverage       92.15%   92.15%           
===========================================
  Files             312      312           
  Lines           19560    19560           
===========================================
  Hits            18026    18026           
  Misses           1534     1534           

@mattpap mattpap added type: task tag: codebase Improvements to code quality without affecting any functionality. labels Nov 14, 2022
@mattpap mattpap added this to the 3.1 milestone Nov 14, 2022
@bryevdv
Copy link
Member Author
bryevdv commented Nov 14, 2022

@bokeh/core unless there are comments/objections, I will plan to merge this Wednesday.

@bryevdv
Copy link
Member Author
bryevdv commented Nov 16, 2022

Absent any further input in the last two days, I will merge this now.

@bryevdv bryevdv merged commit c9c0adf into branch-3.1 Nov 16, 2022
@bryevdv bryevdv deleted the bv/ruff branch November 16, 2022 17:46
@bryevdv
Copy link
Member Author
bryevdv commented Nov 16, 2022

Just for FYI: brand new version of ruff caught some additional spurious # noqa after merge, I pushed a tiny commit to fix directly: 1f73a5a

minghongx added a commit to minghongx/deeprl that referenced this pull request Dec 4, 2022
bryevdv added a commit that referenced this pull request Dec 6, 2022
* apply fixes

* stricter, more fixes

* more fixes, check __init__.py better

* remove flake8

* add U amd W checks

* combine imports
@bryevdv bryevdv mentioned this pull request Dec 6, 2022
bryevdv added a commit that referenced this pull request Dec 7, 2022
* Neutral POV for install instructions (#12603)

* Neutral POV for install instructions

* Update README.md

Co-authored-by: Moritz Schreiber <68053396+mosc9575@users.noreply.github.com>

Co-authored-by: Moritz Schreiber <68053396+mosc9575@users.noreply.github.com>

* Fix export with fractional CSS lengths (#12613)

* Fix layout propagation in nested mixed layouts (#12612)

* Replace flake8 with ruff (#12605)

* apply fixes

* stricter, more fixes

* more fixes, check __init__.py better

* remove flake8

* add U amd W checks

* combine imports

* remove spurious # noqa

* Remove LGTM (#12620)

LGTM service will shut down in a few weeks. 

https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/#end-of-november-new-commits-and-pull-requests-are-no-longer-analyzed

* Added metadata to glyphs.py, multi_legend.py, multi_scale.py (#12547)

* Added metadata to glyphs.py, multi_legend.py, multi_scale.py

* Removed trailing whitespaces.

* Pared down apis to the most interesting and put it in a single line.

* Added the apis in a single line and updated the keywords.

* Bv/deprecated apis in tests (#12622)

* pydot -> pygraphviz

* remove publish_display_data source param

* Exlude tmp files from coverage (#12629)

* exlude tmp files from coverage

* silence linter

* Update CodeQL action (#12630)

* Update CodeQL action

* kick the tires

* Fix application of UI element styles in Firefox (#12634)

* Add CodeQL config (#12636)

* codeql config in proper job

* Updates to Docker image building and testing (#12351)

* Updates to docker image building

* Support all non-firefox tests in docker container

* Try ECR upload

* Update ECR region and repository

* Chromedriver version does not have to match chrome version

* Try ECR upload

* Try adding custom registry alias

* try default registry alias

* Try default alias take 2

* specify public registry login

* fix registry type config

* Try dockerhub

* fix typo

* Try multiple tags

* Option to push or save image

* Github action to run tests in docker container

* Temporarily force BokehJS-CI to run

* Try to get docker testing to run in CI

* Run docker in CI using wheel

* Use entrypoint script to install from wheel

* Final tweaks

* Switch to docker testing using image named branch-3.1

* Add test running chromium in Docker without required envvar

* Move test-in-docker to separate workflow

* Better docker CI names

Co-authored-by: Bryan Van de Ven <bryan@bokeh.org>

* Disable docker from wheel integration tests (#12639)

* Added find_stack_level to util.warnings (#12650)

* Added find_stack_level to util.deprecation

* Moving deprecation -> warnings

* Change to use internal warn

* Fix import

* Fix lint

* Fix failing test

* Resolve issues with code quality checks (#12654)

* Use type[T] instead of Type[T] where permitted

* Pin ruff to last working version (0.0.144)

* Compute layout for initially undisplayed components (#12653)

* Fix broken bokeh-tree links (#12644)

* fix broken bokeh-tree links

* fix broken metadata ref

* more versioned links

* lint

* CodeQL: remove import linter hack (#12645)

* remove API import lint hack in properties.py

* remove API import lint hack in plotting/__init__.py

* remove API import lint hack in sampledata/__init__.py

* remove API import lint hack in document/__init__.py

* remove API import lint hack in embed/util.py

* remove API import lint hack in top level __init__.py

* remove API import lint hack in model/util.py

* clean up doc event imports

* clean up defaults tests imports

* remove non-functional spec.py

* review changes

* Add default styles to FILE template (#12656)

* Add default styles to FILE template

* Don't ignore template files

* Skip stocks and surface3d examples

* Adapt Bokeh logo for dark theme and add docs badge in README.md (#12659)

Co-authored-by: Moritz Schreiber <68053396+mosc9575@users.noreply.github.com>
Co-authored-by: Mateusz Paprocki <mattpap@gmail.com>
Co-authored-by: Yash Pratapwar <65851650+Yash-Pratapwar@users.noreply.github.com>
Co-authored-by: Ian Thomas <ianthomas23@gmail.com>
Co-authored-by: Simon Høxbro Hansen <simon.hansen@me.com>
Co-authored-by: Pavithra Eswaramoorthy <pavithraes@outlook.com>
@bryevdv bryevdv removed this from the 3.1 milestone Dec 7, 2022
@bryevdv bryevdv added this to the 3.0.3 milestone Dec 7, 2022
Chiemezuo pushed a commit to Chiemezuo/bokeh that referenced this pull request Aug 27, 2024
* apply fixes

* stricter, more fixes

* more fixes, check __init__.py better

* remove flake8

* add U amd W checks

* combine imports
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
reso: completed status: accepted tag: codebase Improvements to code quality without affecting any functionality. type: task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

light_minimal theme is missing
2 participants