plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

switch to ruff

Open gvwilson opened this issue 7 months ago • 5 comments

  • Remove requires-optional.txt and test_requirements/* (no longer used).
  • Convert commands.py to use argparse instead of hand-rolled.
  • Rationalize imports in codegen/__init__.py (all at top level).
  • Update "dev" section of pyproject.toml to use ruff instead of black.
  • Update pyproject.toml to install inflect and requests.
  • Modify uv.lock file.
  • Modify code reformatting in codegen/__init__.py to use ruff instead of black.
  • Add new function to use ruff to reformat existing code (run python commands.py format).
  • Add new function to use ruff to check code (run python commands.py lint).
  • Regenerate and reformat code.

This PR has been rebuilt on top of #5214 to include recent changes to validator generation.

This PR currently fails the build because Circle CI is expecting requires-optional.txt, which this PR removes. We need to decide if we're leaving build on Circle CI or moving it to GitHub.

gvwilson avatar Jun 05 '25 13:06 gvwilson

@gvwilson big picture comments --

  • I have a STRONG preference for also committing the ruff-formatted files as part of this PR. (To avoid cluttering up this PR, the formatting changes themselves could be done on a separate branch which branches off of this one.) But if we don't do the actual formatting step as part of this PR, we'll miss issues and then have to fix them later once this is on main.

  • The CONTRIBUTING.md needs to be updated to remove references to requires-optional.txt, and it needs some general updates as well. I'd be happy to work on that.

  • Could we add the uv.lock in a separate PR? I'm not opposed, but CONTRIBUTING.md needs to be updated to explain how to use the lockfile in development, otherwise things will get messy.

emilykl avatar Jun 05 '25 15:06 emilykl

What would you think of adding an item to the pull request template documentations section that recommends:

[ ] start Python code blocks with ```python?

It's something that is not obvious in the checklist and that I've forgotten to do a couple times. Forgetting to do so can prevent the example from displaying.

rl-utility-man avatar Jun 10 '25 03:06 rl-utility-man

@gvwilson Add this line to the dev_optional extra in pyproject.toml; we had it in test_requirements/requires_optional.txt and I believe it will fix the Python 3.8 failure in the CI.

"fiona<=1.9.6;python_version<='3.8'"  # fiona>1.9.6 is not compatible with geopandas<1; geopandas>=1 is not compatible with python 3.8

emilykl avatar Jun 11 '25 15:06 emilykl

@gvwilson Are we switching to use the ruff linter in addition to the formatter? We can do that but it's a much bigger change than just using the formatter.

emilykl avatar Jun 11 '25 21:06 emilykl

@emilykl clean build - I've put anywidget in dev_core because core tests require it. Let me know what you think?

gvwilson avatar Jun 12 '25 17:06 gvwilson