Skip to content

Add Transform Python quickstart sample scripts - #9

Merged
3 commits merged into
mainfrom
doc-271-transform-api-quickstarts
Aug 22, 2026
Merged

Add Transform Python quickstart sample scripts#9
3 commits merged into
mainfrom
doc-271-transform-api-quickstarts

Conversation

@monica-unstructured

@monica-unstructured monica-unstructured commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add transform/sample-code/extract_quickstart.py — partitions a file and extracts structured data with an Extractor node
  • Add transform/sample-code/partition_quickstart.py — partitions a file only, no structured extraction
  • Both scripts match exactly what's shown in the Python quickstart page (docs PR #1090), and were tested end to end against the live API

Note:

  • cubic-dev-ai (automated review bot) flagged that both scripts open a file handle for every file in INPUT_DIR but never close them.

  • The fix wraps the create_job call in try/finally and closes every file handle in the finally block, so cleanup runs whether the call succeeds or raises.

  • I'm implementing the suggested fix because quickstart code like this may get copied into production pipelines, where a directory with thousands of files could hit the OS's open-file-descriptor limit and crash.

  • Retested both scripts end to end after the update. Both completed and output saved with no errors.

Test plan

  • Both files download correctly via raw.githubusercontent.com
  • Filenames/paths match what's referenced in docs PR #1090

🤖 Generated with Claude Code

Add extract_quickstart.py (partition + structured data extraction) and transform_quickstart.py (partition only), matching the scripts shown in the Python quickstart page.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic

Comment thread transform/sample-code/extract_quickstart.py
Comment thread transform/sample-code/partition_quickstart.py
monica-unstructured and others added 2 commits August 22, 2026 00:34
The script only runs a Partitioner node, not a full transform pipeline.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Addresses cubic-dev-ai review feedback on PR #9: leaving these open through
polling and download risks exhausting file descriptors on directories with
many input files.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 2 files (changes from recent commits).

Shadow auto-approve: would not auto-approve. Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

@ghost
ghost merged commit 1eaff3a into main Aug 22, 2026
4 checks passed
@ghost
ghost deleted the doc-271-transform-api-quickstarts branch August 22, 2026 14:04
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant