@@ -6,23 +6,94 @@ Testing Changes to mpas_tools
66
77Here, we describe the workflow for creating a development conda environment
88that points to ``mpas_tools `` in a branch from a local clone of the repo.
9- This approach works both for calling functions from the package within a python
10- script or another python package and for calling the "entry points"
11- (command-line tools; see :ref: `dev_making_changes `).
9+ The preferred workflow is to build and install the package locally with
10+ ``rattler-build `` from within a pixi environment.
1211
13- Basic instructions on how to install `Miniconda <https://docs.conda.io/en/latest/miniconda.html >`_
14- are beyond the scope of this documentation. Make sure the conda-forge channel
15- is added and that channel priority is "strict", meaning packages will
16- definitely come from conda-forge if they are available there.
12+ .. _dev_local_rattler_build :
13+
14+ Building and Installing Locally with rattler-build
15+ ***************************************************
16+
17+ This is the recommended method, and it is required if you are modifying
18+ compiled C++ or Fortran tools.
19+
20+ Use the pixi environment in ``conda_package/pixi.toml `` to run the build
21+ command:
22+
23+ .. code-block :: bash
24+
25+ cd conda_package
26+ pixi install
27+ pixi shell
28+ rattler-build build -m ci/linux_64_python3.14.____cpython.yaml -r recipe/ --output-dir ../output
29+
30+ This writes package artifacts to ``output/ `` in the repository root.
31+
32+ To install the locally built package into the pixi environment, add the local
33+ build output as a channel and then add ``mpas_tools `` from that channel:
34+
35+ .. code-block :: bash
36+
37+ cd conda_package
38+ pixi workspace channel add " file://$PWD /../output"
39+ pixi add --platform linux-64 " mpas_tools [channel='file://$PWD /../output']"
40+
41+ .. warning ::
42+
43+ The commands above modify ``pixi.toml `` (and possibly ``pixi.lock ``).
44+ These are local development changes only and should **not ** be committed.
45+ Before opening a PR, reset those files to the repository state.
46+
47+ On macOS, use ``--platform osx-64 `` instead. If your workspace includes both
48+ ``linux-64 `` and ``osx-64 `` in ``pixi.toml ``, pixi may try to solve both
49+ platforms during dependency updates. In that case, build local artifacts for
50+ both platforms (with corresponding CI recipe files) or add the local package
51+ for only the platform you built.
52+
53+ If you want to return to using only published channels afterward, you can
54+ remove the local channel from ``pixi.toml ``.
55+
56+ Quick-and-Dirty Alternative: Pixi Editable Install
57+ **************************************************
58+
59+ If you are only making Python-level changes and do not need to rebuild the
60+ compiled C++/Fortran tools, you can use editable installation in pixi:
61+
62+ .. code-block :: bash
63+
64+ cd conda_package
65+ pixi install
66+ pixi shell
67+ pixi run install-editable
68+
69+ Then run tools within the pixi shell (for example ``pytest ``).
70+
71+ .. important ::
72+
73+ Editable installation updates Python code but does **not ** rebuild compiled
74+ C++ and Fortran command-line tools.
75+
76+ A useful hybrid workflow is to install the latest release conda package
77+ first (to get compiled tools), then install your branch in editable mode on
78+ top for Python development.
79+
80+ Legacy Method: Conda Editable Install
81+ *************************************
82+
83+ This workflow is kept for compatibility but is no longer the preferred method.
84+
85+ Basic instructions on how to install
86+ `Miniconda <https://docs.conda.io/en/latest/miniconda.html >`_ are beyond the
87+ scope of this documentation. Make sure the conda-forge channel is added and
88+ that channel priority is "strict":
1789
1890.. code-block :: bash
1991
2092 conda config --add channels conda-forge
2193 conda config --set channel_priority strict
2294
23- To make a conda environment and install the current `mpas_tools ` in a way that
24- it will be used out of the repo directly (i.e. it will notice changes as you
25- make them in your branch), run:
95+ Then create and activate a development environment from ``dev-spec.txt `` and
96+ install in editable mode:
2697
2798.. code-block :: bash
2899
@@ -31,14 +102,8 @@ make them in your branch), run:
31102 conda activate mpas_tools_dev
32103 python -m pip install --no-deps --no-build-isolation -e .
33104
34- You should now find that ``mpas_tools `` can be imported in python codes and the
35- various scripts and entry points are available in the path.
36-
37- If you have already created the ``mpas_tools_dev `` environment, it may be best
38- to remove it (see below) and create it again.
39-
40105 Removing the test environment
41- *****************************
106+ -----------------------------
42107
43108If you're done with testing, you can remove the test environment
44109
0 commit comments