Skip to content

Update pre-commit configuration, tools and codebase #743

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 11 commits into from
Aug 23, 2024

Conversation

EwoutH
Copy link
Contributor

@EwoutH EwoutH commented Aug 21, 2024

This PR performs some maintenance on the pre-commit configuration and codebase to ensure consistency with the latest Python standards and enhanced code quality checks.

Updates include:

  • Addition of pyupgrade hook: Ensures the code uses the latest Python syntax supported by the project.
  • Update ruff hook version: Upgraded to v0.6.1 from the current official repository for better linting capabilities.
  • Python version updates: Adjusted CI configurations to support Python 3.9 and 3.12, aligning with pre-commit's supported versions.
  • Codebase refinements: Replaced equality checks with is for type comparisons and removed redundant variables, improving overall code readability.
  • Jupyter Notebooks support: Expanded ruff linting to include Jupyter Notebooks by default.
  • Added check-toml hook: Ensures TOML files are correctly formatted.
  • Fixed warnings in mypy hook: Updated syntax and resolved configuration warnings.

All test and pre-commit passes again.

Consider also merging #742 to keep the configuration up to date in the future.

You can squash while merging, but the commit messages actually contain some useful information, so consider not to.

EwoutH added 9 commits August 21, 2024 07:47
pyupgrade ensures the latest Python syntax supported is used.
check yaml...............................................................Passed
fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing packages/solara-widget-manager8/tsconfig.json
Fixing packages/solara-widget-manager8/src
Fixing packages/solara-widget-manager8/style

trim trailing whitespace.................................................Passed
pyupgrade................................................................Failed
- hook id: pyupgrade
- exit code: 1
- files were modified by this hook

Rewriting solara/website/pages/doc_use_download.py

codespell................................................................Passed
ruff.....................................................................Passed
ruff-format..............................................................Passed
mypy.....................................................................Passed
Use the latest ruff version (v0.6.1) from the current official ruff repo
Fix ruff E721 Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
Fix ruff F811 in solara\toestand.py:148:40: F811 Redefinition of unused `stack` from line 147
Ruff now also works on Jupyter notebooks by default
This reverts commit f530ef8.
Python 3.9 is the lowest version pre-commit supports. See pre-commit/pre-commit#3042
@EwoutH
Copy link
Contributor Author

EwoutH commented Aug 21, 2024

It seems we need to make an exception for solara-widget-manager, because for some reason they can't have a newline end-of-file: e958e55

Edit: Nevermind, it looks like it just didn't like the Windows line endings.

image

EwoutH added 2 commits August 21, 2024 08:12
Fix: [WARNING] The 'exclude' field in hook 'mypy' is a regex, not a glob -- matching '/*' probably isn't what you want here

In regex, `.` matches any character except a newline, and `*` matches zero or more of the preceding element (in this case, any character). `.*` effectively replaces the `/*` glob pattern.
@EwoutH EwoutH marked this pull request as ready for review August 21, 2024 06:28
@EwoutH
Copy link
Contributor Author

EwoutH commented Aug 21, 2024

The GitHub Actions workflows also need quite some maintenance, but let's keep this PR focussed on the pre-commit configuration.

Ready for review.

@maartenbreddels maartenbreddels merged commit 361b02e into widgetti:master Aug 23, 2024
20 of 21 checks passed
@EwoutH EwoutH deleted the pre-commit branch August 25, 2024 09:16
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.

2 participants