Skip to content

Commit 050360e

Browse files
authored
Merge pull request #353 from easybuilders/develop
Sync `devlop` to `main`
2 parents bf18260 + 2242562 commit 050360e

File tree

4 files changed

+149
-3
lines changed

4 files changed

+149
-3
lines changed

docs/contributing.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,94 @@ git checkout develop
266266
git pull upstream develop
267267
```
268268

269+
##### Running your development instance {: #running_your_development_instance }
270+
271+
There are multiple ways to deploy a local development copy of EasyBuild. This
272+
section presents a method that is more relevant when modifying the framework and
273+
easyblock repositories.
274+
275+
To deploy a local copy of EasyBuild clone the
276+
[easybuild-framework](https://github.com/easybuilders/easybuild-framework),
277+
[easybuild-easyblocks](https://github.com/easybuilders/easybuild-easyblocks), and
278+
[easybuild-easyconfigs](https://github.com/easybuilders/easybuild-easyconfigs)
279+
repositories in the same directory, for instance a directory name `EasyBuild`.
280+
After cloning these repositories the content of the `EasyBuild` directory
281+
should be the following.
282+
283+
``` console
284+
$ tree -L 1 EasyBuild
285+
EasyBuild
286+
├── easybuild-easyblocks
287+
├── easybuild-easyconfigs
288+
└── easybuild-framework
289+
290+
3 directories, 0 files
291+
```
292+
293+
An environment variable with the path to the `EasyBuild` directory simplifies
294+
calls to the development instance of EasyBuild significantly; define this
295+
variable in the following manner.
296+
297+
``` shell
298+
export EB_DEVEL_ROOT=/path/to/EasyBuild
299+
```
300+
301+
To run the development instance, add the paths of the framework and easyblock
302+
repositories to the Python path, and the path of the easyconfig repository to
303+
the robot search path.
304+
305+
For instance, a command to install `ReFrame-4.3.3.eb` and its dependencies with
306+
the necessary variables defined for the command environment would be the
307+
following:
308+
309+
``` shell
310+
PYTHONPATH=${EB_DEVEL_ROOT}/easybuild-framework:${EB_DEVEL_ROOT}/easybuild-easyblocks:${PYTHONPATH} EASYBUILD_ROBOT_PATHS=${EB_DEVEL_ROOT}/easybuild-easyconfigs/easybuild/easyconfigs ${EB_DEVEL_ROOT}/easybuild-framework/eb --robot ReFrame-4.3.3.eb
311+
```
312+
313+
To avoid adding the variables in the environment of every single command while
314+
maintaining a clean shell environment, an alias can be defined as follows.
315+
316+
``` shell
317+
alias eb_devel='PYTHONPATH="${EB_DEVEL_ROOT}/easybuild-framework:${EB_DEVEL_ROOT}/easybuild-easyblocks:${PYTHONPATH}" EASYBUILD_ROBOT_PATHS="${EB_DEVEL_ROOT}/easybuild-easyconfigs/easybuild/easyconfigs" ${EB_DEVEL_ROOT}/easybuild-framework/eb'
318+
```
319+
320+
With the alias defined, the command to install `ReFrame-4.3.3.eb` and its
321+
dependencies now becomes the following:
322+
323+
``` shell
324+
eb_devel --robot ReFrame-4.3.3.eb
325+
```
326+
327+
??? note "Controlling the robot search path in development instances"
328+
329+
There is no default value for the [robot search
330+
path](/using-easybuild/#controlling_robot_search_path) in the development
331+
instance. The robot search path is set explicitly using the
332+
`EASYBUILD_ROBOT_PATHS` environment variable. As a result, expect that some
333+
features of the `EASYBUILD_ROBOT_PATHS` and its accompanying command line
334+
option, `--robot-paths` will not work with `eb_devel`, the alias for the
335+
EasyBuild development version.
336+
337+
For instance,
338+
339+
- you cannot use `EASYBUILD_ROBOT_PATHS` to set the robot path as it is
340+
overridden in the alias `eb_devel`, and
341+
- you cannot append to the default robot search path, with `--robot-paths`,
342+
as it overrides the `EASYBUILD_ROBOT_PATHS` environment option.
343+
344+
As a workaround,
345+
346+
- use `--robot-paths` to override the robot search path set via the alias, and
347+
- use the environment variable `EASYBUILD_ROBOT_PATHS` to access the
348+
the robot search path set by the alias so that you can append to it.
349+
350+
For instance to append to the development robot search path, use the
351+
following command.
352+
353+
``` shell
354+
eb_devel --robot-paths=${EASYBUILD_ROBOT_PATHS}:/path/to/dir_0:/path/to/dir_1 --robot ReFrame-4.3.3.eb
355+
```
356+
269357
### Opening a new pull request {: #contributing_creating_pull_requests }
270358

271359
!!! note

docs/partial-installations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ naming scheme).
1010
To stop the installation procedure *after* a specific step in the installation procedure, the `-s`/`--stop`
1111
command line option can be used; the name of the step must be supplied as an argument.
1212

13-
The following step names are recognized (listed in execution order): `fetch`, `ready`, `source`, `patch`,
14-
`prepare`, `configure`, `build`, `test`, `install`, `extensions`, `package`, `postproc`,
15-
`sanitycheck`, `cleanup`, `module`, `testcases`.
13+
The following step names are recognized (listed in execution order): `fetch`, `ready`, `extract`, `patch`,
14+
`prepare`, `configure`, `build`, `test`, `install`, `extensions`, `postiter`, `postproc`,
15+
`sanitycheck`, `cleanup`, `module`, `permissions`, `package`, `testcases`.
1616

1717
Example usage:
1818

docs/python-search-path.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Customizing Python search path
2+
3+
In order to locate Python packages in modules, before v5.0.0, EasyBuild conventionally used the `PYTHONPATH` environment variable. However, this has several issues:
4+
5+
1. `PYTHONPATH` has highest priority; it prevents users from making a custom virtual environment on top of modules and shadowing packages.
6+
2. Packages are picked up even for incompatible python versions, e.g. an OS installed old python 3.6 will break if packages from 3.12 exists in `PYTHONPATH`.
7+
3. Modules can't have optional dependencies on different Python versions, as PYTHONPATH points directly to the `site-packages` subdirectory.
8+
4. Packages with `pth` files can't work with PYTHONPATH and requires being added to the site dir.
9+
10+
Unfortunately, Python offers no environment variables to do the correct thing here.
11+
To solve this (initially for Python `multi_deps`) EasyBuild has for a long time supported the use of the custom `EBPYTHONPREFIXES` via a `sitecustomize.py` script for the Python modules we build.
12+
It is included in standard Python installations made with EasyBuild. You can opt out of using `sitecustomize.py` if you have strong technical reasons to avoid it.
13+
14+
The `sitecustomize.py` script does the correct thing by only considering the correct Python version, and puts Python packages provided by the environment module at the lowest priority, allowing a user venv to override them.
15+
16+
## Using `--prefer-python-search-path`
17+
18+
Since v5.0.0 the new global configuration option `--prefer-python-search-path` can be used for EasyBuild to prefer the use of either `PYTHONPATH` or `EBPYTHONPREFIXES`.
19+
For backwards compatibility with existing modules, EasyBuild was unfortunately required to keep `PYTHONPATH` as the default.
20+
Note that the option is just the preferred option, if the package path doesn't follow the standard `lib/pythonY.X/site-packages` format then `PYTHONPATH` must be used. If multi-deps is used, then `EBPYTHONPREFIXES` is required.
21+
22+
If you wish to switch to `EBPYTHONPREFIXES`, you should also traverse the existing Python bundles you have installed and make sure to rebuild the modules.
23+
Failure to do so might leave you with a few easyconfigs that require shadowing of older package versions not working correctly due to the import priority changing.
24+
25+
If you are building a new software stack from scratch, you can safely switch this option to `EBPYTHONPREFIXES` and enjoy the benefits.
26+
27+
## Fixing existing modules
28+
29+
You can convert existing modules by rebuilding them with `eb --module-only --rebuild ...`.
30+
You can find the modules that use `PYTHONPATH` by e.g. grepping through your modules:
31+
32+
```bash
33+
grep --include '*.lua' -Rl 'PYTHONPATH.*site-packages' /path/to/modules/all
34+
```
35+
36+
If you use the default module naming scheme
37+
38+
```bash
39+
cd $MODULEPATH
40+
grep -Rl PYTHONPATH */*.lua | grep -v EasyBuild | sed -e 's+/+-+' | sed -e 's+lua$+eb+' | xargs eb --rebuild --module-only
41+
```
42+
43+
If done correctly, your old module files will have gone from
44+
45+
```lua
46+
prepend_path("PYTHONPATH", pathJoin(root, "lib", "python3.12", "site-packages"))
47+
# or
48+
prepend_path("PYTHONPATH", pathJoin(root, "lib/python3.12/site-packages"))
49+
```
50+
51+
to
52+
53+
```lua
54+
prepend_path("EBPYTHONPREFIXES", root)
55+
```
56+
57+
Remember to back up all your module files first before rebuilding.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ nav:
7373
- Cray support: cray-support.md
7474
- Customizing EasyBuild via hooks: hooks.md
7575
- Including Python modules: including-additional-python-modules.md
76+
- Customizing Python search path: python-search-path.md
7677
- Packaging support: packaging-support.md
7778
- RPATH support: rpath-support.md
7879
- Using external modules: using-external-modules.md

0 commit comments

Comments
 (0)