Skip to content
Merged
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
7 changes: 7 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ doesn't have to be used in the readme, but ideally should be similar to a readme
10. Run through the appropriate [Language Checklist](#language-checklist)
11. Do a Pull Request

## Updating an Existing Example

If you change the code or documentation of an example in a way that would matter to readers, remember
to update the `updated_date` field in the `article.yml` file.

This is used by the Zaber website to display a last modified date in addition to the creation date.

## Language Checklist

Here are the checklists for the various languages:
Expand Down
3 changes: 2 additions & 1 deletion examples/_template/article.yml.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# then edit the content of the metatdata in this YAML file for rendering on https://software.zaber.com/examples
authors:
- Andrew Lau
date: 2024-05-01
date: 2024-05-01 # This should stay at the original publication date of the article.
updated_date: 2025-06-02 # Update this if you change the content (code or documentation) but not infrastructure.
category: Microscopy
tags:
- Python
Expand Down
1 change: 1 addition & 0 deletions examples/calibration_2d/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Andrew Lau
date: 2023-09-07
updated_date: 2023-09-27
category: Calibration
tags:
- Python
Expand Down
1 change: 1 addition & 0 deletions examples/gui_pyqt6/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Nathan Paolini
date: 2023-06-01
updated_date: 2023-06-01
category: Graphical User Interface
tags:
- Qt
Expand Down
1 change: 1 addition & 0 deletions examples/gui_raspberrypi_touch/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Martin Zak
date: 2023-06-02
updated_date: 2023-06-02
category: Graphical User Interface
tags:
- Raspberry PI
Expand Down
1 change: 1 addition & 0 deletions examples/gui_swift_ui/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Silviu Toderita
date: 2025-04-21
updated_date: 2025-04-21
category: Graphical User Interface
tags:
- Swift
Expand Down
1 change: 1 addition & 0 deletions examples/gui_textual/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Andrew Lau
date: 2023-06-03
updated_date: 2023-06-03
category: Graphical User Interface
tags:
- Python
Expand Down
1 change: 1 addition & 0 deletions examples/hid_joystick/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Soleil Lapierre
date: 2023-06-04
updated_date: 2023-06-04
category: User Interaction
tags:
- Joystick
Expand Down
1 change: 1 addition & 0 deletions examples/microplate_scanning_basic/article.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ authors:
- Andrew Lau
- Mike Fussell
date: 2023-06-12
updated_date: 2023-06-12
category: Microscopy
tags:
- Microplate
Expand Down
1 change: 1 addition & 0 deletions examples/microscope_autofocus/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Skyler Olson
date: 2023-06-15
updated_date: 2023-06-15
category: Microscopy
tags:
- Computer Vision
Expand Down
1 change: 1 addition & 0 deletions examples/microscope_filter_cube/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Stefan Martin
date: 2023-06-10
updated_date: 2023-06-10
category: Microscopy
tags:
- Filter Cube
Expand Down
1 change: 1 addition & 0 deletions examples/microscope_focus_map/article.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ authors:
- Andrew Lau
- Mike Fussell
date: 2023-07-31
updated_date: 2023-07-31
category: Microscopy
tags:
- Python
Expand Down
1 change: 1 addition & 0 deletions examples/microscope_high_throughput_scanning/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Stefan Martin
date: 2023-06-15
updated_date: 2024-07-24
category: Microscopy
tags:
- Python
Expand Down
1 change: 1 addition & 0 deletions examples/microscope_illuminator/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Stefan Martin
date: 2023-06-07
updated_date: 2023-06-07
category: Microscopy
tags:
- Illuminator
Expand Down
1 change: 1 addition & 0 deletions examples/microscope_tiling_basler_camera/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Colby Sparks
date: 2024-04-29
updated_date: 2024-07-02
category: Microscopy
tags:
- Tiling Automation
Expand Down
1 change: 1 addition & 0 deletions examples/microscope_well_plate_loader/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Alex Canan and Albert David
date: 2025-02-20
updated_date: 2025-02-25
category: Microscopy
tags:
- Well Plate
Expand Down
1 change: 1 addition & 0 deletions examples/motion_input_shaping/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Graham Kerr
date: 2023-06-08
updated_date: 2023-06-08
category: Motion
tags:
- Python
Expand Down
1 change: 1 addition & 0 deletions examples/motion_pvt_sequence_generation/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Jeff Homer
date: 2023-12-12
updated_date: 2023-12-12
category: Motion
tags:
- Python
Expand Down
1 change: 1 addition & 0 deletions examples/motion_tracking/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Martin Zak
date: 2024-12-05
updated_date: 2024-12-05
category: Motion
tags:
- PID
Expand Down
1 change: 1 addition & 0 deletions examples/self_test_direct_encoder_stage/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Nathan Paolini
date: 2023-06-10
updated_date: 2023-06-10
category: Diagnostics
tags:
- Python
Expand Down
1 change: 1 addition & 0 deletions examples/util_com_port_scan/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Nathan Paolini
date: 2023-06-04
updated_date: 2023-06-04
category: Utility
tags:
- COM Port
Expand Down
1 change: 1 addition & 0 deletions examples/util_pyinstaller/article.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
authors:
- Software Team
date: 2024-03-18
updated_date: 2024-12-09
category: Utility
tags:
- PyInstaller
Expand Down
48 changes: 46 additions & 2 deletions tools/check_examples/pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion tools/check_examples/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ authors = [
]
dependencies = [
"docopt-ng>=0.9.0",
"pyyaml>=6.0.2",
]
requires-python = "==3.12.*"
readme = "README.md"
Expand All @@ -18,10 +19,12 @@ distribution = false

[tool.pdm.scripts]
check = {call="src.check_examples.check:main"}
[tool.pdm.dev-dependencies]

[dependency-groups]
dev = [
"black>=24.4.2",
"pylint>=3.2.5",
"pydocstyle>=6.3.0",
"mypy>=1.10.0",
"types-PyYAML>=6.0.12.20250402",
]
3 changes: 2 additions & 1 deletion tools/check_examples/src/check_examples/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from .common import filter_not_ignored, load_ignore, get_git_root_directory
from .terminal_utils import iprint, iprint_pass, iprint_fail, iprint_info, match_string
from .check_python import check_python
from .check_basic import check_basic, check_markdown
from .check_basic import check_basic, check_markdown, validate_article_metadata

EXAMPLE_DIR = "examples"
TOOLS_DIR = "tools"
Expand Down Expand Up @@ -222,6 +222,7 @@ def check_example(directory: Path, fix: bool) -> int:
return_code = 0
return_code |= check_basic(directory)
return_code |= check_markdown(directory)
return_code |= validate_article_metadata(directory)
return_code |= check_python(directory, fix)
# Can add other languages here such as check_csharp(), check_html(), etc.
return return_code
Expand Down
27 changes: 27 additions & 0 deletions tools/check_examples/src/check_examples/check_basic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""Check for basic requirements of example repositories."""

from datetime import date
from pathlib import Path

import yaml

from .common import file_exists, list_files_of_suffix, execute, get_git_root_directory
from .terminal_utils import iprint_fail, iprint_pass
from .markdown_links import check_links_in_markdown
Expand Down Expand Up @@ -32,3 +36,26 @@ def check_markdown(directory: Path, recurse: bool = True) -> int:
)
return_code |= check_links_in_markdown(file)
return return_code


def validate_article_metadata(directory: Path) -> int:
"""Check that the required yaml fields exist."""
with open(directory.joinpath("article.yml"), "r", encoding="utf-8") as stream:
meta = yaml.safe_load(stream)

required_fields = {
"date": date,
"updated_date": date,
"category": str,
"picture": str,
}

for field, field_type in required_fields.items():
if field not in meta:
iprint_fail(f"article.yml does not contain the {field} field.", 1)
return 1
if not isinstance(meta[field], field_type):
iprint_fail(f"article.yml {field} field is not of type {field_type.__name__}.", 1)
return 1

return 0