Skip to content

Commit 928ddbe

Browse files
committed
Add STEPUP_EXTERNAL_SOURCES feature
1 parent 605a69c commit 928ddbe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+752
-320
lines changed

.github/workflows/mkdocs.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,23 @@ jobs:
3939
build:
4040
runs-on: ubuntu-latest
4141
steps:
42-
# Prepare the environment for building docs.
42+
# Get the source
4343
- uses: actions/checkout@v4
4444
- uses: actions/setup-python@v5
4545
with:
4646
python-version: 3.x
47+
48+
# Sanity check before doing anything else.
49+
- name: Lint markdown files
50+
uses: DavidAnson/markdownlint-cli2-action@v19
51+
with:
52+
config-file: .markdownlint-cli2.jsonc
53+
globs: |
54+
*.md
55+
docs/*.md
56+
docs/*/*.md
57+
58+
# Prepare the environment for building docs.
4759
- name: Setup Pages
4860
id: pages
4961
uses: actions/configure-pages@v5

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ _version.py
1717

1818
# StepUp Core specifics
1919
docs/.stepup
20+
21+
# Temporary files
22+
*.swp
23+
24+
# NodeJS (for markdownlint)
25+
node_modules/
26+
package-lock.json
27+
package.json

.markdownlint-cli2.jsonc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"config": {
3+
"MD013": {
4+
"line_length": 100,
5+
"heading_line_length": 100,
6+
"code_block_line_length": 100
7+
},
8+
"MD007": { "indent": 4 },
9+
"MD033": {
10+
"allowed_elements": ["script"]
11+
},
12+
"MD046": false
13+
}
14+
}

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<!-- markdownlint-disable line-length -->
2+
3+
# StepUp Core
4+
15
[![release](https://github.com/reproducible-reporting/stepup-core/actions/workflows/release.yaml/badge.svg)](https://github.com/reproducible-reporting/stepup-core/actions/workflows/release.yaml)
26
[![pytest](https://github.com/reproducible-reporting/stepup-core/actions/workflows/pytest.yaml/badge.svg)](https://github.com/reproducible-reporting/stepup-core/actions/workflows/pytest.yaml)
37
[![mkdocs](https://github.com/reproducible-reporting/stepup-core/actions/workflows/mkdocs.yaml/badge.svg)](https://github.com/reproducible-reporting/stepup-core/actions/workflows/mkdocs.yaml)
@@ -7,10 +11,8 @@
711
[![CodeFactor](https://www.codefactor.io/repository/github/reproducible-reporting/stepup-core/badge)](https://www.codefactor.io/repository/github/reproducible-reporting/stepup-core)
812
[![DeepSource](https://app.deepsource.com/gh/reproducible-reporting/stepup-core.svg/?label=active+issues&show_trend=true&token=d3ZpZMlD6DRcnEZUOvYwGyPs)](https://app.deepsource.com/gh/reproducible-reporting/stepup-core/)
913

10-
11-
# StepUp Core
12-
1314
StepUp is a simple, powerful and universal build tool.
1415
StepUp Core provides the basic framework for StepUp, without any domain-specific features.
1516

16-
For more information, consult the [documentation](http://reproducible-reporting.github.io/stepup-core).
17+
For more information, consult the
18+
[documentation](http://reproducible-reporting.github.io/stepup-core).

docs/advanced_topics/amending_static_inputs.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
Occasionally, it may be convenient to declare a static file and then use it as input in the same script.
44
As of StepUp 1.2.0, this is allowed and no longer treated as a cyclic dependency.
55

6-
76
## Example
87

9-
Create the following `plan.py`, which declares a static file, amends it as input, and then opens it to print it to the standard output.
8+
Create the following `plan.py`, which declares a static file, amends it as input,
9+
and then opens it to print it to the standard output.
1010

1111
```python
1212
{% include 'advanced_topics/amending_static_inputs/plan.py' %}
@@ -15,7 +15,9 @@ Create the following `plan.py`, which declares a static file, amends it as input
1515
Also create a `config.txt` file with some contents.
1616

1717
In more realistic scenarios, `config.txt` may be used to decide which steps to add etc.
18-
For a more elaborate example, take a look at the [`plan.py`](https://github.com/reproducible-reporting/stepup-core/blob/main/docs/plan.py) that is used to run all tutorial examples.
18+
For a more elaborate example, take a look at the
19+
[`plan.py`](https://github.com/reproducible-reporting/stepup-core/blob/main/docs/plan.py)
20+
that is used to run all tutorial examples.
1921

2022
Make `plan.py` executable and run it as follows:
2123

@@ -26,6 +28,6 @@ stepup -n 1
2628

2729
You should get the following terminal output:
2830

29-
```
31+
```text
3032
{% include 'advanced_topics/amending_static_inputs/stdout.txt' %}
3133
```

docs/advanced_topics/amending_steps.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ This will avoid the following problems:
4343
To the best of our knowledge, there is no equivalent of `amend()` in other build tools.
4444
Some features in Ninja cover what can be achieved with `amend()`.
4545

46-
4746
## Example
4847

4948
Example source files: [`docs/advanced_topics/amending_steps/`](https://github.com/reproducible-reporting/stepup-core/tree/main/docs/advanced_topics/amending_steps)
@@ -76,7 +75,7 @@ stepup -n 1
7675

7776
You should get the following terminal output:
7877

79-
```
78+
```text
8079
{% include 'advanced_topics/amending_steps/stdout.txt' %}
8180
```
8281

@@ -85,7 +84,6 @@ Once this required input becomes clear,
8584
StepUp schedules the optional step to generate the requested input.
8685
Later, StepUp runs `./step.py` again.
8786

88-
8987
## Try the Following
9088

9189
- Run StepUp again without making any changes.

docs/advanced_topics/blocked_steps.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ As a rule, StepUp will always try to execute all steps, and not doing so is the
66

77
A valid reason for ignoring some steps is illustrated in the following schematic:
88

9-
```
9+
```text
1010
File In development File Costly
1111
|-------------| |----------| |-----------------| |----------|
1212
| input.txt | => | Step 1 | => | converted.txt | => | Step 2 |
@@ -19,16 +19,18 @@ This can be verified by analyzing the file `converted.txt` or with unit tests.
1919

2020
To avoid executing `Step 2` at every iteration in the development of `Step 1`,
2121
you can **block** this step.
22-
All step-creating functions accept an optional `block=True` keyword argument to prevent them from being executed.
22+
All step-creating functions accept an optional `block=True` keyword argument
23+
to prevent them from being executed.
2324
Blocking steps is a temporary measure, meant to be reverted once you're done with `Step 1`.
2425

2526
Blocking steps has some consequences:
2627

27-
- Blocked steps remain in the PENDING state, meaning that outdated output files are not cleaned up automatically.
28-
- At the end of the *run phase*, a list of blocked steps is shown, to remind the user that some steps are blocked.
28+
- Blocked steps remain in the `PENDING` state,
29+
meaning that outdated output files are not cleaned up automatically.
30+
- At the end of the *run phase*, a list of blocked steps is shown,
31+
to remind the user that some steps are blocked.
2932
- Subsequent steps, which use outputs of blocked or pending steps, also remain pending.
3033

31-
3234
## Example
3335

3436
Example source files: [`docs/advanced_topics/blocked_steps/`](https://github.com/reproducible-reporting/stepup-core/tree/main/docs/advanced_topics/blocked_steps)
@@ -50,11 +52,10 @@ stepup -n 1
5052

5153
You should get the following terminal output:
5254

53-
```
55+
```text
5456
{% include 'advanced_topics/blocked_steps/stdout.txt' %}
5557
```
5658

57-
5859
## Try the Following
5960

6061
- Unblock the copy step, run StepUp, block it again, and run StepUp again.

docs/advanced_topics/cyclic_dependencies.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ In theory, one could also have cycles in the provenance graph,
99
but it is not possible to create such loops with the functions in
1010
[stepup.core.api](../reference/stepup.core.api.md).
1111

12-
1312
## Example
1413

1514
Create the following `plan.py`, which is StepUp's equivalent of a snake biting its own tail:
@@ -27,6 +26,6 @@ stepup -n 1
2726

2827
You will get the following terminal output showing that this plan won't work.
2928

30-
```
29+
```text
3130
{% include 'advanced_topics/cyclic_dependencies/stdout.txt' %}
3231
```

docs/advanced_topics/environment_variables.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Environment Variables
22

33
When defining a step, one can specify the environment variables it uses (not their values).
4-
When starting StepUp with a different value for any of these variables, StepUp will know that it has to repeat the step instead of skipping it.
4+
When starting StepUp with a different value for any of these variables,
5+
StepUp will know that it has to repeat the step instead of skipping it.
56

6-
One can only change an environment variable by stopping StepUp, changing the variable, and then starting StepUp again.
7+
One can only change an environment variable by stopping StepUp,
8+
changing the variable, and then starting StepUp again.
79
One cannot modify environment variables while StepUp is running.
810

9-
1011
## Example
1112

1213
Example source files: [`docs/advanced_topics/environment_variables/`](https://github.com/reproducible-reporting/stepup-core/tree/main/docs/advanced_topics/environment_variables)
@@ -26,7 +27,7 @@ MYVAR=foo stepup -n 1
2627

2728
You will see the following output:
2829

29-
```
30+
```text
3031
{% include 'advanced_topics/environment_variables/stdout.txt' %}
3132
```
3233

@@ -35,7 +36,6 @@ StepUp will not try to substitute `${MYVAR}` before starting the step.
3536
The special variables `${inp}` and `${out}` are exceptions to this rule,
3637
as discussed in the [tutorial on dependencies](../getting_started/dependencies.md).
3738

38-
3939
## Try the Following
4040

4141
- Repeat `MYVAR=foo stepup -n 1` without making changes.

docs/advanced_topics/here_and_root.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,42 @@
11
# HERE and ROOT variables
22

3-
When a worker runs a step, it defines several environment variables, including `HERE` and `ROOT`, which can be relevant for writing advanced scripts.
4-
(The workers also define variables starting with `STEPUP_`, but these are only useful to StepUp itself, not to end users.)
3+
When a worker runs a step, it defines several environment variables,
4+
including `HERE` and `ROOT`, which can be relevant for writing advanced scripts.
5+
(The workers also define variables starting with `STEPUP_`,
6+
but these are only useful to StepUp itself, not to end users.)
57

68
The two variables are defined as follows:
79

8-
- `HERE` contains the relative path from the directory where StepUp was started to the current working directory of the step.
9-
- `ROOT` contains the opposite: the relative directory from the current working directory to the directory where StepUp was started.
10+
- `HERE` contains the relative path from the directory where StepUp was started
11+
to the current working directory of the step.
12+
- `ROOT` contains the opposite: the relative directory from the current working directory
13+
to the directory where StepUp was started.
1014

1115
Hence, `HERE/ROOT` and `ROOT/HERE` normalize to the current directory: `./`.
1216

1317
These variables can be useful in the following cases:
1418

1519
- For out-of-source builds, where you want to replicate the directory structure of the source material.
1620
(See example below.)
17-
- To reference a local script that is stored in the top-level directory of your project: `${ROOT}/script.py`
18-
21+
- To reference a local script that is stored in the top-level directory of your project:
22+
`${ROOT}/script.py`
1923

2024
## Example
2125

2226
Example source files: [`docs/advanced_topics/here_and_root/`](https://github.com/reproducible-reporting/stepup-core/tree/main/docs/advanced_topics/here_and_root)
2327

24-
This example represents a minimal out-of-source build, which is nevertheless involving several files, due to the inherent complexity of out-of-source builds.
28+
This example represents a minimal out-of-source build,
29+
which is nevertheless involving several files,
30+
due to the inherent complexity of out-of-source builds.
2531

2632
Create a `source/` directory with the following `source/plan.py`:
2733

2834
```python
2935
{% include 'advanced_topics/here_and_root/source/plan.py' %}
3036
```
3137

32-
Also create a `source/sub/` directory with a file `source/sub/example.txt` (arbitrary contents) and the following `source/sub/plan.py`:
38+
Also create a `source/sub/` directory with a file `source/sub/example.txt` (arbitrary contents)
39+
and the following `source/sub/plan.py`:
3340

3441
```python
3542
{% include 'advanced_topics/here_and_root/source/sub/plan.py' %}
@@ -44,13 +51,15 @@ stepup -n 1
4451

4552
You should get the following terminal output:
4653

47-
```
54+
```text
4855
{% include 'advanced_topics/here_and_root/stdout.txt' %}
4956
```
5057

51-
The top-level `plan.py` provides some infrastructure: some static files and creating the public directory where the outputs will be created.
58+
The top-level `plan.py` provides some infrastructure:
59+
some static files and creating the public directory where the outputs will be created.
5260

53-
The script `sub/plan.py` uses the `ROOT` and `HERE` variables in a way that is independent of the location of this `sub/plan.py`.
61+
The script `sub/plan.py` uses the `ROOT` and `HERE` variables in a way
62+
that is independent of the location of this `sub/plan.py`.
5463
It may therefore be fixed in an environment variable, for example:
5564

5665
```bash
@@ -70,11 +79,11 @@ StepUp was started and will be translated to the working directory of the script
7079
[`getenv()`][stepup.core.api.getenv].
7180
Any variables present in the environment variable will also be substituted once.
7281

73-
7482
## Try the Following
7583

7684
- Modify the scripts `plan.py` and `sub/plan.py` to utilize a `DST` variable as explained above.
77-
To achieve this, define `DST` externally, for instance, by starting StepUp as `DST='../public/${HERE}' stepup -n 1`.
85+
To achieve this, define `DST` externally, for instance,
86+
by starting StepUp as `DST='../public/${HERE}' stepup -n 1`.
7887

7988
- As a follow-up to the previous point, run StepUp with a different `DST` value.
8089
For example: `DST='../out/${HERE}' stepup -n 1`.

0 commit comments

Comments
 (0)