Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ jobs:
- name: Test
run: |
pytest tests -v
- name: Examples
- name: Examples (internal)
run: |
python examples/fodo.py
- name: Examples (external)
run: |
# Copy examples directory from the main PALS repository
cd examples
git clone --no-checkout https://github.com/pals-project/pals.git pals_temp
cd pals_temp
git sparse-checkout init
git sparse-checkout set examples/
git checkout main
Comment on lines +38 to +44
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sparse checkout here to avoid cloning the entire repository.

# Test all external examples
cd -
for file in pals_temp/examples/*.pals.yaml; do
python test_external_examples.py --path "${file}"
done
26 changes: 26 additions & 0 deletions examples/test_external_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import argparse
import yaml

from pals import BeamLine


def main():
# Parse command-line arguments
parser = argparse.ArgumentParser()
parser.add_argument(
"--path",
required=True,
help="Path to the example file",
)
args = parser.parse_args()
example_file = args.path
# Read YAML data from file
with open(example_file, "r") as file:
data = yaml.safe_load(file)
# Parse and validate YAML data
print(f"Parsing data from {example_file}...")
BeamLine(**data)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading the data into a BeamLine object triggers automatic validation.

Copy link
Member Author

@EZoni EZoni Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note that this, BeamLine(**data), is how we currently load data in our unit tests, e.g.,

# Parse the YAML data back into a BeamLine object
loaded_line = pals.BeamLine(**yaml_data)

which is why I would expect it to work for the examples in the main PALS repository as well.



if __name__ == "__main__":
main()
Loading