Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 055029d

Browse files
committed
DEV: add pixi.toml
1 parent 30c3d78 commit 055029d

6 files changed

Lines changed: 6614 additions & 0 deletions

File tree

.github/workflows/pixi_tests.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: Pixi
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- "pixi.lock"
8+
- "pyproject.toml"
9+
- "src/**"
10+
- "lib/**"
11+
- ".github/workflows/pixi.yml"
12+
push:
13+
branches: [main]
14+
paths:
15+
- "pixi.lock"
16+
- "pyproject.toml"
17+
- "src/**"
18+
- "lib/**"
19+
- ".github/workflows/pixi.yml"
20+
workflow_dispatch:
21+
22+
permissions: {}
23+
24+
jobs:
25+
pixi-linux-install:
26+
runs-on: ubuntu-24.04
27+
permissions:
28+
contents: read
29+
30+
steps:
31+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32+
with:
33+
fetch-depth: 0
34+
persist-credentials: false
35+
36+
- name: Set up pixi and install environment
37+
uses: prefix-dev/[email protected]
38+
with:
39+
pixi-version: v0.66.0
40+
locked: true
41+
cache: true
42+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
43+
- name: Show pixi info
44+
run: |
45+
pixi info
46+
pixi list
47+
- name: Clean build artifacts
48+
run: |
49+
rm -rf build meson-logs meson-private .mesonpy-*
50+
- name: Install Matplotlib editable
51+
run: pixi run python -m pip install --config-settings=setup-args="-Db_lto=false" --editable .
52+
- name: Smoke test editable install
53+
run: |
54+
pixi run python -c "import matplotlib; print(matplotlib.__version__)"

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ ENV/
118118
env.bak/
119119
venv.bak/
120120

121+
# pixi files on top level
122+
pixi.toml
123+
.pixi/
124+
# ignore the lock file, but we want to commit this if lock is purposely made from
125+
# pyproject.toml. If you want the lock file committed, just do `git add -f pixi.lock`
126+
# after generating it.
127+
pixi.lock
128+
129+
121130
# Jupyter files #
122131
#################
123132

ci/pixi.example.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Local developer Pixi environment for Matplotlib
2+
# ------------------------------------------------
3+
# This file is optional and intended for local use only.
4+
# Do NOT commit it unless you intend to change project defaults.
5+
#
6+
# Usage:
7+
# pixi install
8+
# pixi run python -m pip install \
9+
# --no-build-isolation \
10+
# --config-settings=setup-args="-Db_lto=false" \
11+
# --editable .
12+
# pixi run tests-core
13+
# pixi run build-doc
14+
15+
[workspace]
16+
channels = ["conda-forge"]
17+
platforms = ["linux-64", "osx-arm64", "osx-64"]
18+
19+
[dependencies]
20+
python = "3.12.*"
21+
pip = "*"
22+
meson = "*"
23+
ninja = "*"
24+
pkg-config = "*"
25+
# Optional: comment out if you prefer system compilers
26+
compilers = "*"
27+
meson-python = "*"
28+
pybind11 = "*"
29+
setuptools = ">=64"
30+
setuptools-scm = ">=7"
31+
32+
# ------------------------------------------------
33+
# Tasks (developer convenience)
34+
# ------------------------------------------------
35+
36+
[tasks.clean-build]
37+
cmd = "rm -rf build meson-logs meson-private .mesonpy-*"
38+
description = "Clean meson build artifacts"
39+
40+
[tasks.build-doc]
41+
cmd = "make -C doc html"
42+
description = "Build the documentation"
43+
44+
[tasks.tests-core]
45+
cmd = "pytest --pyargs matplotlib"
46+
description = "Run Matplotlib tests (core only)"
47+
48+
[tasks.tests-all]
49+
cmd = "pytest --pyargs matplotlib mpl_toolkits.axes_grid1 mpl_toolkits.axisartist mpl_toolkits.mplot3d"
50+
description = "Run all Matplotlib tests"
51+
52+
# ------------------------------------------------
53+
# Environments
54+
# ------------------------------------------------
55+
56+
[environments]
57+
# Single environment for developer convenience
58+
default = { features = ["build", "test", "doc"], solve-group = "main" }
59+
60+
# Optional: lighter environments if desired
61+
test = { features = ["test"], solve-group = "main" }
62+
test-extra = { features = ["test", "test-extra"], solve-group = "main" }
63+
doc = { features = ["doc"], solve-group = "main" }

doc/devel/development_setup.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,43 @@ setup.
199199

200200
Remember to activate the environment whenever you start working on Matplotlib!
201201

202+
.. tab-item:: pixi environment
203+
204+
A pixi configuration is included in ``pyproject.toml``. The environment
205+
includes the base Matplotlib dependencies, and documentation and testing
206+
dependencies. To install the dependencies::
207+
208+
pixi install
209+
210+
and then to install an editable version on Matplotlib::
211+
212+
pixi run python -m pip install \
213+
--no-build-isolation \
214+
--config-settings=setup-args="-Db_lto=false" \
215+
--editable .
216+
217+
(the ``-Db_lto=false`` is not needed on all platforms). You can test the installation with::
218+
219+
pixi run python -c "import matplotlib; print(matplotlib.__file__)"
220+
221+
Note there are some pixi tasks available as shortcuts::
222+
223+
pixi task list
224+
225+
If you do not want to use ``pixi run`` in front of every command, you can do::
226+
227+
pixi shell
228+
229+
and continue to use pixi as a python environment.
230+
231+
.. note:: do not edit the ``pyproject.toml`` file and commit to the repository, as this
232+
will affect all developers. If you want to change the dependencies, please open an
233+
issue or pull request to discuss the change. If you want a custom ``pixi.toml`` file,
234+
you can create one in your home directory, and it will be used instead of the
235+
repository one. An example is available in ``ci/pixi.example.toml`` that lists the
236+
dependencies needed to build Matplotlib.
237+
238+
.. _pixi: https://pixi.prefix.dev/
202239

203240
Install external dependencies
204241
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)