Skip to content

Commit

Permalink
update pre-commit and ruff (#4052)
Browse files Browse the repository at this point in the history
This PR updates ruff (0.3.5 to 0.8.1) and pre-commit. It also includes a
few sorting and linting fixes that resulted from the ruff update.

---------

Co-authored-by: Falko Schindler <[email protected]>
  • Loading branch information
codingpaula and falkoschindler authored Nov 30, 2024
1 parent 8640b45 commit 25a6334
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 62 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ default_stages: [commit]

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.8.1
hooks:
- id: ruff
args: [--fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: &exclusions |
Expand Down
4 changes: 2 additions & 2 deletions examples/local_file_picker/local_file_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def update_grid(self) -> None:
}
for p in paths
]
if self.upper_limit is None and self.path != self.path.parent or \
self.upper_limit is not None and self.path != self.upper_limit:
if (self.upper_limit is None and self.path != self.path.parent) or \
(self.upper_limit is not None and self.path != self.upper_limit):
self.grid.options['rowData'].insert(0, {
'name': '📁 <strong>..</strong>',
'path': str(self.path.parent),
Expand Down
8 changes: 4 additions & 4 deletions nicegui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

__all__ = [
'APIRouter',
'app',
'App',
'Client',
'context',
'ElementFilter',
'Tailwind',
'__version__',
'app',
'context',
'elements',
'html',
'run',
'Tailwind',
'ui',
'__version__',
]
2 changes: 1 addition & 1 deletion nicegui/json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


__all__ = [
'NiceGUIJSONResponse',
'dumps',
'loads',
'NiceGUIJSONResponse'
]
4 changes: 2 additions & 2 deletions nicegui/native/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from .native_mode import activate, find_open_port

__all__ = [
'NativeConfig',
'WindowProxy',
'activate',
'find_open_port',
'method_queue',
'NativeConfig',
'response_queue',
'WindowProxy',
]
56 changes: 28 additions & 28 deletions nicegui/ui.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
__all__ = [
'element',
'add_body_html',
'add_css',
'add_head_html',
'add_sass',
'add_scss',
'aggrid',
'audio',
'avatar',
Expand All @@ -14,6 +18,7 @@
'chat_message',
'checkbox',
'chip',
'circular_progress',
'clipboard',
'code',
'codemirror',
Expand All @@ -26,11 +31,16 @@
'dark_mode',
'date',
'dialog',
'download',
'drawer',
'dropdown_button',
'echart',
'editor',
'element',
'expansion',
'footer',
'grid',
'header',
'highchart',
'html',
'icon',
Expand All @@ -46,7 +56,9 @@
'knob',
'label',
'leaflet',
'left_drawer',
'line_plot',
'linear_progress',
'link',
'link_target',
'list',
Expand All @@ -58,17 +70,26 @@
'mermaid',
'navigate',
'notification',
'notify',
'number',
'on',
'page',
'page_sticky',
'page_title',
'pagination',
'plotly',
'circular_progress',
'linear_progress',
'pyplot',
'query',
'radio',
'range',
'refreshable',
'refreshable_method',
'restructured_text',
'right_drawer',
'row',
'run',
'run_javascript',
'run_with',
'scene',
'scene_view',
'scroll_area',
Expand All @@ -79,49 +100,28 @@
'space',
'spinner',
'splitter',
'state',
'step',
'stepper',
'stepper_navigation',
'switch',
'table',
'tab',
'tab_panel',
'tab_panels',
'table',
'tabs',
'teleport',
'textarea',
'time',
'timer',
'timeline',
'timeline_entry',
'timer',
'toggle',
'tooltip',
'tree',
'update',
'upload',
'video',
'download',
'add_body_html',
'add_head_html',
'run_javascript',
'notify',
'page_title',
'refreshable',
'refreshable_method',
'state',
'add_css',
'add_sass',
'add_scss',
'update',
'page',
'drawer',
'footer',
'header',
'left_drawer',
'on',
'page_sticky',
'right_drawer',
'run',
'run_with',
]

from .context import context
Expand Down
58 changes: 38 additions & 20 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ numpy = [
]
selenium = "^4.11.2"
pyecharts = "^2.0.4"
ruff = ">=0.3.5"
pre-commit = ">=3.5.0"
ruff = ">=0.8.1"
pre-commit = [
{version = "<4.0.0", python = "<3.9"},
{version = ">=4.0.0", python = ">=3.9,<3.14"}
]
isort = "^5.11"
polars = [
{version = "^1.8.0", python = "~3.8"},
Expand Down Expand Up @@ -113,6 +116,7 @@ module = [
ignore_missing_imports = true

[tool.ruff]
target-version = "py38"
indent-width = 4
line-length = 120

Expand All @@ -130,6 +134,7 @@ select = [
]
fixable = [
"I", # isort
"RUF022", # `__all__` is not sorted
]
ignore = [
"E501", # line too long
Expand Down
2 changes: 1 addition & 1 deletion website/documentation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'create_intro',
'overview', # ensure documentation tree is built
'python_window',
'registry',
'redirects',
'registry',
'render_page',
]

0 comments on commit 25a6334

Please sign in to comment.