Skip to content

Commit 9c60129

Browse files
committed
feat: switch to ruff and uv
- Switch to `argparse` and clean up imports in `commands.py`. - Remove `requires-optional.txt` and `test_requirements/*` (put dependencies in `pyproject.toml` instead). - Remove `black` and use `ruff` instead. - Add `--noformat` option to `python commands.py codegen` for experimenting. - Pass output directory around to control what is formatted and linted. - Add `python commands.py format` to only do formatting. - Add `python commands.py lint` to check code. - Reformat comments in `codegen/*.py`. - Use double-quoted strings for (most) code generation. - Update various GitHub templates. - Update CONTRIBUTING.md to reflect switch from black to ruff: - Reorganize sections. - Rewrite chunks of prose. - Replace mentions of `black` with mentions of `ruff`. - And describe `uv` usage. Note: 1. Only the generated code is formatted and linted: - `plotly/validators/**/*.py` - `plotly/graph_objs/**/*.py` - `plotly/graph_objects/__init__.py` 2. The strings in the data used by code generation are (for example) `"'some_name'"` (i.e., have embedded single quotes). This PR does not try to fix that: instead, we rely on reformatting to turn all the single-quoted strings into double-quoted strings. 3. `CONTRIBUTING.md` refers to `pre-commit` and the old `requires-optional.txt` installed it, but there isn't a `.pre-commit-config.yaml` file in this repository. Wuzzup?
1 parent a76b656 commit 9c60129

14 files changed

+500
-628
lines changed

.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: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
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+
- [ ] Names colors are used instead of hex codes wherever possible.
2728
2829
## Code PR
2930
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).
31+
- [ ] 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.
32+
- [ ] I have added tests or modified existing tests.
33+
- [ ] For a new feature, I have added documentation examples (please see the doc checklist as well).
34+
- [ ] I have added a CHANGELOG entry if changing anything substantial.
35+
- [ ] For a new feature or a change in behavior, I have updated the relevant docstrings in the code.
3736
3837
-->

0 commit comments

Comments
 (0)