Skip to content

Commit 399c0c4

Browse files
committed
fix lint
1 parent 5330015 commit 399c0c4

4 files changed

Lines changed: 179 additions & 186 deletions

File tree

tutorial_developer_workflows.rst

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,38 @@
1111
Developer Workflows Tutorial
1212
============================
1313

14-
This tutorial will guide you through using the ``spack develop`` command to develop software from local source code within a Spack environment.
14+
This tutorial will guide you through using the ``spack develop`` command to develop software from local source code within a Spack environment.
1515
With this command, Spack manages your dependencies while you focus on testing changes to your library and/or application.
1616

1717
-----------------------------
1818
Installing from Local Source
1919
-----------------------------
2020

21-
The ``spack install`` command typically fetches source code from a mirror or the internet before building and installing your package.
21+
The ``spack install`` command typically fetches source code from a mirror or the internet before building and installing your package.
2222
As developers, however, we often want to build from local source code that we continuously modify, build, and test.
2323

24-
Let's imagine we're working on ``scr``—a library used to implement scalable checkpointing in application codes.
25-
It supports fast, efficient checkpoint read/write operations using MPI and high-bandwidth file I/O.
24+
Let's imagine we're working on ``scr``—a library used to implement scalable checkpointing in application codes.
25+
It supports fast, efficient checkpoint read/write operations using MPI and high-bandwidth file I/O.
2626
We want to test changes to ``scr`` within an actual application, so we'll use ``macsio``, a proxy application that mimics typical HPC I/O workloads.
2727

2828
We've chosen ``scr`` and ``macsio`` because they are both quick to build.
2929

30-
We'll begin by creating a Spack environment for our development work.
31-
We need to build ``macsio`` with ``scr`` support, and for now, we want everything built without Fortran support.
30+
We'll begin by creating a Spack environment for our development work.
31+
We need to build ``macsio`` with ``scr`` support, and for now, we want everything built without Fortran support.
3232
Let's set up this development workflow:
3333

3434
.. literalinclude:: outputs/dev/setup-scr.out
3535
:language: console
3636

37-
Before making any changes, we verify that everything builds correctly.
37+
Before making any changes, we verify that everything builds correctly.
3838
Spack builds the entire development tree as specified and links all components together for you.
3939

4040

4141
.. literalinclude:: outputs/dev/setup-scr.out
4242
:language: console
4343

4444

45-
Before making any changes, we verify that everything builds correctly.
45+
Before making any changes, we verify that everything builds correctly.
4646
Spack builds the entire development tree as specified and links all components together for you.
4747

4848

@@ -100,17 +100,17 @@ Now we are ready to begin work on the actual application.
100100
Development Iteration Cycle
101101
-----------------------------
102102

103-
Let's assume that ``scr`` has a bug, and we'd like to patch it to find out what the problem is.
104-
First, we tell Spack that we want to check out the version of ``scr`` we intend to work on.
103+
Let's assume that ``scr`` has a bug, and we'd like to patch it to find out what the problem is.
104+
First, we tell Spack that we want to check out the version of ``scr`` we intend to work on.
105105
In this case, it's the 3.1.0 release that we want to patch:
106106

107107
.. literalinclude:: outputs/dev/develop-1.out
108108
:language: console
109109

110-
The ``spack develop`` command marks the package as a "development" package in the ``spack.yaml``.
111-
This adds a special ``dev_path=`` attribute to the spec for the package, so Spack remembers where the source code is located.
112-
The ``develop`` command also downloads or checks out the source code for the package.
113-
By default, the source code is downloaded into a subdirectory of the environment.
110+
The ``spack develop`` command marks the package as a "development" package in the ``spack.yaml``.
111+
This adds a special ``dev_path=`` attribute to the spec for the package, so Spack remembers where the source code is located.
112+
The ``develop`` command also downloads or checks out the source code for the package.
113+
By default, the source code is downloaded into a subdirectory of the environment.
114114
You can change the location of this source directory by modifying the ``path:`` attribute of the ``develop`` configuration in the environment.
115115

116116
There are a few gotchas with the ``spack develop`` command:
@@ -133,55 +133,55 @@ Now that this is done, we tell Spack to rebuild both ``scr`` and ``macsio`` by r
133133
.. literalinclude:: outputs/dev/develop-2.out
134134
:language: console
135135

136-
This rebuilds ``scr`` from the subdirectory we specified.
137-
If your package uses CMake, Spack will build it in a directory corresponding to the hash of your package.
136+
This rebuilds ``scr`` from the subdirectory we specified.
137+
If your package uses CMake, Spack will build it in a directory corresponding to the hash of your package.
138138
From there, you can change into the appropriate directory and perform your own build/test cycles.
139139

140-
Now we can develop our code.
141-
For the sake of this demo, we're going to intentionally introduce an error.
140+
Now we can develop our code.
141+
For the sake of this demo, we're going to intentionally introduce an error.
142142
Let’s edit a file and remove the first semicolon we find.
143143

144144
.. literalinclude:: outputs/dev/edit-1.out
145145
:language: console
146146

147-
Once you have a development package, ``spack install`` works like ``make``.
148-
Because Spack knows the source code directory of the package, it checks file timestamps to detect recent changes.
147+
Once you have a development package, ``spack install`` works like ``make``.
148+
Because Spack knows the source code directory of the package, it checks file timestamps to detect recent changes.
149149
If any files have been modified, Spack will rebuild ``scr`` and its dependents.
150150

151151
.. literalinclude:: outputs/dev/develop-3.out
152152
:language: console
153153

154-
Here, the build failed as expected.
155-
We can inspect the build output in ``scr/spack-build-out.txt``.
154+
Here, the build failed as expected.
155+
We can inspect the build output in ``scr/spack-build-out.txt``.
156156
Alternatively, to debug interactively, we can launch a shell within the build environment using:
157157

158158
``spack build-env scr@2.0 -- bash``
159159

160-
If that’s too much to remember, sourcing ``scr/spack-build-env.txt`` will set the appropriate environment variables so you can diagnose the build manually.
160+
If that’s too much to remember, sourcing ``scr/spack-build-env.txt`` will set the appropriate environment variables so you can diagnose the build manually.
161161
Now let's fix the issue and rebuild directly.
162162

163163
.. literalinclude:: outputs/dev/develop-4.out
164164
:language: console
165165

166166
You'll notice that Spack rebuilt both ``scr`` and ``macsio``, as expected.
167167

168-
Taking advantage of iterative builds with Spack requires cooperation from your build system.
169-
When Spack performs a rebuild on a development package, it reruns all the build stages without cleaning the source and build directories to a pristine state.
168+
Taking advantage of iterative builds with Spack requires cooperation from your build system.
169+
When Spack performs a rebuild on a development package, it reruns all the build stages without cleaning the source and build directories to a pristine state.
170170
If your build system can reuse previously compiled object files, you’ll benefit from an iterative build.
171171

172172
- If your package uses ``make``, you should get iterative builds automatically when using ``spack develop``.
173173
- If your package uses CMake with the standard ``cmake`` / ``build`` / ``install`` stages, you'll also get iterative builds automatically.
174174
This is because CMake doesn’t modify the file time of ``CMakeCache.txt`` unless your CMake flags change.
175175
- If your package uses Autoconf, rerunning the typical ``autoreconf`` stage will usually modify the timestamp of ``config.h``, which may trigger a full rebuild.
176176

177-
Multiple packages can also be marked as development packages.
177+
Multiple packages can also be marked as development packages.
178178
If we were co-developing ``macsio``, we could run:
179179

180180
.. literalinclude:: outputs/dev/develop-5.out
181181
:language: console
182182

183-
Using development workflows also allows us to share our full development setup with other team members.
184-
They can simply use our ``spack.yaml`` to create a new environment and replicate the entire build process.
183+
Using development workflows also allows us to share our full development setup with other team members.
184+
They can simply use our ``spack.yaml`` to create a new environment and replicate the entire build process.
185185
For example, here we create another development environment:
186186

187187
.. literalinclude:: outputs/dev/otherdevel.out
@@ -198,15 +198,15 @@ When we're done developing, we simply tell Spack that it no longer needs to keep
198198
Workflow Summary
199199
-------------------
200200

201-
Use the ``spack develop`` command within an environment to create a reproducible build setup for your development workflow.
202-
Spack will manage all dependencies and link your packages together automatically.
201+
Use the ``spack develop`` command within an environment to create a reproducible build setup for your development workflow.
202+
Spack will manage all dependencies and link your packages together automatically.
203203
Within a development environment, ``spack install`` behaves similarly to ``make``: it checks file timestamps and rebuilds only the minimum set of Spack packages required to reflect your changes.
204204

205205
-------------------
206206
Optional: Tips and Tricks
207207
-------------------
208208

209-
This section covers additional features that complement the core tutorial above.
209+
This section covers additional features that complement the core tutorial above.
210210
Many of these tips are especially useful for specific projects and developer workflows.
211211

212212
A list of available options for the ``spack develop`` command can be viewed below:
@@ -219,11 +219,11 @@ A list of available options for the ``spack develop`` command can be viewed belo
219219
Source Code Management
220220
----------------------
221221

222-
The ``spack develop`` command allows users to control the location of source code.
222+
The ``spack develop`` command allows users to control the location of source code.
223223
By default, Spack manages source locations and handles cloning automatically, but software developers often prefer more control.
224224

225-
You can specify the source directory using the ``--path`` argument when invoking ``spack develop``.
226-
If the specified directory already exists, Spack will not attempt to fetch the source code.
225+
You can specify the source directory using the ``--path`` argument when invoking ``spack develop``.
226+
If the specified directory already exists, Spack will not attempt to fetch the source code.
227227
This allows developers to pre-clone repositories or use preferred directory paths as needed.
228228

229229
.. code-block:: console
@@ -238,10 +238,10 @@ This allows developers to pre-clone repositories or use preferred directory path
238238
Navigation and the Build Environment
239239
------------------------------------
240240

241-
Diving into the build environment was introduced earlier in the packaging section using the ``spack build-env scr -- bash`` command.
241+
Diving into the build environment was introduced earlier in the packaging section using the ``spack build-env scr -- bash`` command.
242242
This is a helpful feature because it allows you to run commands inside the package’s build environment.
243243

244-
In the packaging section, this was combined with ``spack cd`` to demonstrate a manual build process outside of Spack’s automated workflow.
244+
In the packaging section, this was combined with ``spack cd`` to demonstrate a manual build process outside of Spack’s automated workflow.
245245
This approach is especially useful in developer environments, providing a streamlined workflow for iterating on a single package without the overhead of the ``spack install`` command.
246246

247247
The extra features of the ``spack install`` command are often unnecessary when rapidly iterating between building and testing a specific package.
@@ -272,9 +272,8 @@ Working directly within the build environment, combined with Spack's navigation
272272
Combinatorics
273273
-------------
274274

275-
The final topic in this tutorial highlights the power of combinatorial development builds.
276-
There are many cases where developers want to see how a single set of changes affects multiple build configurations—for example:
277-
``+cuda`` vs ``~cuda``, ``%gcc`` vs ``%clang``, or ``build_type=Release`` vs ``build_type=Debug``.
275+
The final topic in this tutorial highlights the power of combinatorial development builds.
276+
There are many cases where developers want to see how a single set of changes affects multiple build configurations—for example: ``+cuda`` vs ``~cuda``, ``%gcc`` vs ``%clang``, or ``build_type=Release`` vs ``build_type=Debug``.
278277

279278
Developers can build all of these configurations with a single ``spack install`` call, as long as the develop spec is generic enough to cover the spec variations of the packages.
280279

@@ -290,8 +289,7 @@ Developers can build all of these configurations with a single ``spack install``
290289
291290
While we won't build out this example, it illustrates how the ``dev_path`` for both ``build_type=Release`` and ``build_type=Debug`` points to the same source code.
292291

293-
If we want to do most of our incremental builds using the ``Release`` configuration and periodically check results using the ``Debug`` build, we can combine the workflow from the previous example:
294-
First, enter the ``Release`` build environment using:
292+
If we want to do most of our incremental builds using the ``Release`` configuration and periodically check results using the ``Debug`` build, we can combine the workflow from the previous example: First, enter the ``Release`` build environment using:
295293

296294
``spack build-env scr build_type=Release -- bash``
297295

0 commit comments

Comments
 (0)