Skip to content

Commit 357f1fd

Browse files
committed
build: switch to uv and drop python 3.8 support
1 parent c15a064 commit 357f1fd

File tree

14 files changed

+1350
-1078
lines changed

14 files changed

+1350
-1078
lines changed

.github/workflows/lint.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
13+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python-version }}
20-
- uses: abatilo/actions-poetry@v3
21-
- run: poetry install --all-extras
22-
- run: poetry run ruff check
23-
- run: poetry run ruff format --check --diff
24-
- run: poetry run mypy .
20+
- uses: astral-sh/setup-uv@v5
21+
with:
22+
version: 0.6.3
23+
python-version: ${{ matrix.python-version }}
24+
enable-cache: true
25+
cache-dependency-glob: "uv.lock"
26+
- run: uv sync --all-extras
27+
- run: uv run ruff check
28+
- run: uv run ruff format --check --diff
29+
- run: uv run mypy .

.github/workflows/release-please.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ jobs:
2929
- uses: actions/checkout@v4
3030
- uses: actions/setup-python@v5
3131
with:
32-
python-version: "3.12"
33-
- uses: abatilo/actions-poetry@v3
34-
- run: poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
35-
- run: poetry publish --build
32+
python-version-file: "pyproject.toml"
33+
- uses: astral-sh/setup-uv@v5
34+
with:
35+
version: 0.6.3
36+
enable-cache: true
37+
cache-dependency-glob: "uv.lock"
38+
- run: uv build
39+
- run: uv publish

.github/workflows/test.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
on:
22
push:
33
paths:
4-
- '**.py'
5-
- 'poetry.toml'
6-
- 'poetry.lock'
7-
- 'pyproject.toml'
4+
- "**.py"
5+
- "pyproject.toml"
6+
- "uv.lock"
87

98
name: test
109

@@ -13,13 +12,18 @@ jobs:
1312
strategy:
1413
fail-fast: false
1514
matrix:
16-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1716
runs-on: ubuntu-latest
1817
steps:
1918
- uses: actions/checkout@v4
2019
- uses: actions/setup-python@v5
2120
with:
2221
python-version: ${{ matrix.python-version }}
23-
- uses: abatilo/actions-poetry@v3
24-
- run: poetry install --all-extras
25-
- run: poetry run pytest --cov catppuccin
22+
- uses: astral-sh/setup-uv@v5
23+
with:
24+
version: 0.6.3
25+
python-version: "${{ matrix.python-version }}"
26+
enable-cache: true
27+
cache-dependency-glob: "uv.lock"
28+
- run: uv sync --all-extras
29+
- run: uv run pytest --cov catppuccin

README.md

Lines changed: 90 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ get_style_by_name("catppuccin-frappe")
106106

107107
The following style names are available:
108108

109-
- `catppuccin-latte`
110-
- `catppuccin-frappe`
111-
- `catppuccin-macchiato`
112-
- `catppuccin-mocha`
109+
- `catppuccin-latte`
110+
- `catppuccin-frappe`
111+
- `catppuccin-macchiato`
112+
- `catppuccin-mocha`
113113

114114
They can also be accessed by directly importing them:
115115

@@ -137,53 +137,59 @@ The library tries to register styles and colormaps if `matplotlib` is installed.
137137
See the examples below for some use cases:
138138

139139
1. Load a style, using `mpl.style.use`
140-
```python
141-
import catppuccin
142-
import matplotlib as mpl
143-
import matplotlib.pyplot as plt
144-
145-
mpl.style.use(catppuccin.PALETTE.mocha.identifier)
146-
plt.plot([0,1,2,3], [1,2,3,4])
147-
plt.show()
148-
```
140+
141+
```python
142+
import catppuccin
143+
import matplotlib as mpl
144+
import matplotlib.pyplot as plt
145+
146+
mpl.style.use(catppuccin.PALETTE.mocha.identifier)
147+
plt.plot([0,1,2,3], [1,2,3,4])
148+
plt.show()
149+
```
150+
149151
1. Mix it with different stylesheets!
150-
```python
151-
import catppuccin
152-
import matplotlib as mpl
153-
import matplotlib.pyplot as plt
154-
155-
mpl.style.use(["ggplot", catppuccin.PALETTE.mocha.identifier])
156-
plt.plot([0,1,2,3], [1,2,3,4])
157-
plt.show()
158-
```
152+
153+
```python
154+
import catppuccin
155+
import matplotlib as mpl
156+
import matplotlib.pyplot as plt
157+
158+
mpl.style.use(["ggplot", catppuccin.PALETTE.mocha.identifier])
159+
plt.plot([0,1,2,3], [1,2,3,4])
160+
plt.show()
161+
```
162+
159163
1. Load individual colors
160-
```python
161-
import matplotlib.pyplot as plt
162-
import catppuccin
163-
from catppuccin.extras.matplotlib import load_color
164-
165-
color = load_color(catppuccin.PALETTE.latte.identifier, "peach")
166-
plt.plot([0,1,2,3], [1,2,3,4], color=color)
167-
plt.show()
168-
```
164+
165+
```python
166+
import matplotlib.pyplot as plt
167+
import catppuccin
168+
from catppuccin.extras.matplotlib import load_color
169+
170+
color = load_color(catppuccin.PALETTE.latte.identifier, "peach")
171+
plt.plot([0,1,2,3], [1,2,3,4], color=color)
172+
plt.show()
173+
```
174+
169175
1. Define custom colormaps
170-
```python
171-
import matplotlib.pyplot as plt
172-
import numpy as np
173-
import catppuccin
174-
from catppuccin.extras.matplotlib import get_colormap_from_list
175176

176-
cmap = get_colormap_from_list(
177-
catppuccin.PALETTE.frappe.identifier,
178-
["red", "peach", "yellow", "green"],
179-
)
180-
rng = np.random.default_rng()
181-
data = rng.integers(2, size=(30, 30))
177+
```python
178+
import matplotlib.pyplot as plt
179+
import numpy as np
180+
import catppuccin
181+
from catppuccin.extras.matplotlib import get_colormap_from_list
182182

183-
plt.imshow(data, cmap=cmap)
184-
plt.show()
185-
```
183+
cmap = get_colormap_from_list(
184+
catppuccin.PALETTE.frappe.identifier,
185+
["red", "peach", "yellow", "green"],
186+
)
187+
rng = np.random.default_rng()
188+
data = rng.integers(2, size=(30, 30))
186189

190+
plt.imshow(data, cmap=cmap)
191+
plt.show()
192+
```
187193

188194
## Contribution
189195

@@ -193,14 +199,14 @@ first!
193199

194200
### Development
195201

196-
This project is maintained with [Poetry](https://python-poetry.org). If you
197-
don't have Poetry yet, you can install it using the [installation
198-
instructions](https://python-poetry.org/docs/#installation).
202+
This project is maintained with [uv](https://docs.astral.sh/uv/). If you
203+
don't have uv yet, you can install it using the [installation
204+
instructions](https://docs.astral.sh/uv/getting-started/installation/).
199205

200206
Install the project's dependencies including extras:
201207

202208
```bash
203-
poetry install --all-extras
209+
uv sync --all-extras
204210
```
205211

206212
#### Codegen
@@ -210,27 +216,51 @@ poetry install --all-extras
210216
To update after downloading a new palette JSON file:
211217

212218
```console
213-
poetry run python build.py
219+
uv run build.py
214220
```
215221

216222
Formatting this file is done manually as with any other file, see [`Code Standards`](#code-standards) below.
217223

218224
#### Code Standards
219225

220-
Before committing changes, it is recommended to run the following tools to
221-
ensure consistency in the codebase.
226+
All of the tools listed in this section are automatically installed by uv as
227+
part of the `dev` dependency group.
222228

223-
```bash
224-
ruff format
225-
ruff check
226-
mypy .
227-
pytest --cov catppuccin
229+
##### Unit Tests
230+
231+
Tests are run with [`pytest`](https://docs.pytest.org/en/stable/).
232+
233+
To run tests and display coverage:
234+
235+
```console
236+
$ pytest --cov catppuccin
228237
```
229238

230-
These tools are all installed as part of the `dev` dependency group with
231-
Poetry. You can use `poetry shell` to automatically put these tools in your
232-
path.
239+
##### Type Checking
233240

241+
Type checking is performed by [`mypy`](https://www.mypy-lang.org/).
242+
243+
To run type checks:
244+
245+
```console
246+
$ mypy .
247+
```
248+
249+
##### Lints and Formatting
250+
251+
Code linting and formatting is done by [`ruff`](https://docs.astral.sh/ruff/).
252+
253+
To lint the code:
254+
255+
```console
256+
$ ruff check
257+
```
258+
259+
To format the code:
260+
261+
```console
262+
$ ruff format
263+
```
234264

235265
## 💝 Thanks to
236266

catppuccin/extras/matplotlib.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99

1010
from dataclasses import asdict
1111
from pathlib import Path
12-
from typing import Iterable, cast
12+
from typing import TYPE_CHECKING, cast
1313

1414
import matplotlib as mpl
1515
import matplotlib.colors
1616
import matplotlib.style
1717

1818
from catppuccin.palette import PALETTE
1919

20+
if TYPE_CHECKING:
21+
from collections.abc import Iterable
22+
2023
CATPPUCCIN_STYLE_DIRECTORY = Path(__file__).parent / "matplotlib_styles"
2124
DEFAULT_COLORMAP_COLORS = ("base", "blue")
2225

catppuccin/extras/matplotlib_styles/frappe.mplstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ grid.color: 414559
3232

3333
# Boxplots: Overlay 0
3434
boxplot.flierprops.color: 737994
35-
boxplot.flierprops.markerfacecolor: 737994
35+
boxplot.flierprops.markerfacecolor: 737994
3636
boxplot.flierprops.markeredgecolor: 737994
3737
boxplot.boxprops.color: 737994
3838
boxplot.whiskerprops.color: 737994

catppuccin/extras/matplotlib_styles/latte.mplstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ grid.color: ccd0da
3232

3333
# Boxplots: Overlay 0
3434
boxplot.flierprops.color: 9ca0b0
35-
boxplot.flierprops.markerfacecolor: 9ca0b0
35+
boxplot.flierprops.markerfacecolor: 9ca0b0
3636
boxplot.flierprops.markeredgecolor: 9ca0b0
3737
boxplot.boxprops.color: 9ca0b0
3838
boxplot.whiskerprops.color: 9ca0b0

catppuccin/extras/matplotlib_styles/macchiato.mplstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ grid.color: 363a4f
3232

3333
# Boxplots: Overlay 0
3434
boxplot.flierprops.color: 6e738d
35-
boxplot.flierprops.markerfacecolor: 6e738d
35+
boxplot.flierprops.markerfacecolor: 6e738d
3636
boxplot.flierprops.markeredgecolor: 6e738d
3737
boxplot.boxprops.color: 6e738d
3838
boxplot.whiskerprops.color: 6e738d

catppuccin/extras/matplotlib_styles/mocha.mplstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ grid.color: 313244
3232

3333
# Boxplots: Overlay 0
3434
boxplot.flierprops.color: 6c7086
35-
boxplot.flierprops.markerfacecolor: 6c7086
35+
boxplot.flierprops.markerfacecolor: 6c7086
3636
boxplot.flierprops.markeredgecolor: 6c7086
3737
boxplot.boxprops.color: 6c7086
3838
boxplot.whiskerprops.color: 6c7086

catppuccin/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Dataclass definitions for the Catppuccin palette data structure."""
22

3+
from collections.abc import Iterator
34
from dataclasses import dataclass
4-
from typing import Iterator
55

66

77
@dataclass(frozen=True)

0 commit comments

Comments
 (0)