Clarify placeholder-editing guidance and add run-timing output - #13
Conversation
- Add inline "DO NOT UPDATE" markers on the validate_inputs() checks and a bounded "SET THE VARIABLES BELOW" section around the settings block, so the block a reader actually edits is visually distinct from the validation logic and from the values already preset for them (API_URL, EXTRACTION_PROMPT). - Print a start/end timestamp and elapsed run time after the job output is downloaded, so readers can see how long a run actually took without needing an external stopwatch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
No issues found across 2 files
Shadow auto-approve: would not auto-approve. This PR does not meet the repository auto-approval settings.
Re-trigger cubic
Keep the validate_inputs() clarity comments and the "SET THE VARIABLES BELOW" section from this PR; drop the start/end timestamp and elapsed time printing added in the previous commit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Shadow auto-approve: would not auto-approve. This PR does not meet the repository auto-approval settings.
Re-trigger cubic
Move the editable settings block (API_KEY, INPUT_DIR, OUTPUT_DIR) before validate_inputs(), so a reader hits what they need to edit before the validation logic. Simplify validate_inputs()'s comments now that the settings a reader edits sit visually apart from the function entirely, rather than needing inline markers to distinguish them. Matches the same restructuring in docs PR #1090's quickstart-python.mdx. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
2 issues found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="transform/sample-code/partition-quickstart.py">
<violation number="1" location="transform/sample-code/partition-quickstart.py:30">
P2: The validation checks still contain the same placeholder strings as the editable settings, but removing their `DO NOT UPDATE` markers reintroduces the ambiguity this change is meant to resolve. Keep the marker on each validation check.</violation>
</file>
<file name="transform/sample-code/extract-quickstart.py">
<violation number="1" location="transform/sample-code/extract-quickstart.py:30">
P2: The validation comparisons no longer identify their literals as non-editable, so readers can mistake these guard values for the settings they should change. Restore `# <-- DO NOT UPDATE` on each validation check to preserve the promised placeholder-editing guidance.</violation>
</file>
Shadow auto-approve: would not auto-approve because issues were found.
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| if api_key in ("YOUR_API_KEY_HERE", ""): | ||
| raise SystemExit("Set API_KEY to your Unstructured API key before running this script.") | ||
| if input_dir in ("/full/path/to/your/input/directory", ""): | ||
| raise SystemExit("Set INPUT_DIR to the local directory containing the file (or files) you want to process before running this script.") | ||
| if output_dir in ("/full/path/to/your/output/directory", ""): | ||
| raise SystemExit("Set OUTPUT_DIR to the local directory where you want the results saved before running this script.") |
There was a problem hiding this comment.
P2: The validation checks still contain the same placeholder strings as the editable settings, but removing their DO NOT UPDATE markers reintroduces the ambiguity this change is meant to resolve. Keep the marker on each validation check.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At transform/sample-code/partition-quickstart.py, line 30:
<comment>The validation checks still contain the same placeholder strings as the editable settings, but removing their `DO NOT UPDATE` markers reintroduces the ambiguity this change is meant to resolve. Keep the marker on each validation check.</comment>
<file context>
@@ -41,6 +25,18 @@ def validate_inputs(api_key, input_dir, output_dir):
+# Validate the variable settings
+def validate_inputs(api_key, input_dir, output_dir):
+ if api_key in ("YOUR_API_KEY_HERE", ""):
+ raise SystemExit("Set API_KEY to your Unstructured API key before running this script.")
+ if input_dir in ("/full/path/to/your/input/directory", ""):
</file context>
| if api_key in ("YOUR_API_KEY_HERE", ""): | |
| raise SystemExit("Set API_KEY to your Unstructured API key before running this script.") | |
| if input_dir in ("/full/path/to/your/input/directory", ""): | |
| raise SystemExit("Set INPUT_DIR to the local directory containing the file (or files) you want to process before running this script.") | |
| if output_dir in ("/full/path/to/your/output/directory", ""): | |
| raise SystemExit("Set OUTPUT_DIR to the local directory where you want the results saved before running this script.") | |
| if api_key in ("YOUR_API_KEY_HERE", ""): # <-- DO NOT UPDATE | |
| raise SystemExit("Set API_KEY to your Unstructured API key before running this script.") | |
| if input_dir in ("/full/path/to/your/input/directory", ""): # <-- DO NOT UPDATE | |
| raise SystemExit("Set INPUT_DIR to the local directory containing the file (or files) you want to process before running this script.") | |
| if output_dir in ("/full/path/to/your/output/directory", ""): # <-- DO NOT UPDATE | |
| raise SystemExit("Set OUTPUT_DIR to the local directory where you want the results saved before running this script.") |
| if api_key in ("YOUR_API_KEY_HERE", ""): | ||
| raise SystemExit("Set API_KEY to your Unstructured API key before running this script.") | ||
| if input_dir in ("/full/path/to/your/input/directory", ""): | ||
| raise SystemExit("Set INPUT_DIR to the local directory containing the file (or files) you want to process before running this script.") | ||
| if output_dir in ("/full/path/to/your/output/directory", ""): | ||
| raise SystemExit("Set OUTPUT_DIR to the local directory where you want the results saved before running this script.") |
There was a problem hiding this comment.
P2: The validation comparisons no longer identify their literals as non-editable, so readers can mistake these guard values for the settings they should change. Restore # <-- DO NOT UPDATE on each validation check to preserve the promised placeholder-editing guidance.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At transform/sample-code/extract-quickstart.py, line 30:
<comment>The validation comparisons no longer identify their literals as non-editable, so readers can mistake these guard values for the settings they should change. Restore `# <-- DO NOT UPDATE` on each validation check to preserve the promised placeholder-editing guidance.</comment>
<file context>
@@ -39,13 +23,26 @@ def validate_inputs(api_key, input_dir, output_dir):
+
+# Validate the variable settings
+def validate_inputs(api_key, input_dir, output_dir):
+ if api_key in ("YOUR_API_KEY_HERE", ""):
+ raise SystemExit("Set API_KEY to your Unstructured API key before running this script.")
+ if input_dir in ("/full/path/to/your/input/directory", ""):
</file context>
| if api_key in ("YOUR_API_KEY_HERE", ""): | |
| raise SystemExit("Set API_KEY to your Unstructured API key before running this script.") | |
| if input_dir in ("/full/path/to/your/input/directory", ""): | |
| raise SystemExit("Set INPUT_DIR to the local directory containing the file (or files) you want to process before running this script.") | |
| if output_dir in ("/full/path/to/your/output/directory", ""): | |
| raise SystemExit("Set OUTPUT_DIR to the local directory where you want the results saved before running this script.") | |
| if api_key in ("YOUR_API_KEY_HERE", ""): # <-- DO NOT UPDATE | |
| raise SystemExit("Set API_KEY to your Unstructured API key before running this script.") | |
| if input_dir in ("/full/path/to/your/input/directory", ""): # <-- DO NOT UPDATE | |
| raise SystemExit("Set INPUT_DIR to the local directory containing the file (or files) you want to process before running this script.") | |
| if output_dir in ("/full/path/to/your/output/directory", ""): # <-- DO NOT UPDATE | |
| raise SystemExit("Set OUTPUT_DIR to the local directory where you want the results saved before running this script.") |
Summary
Follow-up to #11 (merged). Adds two independent improvements to both sample scripts:
Test plan
python3 -m py_compileon both scriptstransform/quickstart-python.mdx, apart from theEXTRACTION_PROMPT/Extractornode difference between the two scripts🤖 Generated with Claude Code