Skip to content

Commit d09974c

Browse files
Merge pull request #363 from tpvasconcelos/ruff-py310
Upgrade ruff's target Python version to 3.10
2 parents f15be83 + 6d8fd2a commit d09974c

44 files changed

Lines changed: 144 additions & 94 deletions

Some content is hidden

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

.cursor/worktrees.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"setup-worktree": [
3+
"make init"
4+
]
5+
}

.github/workflows/ci.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ jobs:
6464
# - windows-latest
6565
fail-fast: true
6666
runs-on: ${{ matrix.os }}
67+
env:
68+
DIFF_AGAINST: HEAD
6769
timeout-minutes: 8
6870
steps:
6971
- uses: actions/checkout@v5
@@ -84,28 +86,20 @@ jobs:
8486
- name: Run unit tests
8587
shell: bash
8688
run: tox -e tests-unit
87-
env:
88-
DIFF_AGAINST: HEAD
8989

9090
- name: Run E2E tests
9191
shell: bash
9292
run: tox -e tests-e2e
93-
env:
94-
DIFF_AGAINST: HEAD
9593

9694
- name: Test the CI/CD utilities
9795
shell: bash
9896
run: tox -e tests-cicd_utils
99-
env:
100-
DIFF_AGAINST: HEAD
10197

10298
# Combine coverage reports from all test suites
10399

104100
- name: Combine coverage reports
105101
shell: bash
106102
run: tox -e coverage-combine
107-
env:
108-
DIFF_AGAINST: HEAD
109103

110104
# Upload coverage reports to Codecov
111105

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# ============================================================================
44

55
docs/_static/charts/*.html
6+
docs/_static/js/plotly.min.js
67
docs/api/autogen
78
docs/api/public
89

MANIFEST.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,25 @@ include docs/Makefile
2121
include docs/make.bat
2222
include docs/robots.txt
2323
include docs/_static/favicon.ico
24+
exclude docs/_static/js/plotly.min.js
2425
recursive-include docs *.md *.py *.rst
2526
recursive-include docs/_static/charts *.webp
2627
recursive-include docs/_static/css *.css
27-
recursive-include docs/_static/img *.png *.webp *.svg *.gif *.jpg
28+
recursive-include docs/_static/img *.png *.webp *.svg *.gif *.jpeg
2829
recursive-include docs/_static/js *.js
2930
recursive-include docs/_templates *.html
3031
prune docs/_build
3132
prune docs/api/autogen
3233
prune docs/api/public
3334

3435
# Misc
36+
recursive-include .cursor *.json
3537
recursive-include .github *.yml *.yaml
3638
recursive-include cicd_utils README.md *.py *.sh
3739
recursive-include misc *.py *.ipynb *.txt *.png
3840
recursive-include requirements *.txt
3941
recursive-include tests *.py
40-
recursive-include tests/e2e/artifacts *.jpeg *.json
42+
recursive-include tests/e2e/artifacts *.json
4143

4244
# Globally excluded patterns
4345
recursive-exclude * *.py[cod] *.egg-info __pycache__ .ipynb_checkpoints/*

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ clean-docs: ## remove documentation build artifacts
9696
@echo "==> Removing documentation build artifacts..."
9797
@rm -fr docs/_build/ docs/api/autogen/ docs/api/public/
9898
@find . -wholename 'docs/_static/charts/*.html' -exec rm -fr {} +
99+
@rm -f docs/_static/js/plotly.min.js
99100

100101

101102
.PHONY: clean-build

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ The full official documentation can be found at: https://ridgeplot.readthedocs.i
4646

4747
### Basic example
4848

49-
For those in a hurry, here's a very basic example on how to quickly get started with [ridgeplot()](https://ridgeplot.readthedocs.io/en/stable/api/public/ridgeplot.ridgeplot.html) function.
49+
For those in a hurry, here's a very basic example on how to quickly get started with the [ridgeplot()](https://ridgeplot.readthedocs.io/en/stable/api/public/ridgeplot.ridgeplot.html) function.
5050

5151
```python
5252
import numpy as np
5353
from ridgeplot import ridgeplot
5454

55-
my_samples = [np.random.normal(n / 1.2, size=600) for n in range(7, 0, -1)]
55+
my_samples = [np.random.normal(n, size=900) for n in range(6, 0, -2)]
5656
fig = ridgeplot(samples=my_samples)
5757
fig.show()
5858
```

cicd_utils/ridgeplot_examples/_base.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ class Example:
7070

7171
def __post_init__(self) -> None:
7272
self.fig = self.figure_factory() # pyright: ignore[reportUninitializedInstanceVariable]
73+
74+
# Both `width` and `height` should be set in all example plots
75+
if self.fig.layout.width != 800:
76+
raise ValueError("All figures must have width 800")
77+
if not isinstance(self.fig.layout.height, int):
78+
raise ValueError("All figures must have an explicit height declared") # noqa: TRY004
79+
7380
round_fig_data(self.fig, sig_figs=8)
7481

7582
def to_json(self) -> str:
@@ -86,8 +93,6 @@ def write_json(self, path: Path) -> None:
8693
def write_html(self, path: Path, minify_html: bool) -> None:
8794
fig = deepcopy(self.fig)
8895

89-
if fig.layout.height is None:
90-
raise ValueError("The Figure's layout.height value must be explicitly set.")
9196
# Overriding the width to None results in a '100%' CSS width.
9297
# This is achieved by setting the `default_width` parameter
9398
# in `fig.to_html()` to "100%" (see below).
@@ -140,6 +145,8 @@ def write_webp(self, path: Path) -> None:
140145
engine="kaleido",
141146
)
142147

148+
# This method isn't used anywhere anymore but
149+
# will be kept here for potential future use
143150
def write_jpeg(self, path: Path) -> None:
144151
fig = deepcopy(self.fig)
145152
fig = tighten_margins(fig, px=40)

cicd_utils/ridgeplot_examples/_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def main() -> go.Figure:
1212
from ridgeplot import ridgeplot
1313

1414
rng = np.random.default_rng(42)
15-
my_samples = [rng.normal(n / 1.2, size=600) for n in range(6, 0, -1)]
15+
my_samples = [rng.normal(n, size=900) for n in range(6, 0, -2)]
1616
fig = ridgeplot(samples=my_samples)
17-
fig.update_layout(height=350, width=800)
17+
fig.update_layout(height=400, width=800)
1818

1919
return fig
2020

cicd_utils/ridgeplot_examples/_basic_hist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def main() -> go.Figure:
1212
from ridgeplot import ridgeplot
1313

1414
rng = np.random.default_rng(42)
15-
my_samples = [rng.normal(n / 1.2, size=600) for n in range(6, 0, -1)]
16-
fig = ridgeplot(samples=my_samples, nbins=20)
17-
fig.update_layout(height=350, width=800)
15+
my_samples = [rng.normal(n, size=900) for n in range(6, 0, -2)]
16+
fig = ridgeplot(samples=my_samples, nbins=18)
17+
fig.update_layout(height=400, width=800)
1818

1919
return fig
2020

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ livehtml:
2727
--watch=../src/ridgeplot \
2828
--re-ignore 'api/public/.*' \
2929
--re-ignore '_static/charts/.*' \
30-
--re-ignore '_static/js/plotly.min.js' \
30+
--re-ignore '_static/js/plotly.*' \
3131
"$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

0 commit comments

Comments
 (0)