Skip to content

Commit fbb65c8

Browse files
authored
Merge pull request #5218 from plotly/switch-to-ruff
switch to ruff
2 parents 1ec864b + 0db8555 commit fbb65c8

File tree

1,227 files changed

+6435
-7444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,227 files changed

+6435
-7444
lines changed

.circleci/config.yml

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ commands:
2525
curl -LsSf https://astral.sh/uv/install.sh | sh
2626
uv venv
2727
source .venv/bin/activate
28-
uv pip install .
29-
uv pip install -r ./test_requirements/requirements_core.txt
28+
uv lock --check
29+
uv sync --extra dev_core
3030
- run:
3131
name: List installed packages and python version
3232
command: |
@@ -56,8 +56,7 @@ commands:
5656
curl -LsSf https://astral.sh/uv/install.sh | sh
5757
uv venv
5858
source .venv/bin/activate
59-
uv pip install .
60-
uv pip install -r ./test_requirements/requirements_optional.txt
59+
uv sync --extra dev_optional
6160
6261
- when:
6362
condition:
@@ -70,8 +69,7 @@ commands:
7069
name: Install pandas
7170
command: |
7271
source .venv/bin/activate
73-
uv pip install pip
74-
python -m pip install pandas==<<parameters.pandas_version>> numpy==<<parameters.numpy_version>>
72+
uv pip install pandas==<<parameters.pandas_version>> numpy==<<parameters.numpy_version>>
7573
7674
- run:
7775
name: Test core
@@ -125,8 +123,7 @@ commands:
125123
curl -LsSf https://astral.sh/uv/install.sh | sh
126124
uv venv
127125
source .venv/bin/activate
128-
uv pip install .
129-
uv pip install -r ./test_requirements/requirements_optional.txt
126+
uv sync --extra dev_optional
130127
# Install Kaleido v0 instead of the v1 specified in requirements_optional.txt
131128
uv pip uninstall kaleido
132129
uv pip install kaleido==0.2.1
@@ -151,16 +148,16 @@ jobs:
151148
steps:
152149
- checkout
153150
- run:
154-
name: Install black
151+
name: Install ruff
155152
command: |
156-
python -m venv venv
157-
. venv/bin/activate
158-
pip install black==25.1.0
153+
uv venv
154+
source .venv/bin/activate
155+
uv sync --extra dev_core
159156
- run:
160-
name: Check formatting with black
157+
name: Check handwritten code with ruff
161158
command: |
162-
. venv/bin/activate
163-
black --check . --exclude venv
159+
source .venv/bin/activate
160+
ruff format --check .
164161
165162
test_core_py:
166163
parameters:
@@ -226,22 +223,20 @@ jobs:
226223
curl -LsSf https://astral.sh/uv/install.sh | sh
227224
uv venv
228225
source .venv/bin/activate
229-
uv pip install -e .
230-
uv pip install -r test_requirements/requirements_optional.txt
226+
uv sync --extra dev_optional
231227
232228
- run:
233-
name: Build html figures (Pandas 2)
229+
name: Build HTML figures (Pandas 2)
234230
command: |
235231
source .venv/bin/activate
236232
python tests/percy/plotly-express.py
237233
- run:
238-
name: Build html figures (Pandas 1) and compare
234+
name: Build HTML figures (Pandas 1) and compare
239235
command: |
240236
source .venv/bin/activate
241237
mkdir tests/percy/pandas2
242238
mv tests/percy/*.html tests/percy/pandas2/
243-
uv pip install pip
244-
python -m pip install pandas==1.5.3 numpy==1.26.4
239+
uv pip install pandas==1.5.3 numpy==1.26.4
245240
python tests/percy/plotly-express.py
246241
python tests/percy/compare-pandas.py
247242
rm -rf tests/percy/pandas2
@@ -273,8 +268,7 @@ jobs:
273268
curl -LsSf https://astral.sh/uv/install.sh | sh
274269
uv venv
275270
source .venv/bin/activate
276-
uv pip install -e .
277-
uv pip install -r ./test_requirements/requirements_core.txt black inflect jupyterlab
271+
uv sync --extra dev_optional
278272
- run:
279273
name: Update plotly.js to dev
280274
command: |
@@ -291,7 +285,7 @@ jobs:
291285
name: Build source distribution packages
292286
command: |
293287
source .venv/bin/activate
294-
uv pip install build
288+
uv sync --extra dev_build
295289
python -m build --sdist --wheel -o dist
296290
when: always
297291
- store_artifacts:
@@ -312,8 +306,7 @@ jobs:
312306
curl -LsSf https://astral.sh/uv/install.sh | sh
313307
uv venv
314308
source .venv/bin/activate
315-
uv pip install build
316-
uv pip install jupyter
309+
uv sync --extra dev_build
317310
cd js
318311
npm ci
319312
npm run build
@@ -439,6 +432,7 @@ jobs:
439432
- store_artifacts:
440433
path: doc/build
441434
destination: doc/build
435+
442436
workflows:
443437
code_formatting:
444438
jobs:
@@ -449,7 +443,6 @@ workflows:
449443
release_build:
450444
jobs:
451445
- full_build
452-
453446
build:
454447
jobs:
455448
- test_core_py:
@@ -483,4 +476,4 @@ workflows:
483476
python_version:
484477
- "3.12"
485478
- python_311_percy
486-
- build-doc
479+
- build-doc

.github/ISSUE_TEMPLATE.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
Thanks for your interest in Plotly.py!
1+
Thanks for your interest in Plotly.py.
2+
Before opening an issue, please:
23

3-
Before opening an issue, please search for existing and closed issues :)
4+
- Use the [latest version](https://github.com/plotly/plotly.py/blob/main/CHANGELOG.md) of plotly.py in your report unless not applicable.
5+
- Search for existing and closed issues.
6+
- Include a minimal reproducible example with bug reports.
47

5-
**Please** accompany bug reports with a reproducible example. Please use the [latest version](https://github.com/plotly/plotly.py/blob/main/CHANGELOG.md) of plotly.py in your report unless not applicable.
6-
7-
Note that GitHub Issues are meant to be used for bug reports and feature requests only. Implementation or usage questions should be asked on [community.plotly.com](https://community.plotly.com/c/graphing-libraries/python/10) or on Stack Overflow (tagged [`plotly`](https://stackoverflow.com/questions/tagged/plotly)).
8+
Note that GitHub Issues are meant to be used for bug reports and feature requests.
9+
Questions about usage should be asked on [community.plotly.com](https://community.plotly.com/c/graphing-libraries/python/10).

.github/pull_request_template.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
<!--
2-
Please uncomment this block and take a look at this checklist if your PR is making substantial changes to **documentation**/impacts files in the `doc` directory. Check all that apply to your PR, and leave the rest unchecked to discuss with your reviewer! Not all boxes must be checked for every PR :)
2+
Please uncomment this block and fill in this checklist if your PR makes substantial changes to documentation in the `doc` directory.
3+
Not all boxes must be checked for every PR:
4+
check those that apply to your PR and leave the rest unchecked to discuss with your reviewer.
35
4-
If your PR modifies code of the `plotly` package, we have a different checklist
5-
below :-).
6+
If your PR modifies code of the `plotly` package, we have a different checklist below.
67
7-
### Documentation PR
8+
## Documentation PR
89
9-
- [ ] I've [seen the `doc/README.md` file](https://github.com/plotly/plotly.py/blob/main/doc/README.md)
10-
- [ ] This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `main` branch
11-
- [ ] If this PR modifies the first example in a page or adds a new one, it is a `px` example if at all possible
12-
- [ ] Every new/modified example has a descriptive title and motivating sentence or paragraph
13-
- [ ] Every new/modified example is independently runnable
14-
- [ ] Every new/modified example is optimized for short line count and focuses on the Plotly/visualization-related aspects of the example rather than the computation required to produce the data being visualized
15-
- [ ] Meaningful/relatable datasets are used for all new examples instead of randomly-generated data where possible
16-
- [ ] The random seed is set if using randomly-generated data in new/modified examples
17-
- [ ] New/modified remote datasets are loaded from https://plotly.github.io/datasets and added to https://github.com/plotly/datasets
18-
- [ ] Large computations are avoided in the new/modified examples in favour of loading remote datasets that represent the output of such computations
19-
- [ ] Imports are `plotly.graph_objects as go` / `plotly.express as px` / `plotly.io as pio`
20-
- [ ] Data frames are always called `df`
21-
- [ ] `fig = <something>` call is high up in each new/modified example (either `px.<something>` or `make_subplots` or `go.Figure`)
22-
- [ ] Liberal use is made of `fig.add_*` and `fig.update_*` rather than `go.Figure(data=..., layout=...)` in every new/modified example
23-
- [ ] Specific adders and updaters like `fig.add_shape` and `fig.update_xaxes` are used instead of big `fig.update_layout` calls in every new/modified example
24-
- [ ] `fig.show()` is at the end of each new/modified example
25-
- [ ] `plotly.plot()` and `plotly.iplot()` are not used in any new/modified example
26-
- [ ] Hex codes for colors are not used in any new/modified example in favour of [these nice ones](https://github.com/plotly/plotly.py/issues/2192)
10+
- [ ] I have seen the [`doc/README.md`](https://github.com/plotly/plotly.py/blob/main/doc/README.md) file.
11+
- [ ] This change runs in the current version of Plotly on PyPI and targets the `doc-prod` branch OR it targets the `main` branch.
12+
- [ ] If this PR modifies the first example in a page or adds a new one, it is a `px` example if at all possible.
13+
- [ ] Every new/modified example has a descriptive title and motivating sentence or paragraph.
14+
- [ ] Every new/modified example is independently runnable.
15+
- [ ] Every new/modified example is optimized for short line count and focuses on the Plotly/visualization-related aspects of the example rather than the computation required to produce the data being visualized.
16+
- [ ] Meaningful/relatable datasets are used for all new examples instead of randomly-generated data where possible.
17+
- [ ] The random seed is set if using randomly-generated data.
18+
- [ ] New/modified remote datasets are loaded from https://plotly.github.io/datasets and added to https://github.com/plotly/datasets.
19+
- [ ] Large computations are avoided in the new/modified examples in favour of loading remote datasets that represent the output of such computations.
20+
- [ ] Imports are `plotly.graph_objects as go`, `plotly.express as px`, and/or `plotly.io as pio`.
21+
- [ ] Data frames are always called `df`.
22+
- [ ] `fig = <something>` is called high up in each new/modified example (either `px.<something>` or `make_subplots` or `go.Figure`).
23+
- [ ] Liberal use is made of `fig.add_*` and `fig.update_*` rather than `go.Figure(data=..., layout=...)`.
24+
- [ ] Specific adders and updaters like `fig.add_shape` and `fig.update_xaxes` are used instead of big `fig.update_layout` calls.
25+
- [ ] `fig.show()` is at the end of each example.
26+
- [ ] `plotly.plot()` and `plotly.iplot()` are not used in any example.
27+
- [ ] Named colors are used instead of hex codes wherever possible.
28+
- [ ] Code blocks are marked with `&#96;&#96;&#96;python`.
2729
2830
## Code PR
2931
30-
- [ ] I have read through the [contributing notes](https://github.com/plotly/plotly.py/blob/main/CONTRIBUTING.md) and understand the structure of the package. In particular, if my PR modifies code of `plotly.graph_objects`, my modifications concern the `codegen` files and not generated files.
31-
- [ ] I have added tests (if submitting a new feature or correcting a bug) or
32-
modified existing tests.
33-
- [ ] For a new feature, I have added documentation examples in an existing or
34-
new tutorial notebook (please see the doc checklist as well).
35-
- [ ] I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
36-
- [ ] For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).
32+
- [ ] I have read through the [contributing notes](https://github.com/plotly/plotly.py/blob/main/CONTRIBUTING.md) and understand the structure of the package. In particular, if my PR modifies code of `plotly.graph_objects`, my modifications concern the code generator and *not* the generated files.
33+
- [ ] I have added tests or modified existing tests.
34+
- [ ] For a new feature, I have added documentation examples (please see the doc checklist as well).
35+
- [ ] I have added a CHANGELOG entry if changing anything substantial.
36+
- [ ] For a new feature or a change in behavior, I have updated the relevant docstrings in the code.
3737
3838
-->

0 commit comments

Comments
 (0)