Skip to content

[Docs] Document UnboundedSource in the Python I/O connector guide - #39529

Merged
damccorm merged 2 commits into
apache:masterfrom
Eliaaazzz:python-unbounded-source-doc
Aug 21, 2026
Merged

[Docs] Document UnboundedSource in the Python I/O connector guide#39529
damccorm merged 2 commits into
apache:masterfrom
Eliaaazzz:python-unbounded-source-doc

Conversation

@Eliaaazzz

@Eliaaazzz Eliaaazzz commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Documents UnboundedSource in the Python I/O connector development guide, mirroring the UnboundedSource coverage in the Java guide.

The guide currently describes only the bounded BoundedSource / RangeTracker path, so the UnboundedSource, UnboundedReader, and CheckpointMark classes added in #38724 are undocumented on the website.

What changes

  • The "Implementing the Source interface" intro now lists UnboundedSource alongside BoundedSource, and names the reader and checkpoint-mark classes each one needs.
  • Implementing the UnboundedSource subclass - split, create_reader, get_checkpoint_mark_coder, the optional default_output_coder, and the absence of a per-record dedup hook (use Deduplicate after the read).
  • Implementing the UnboundedReader subclass - start, advance, get_current, get_current_timestamp, get_watermark, get_checkpoint_mark, close, including the distinction between "no data right now" and a MAX_TIMESTAMP end of stream.
  • Checkpoint marks - how a mark is persisted and replayed into create_reader, and the idempotence requirement on finalize_checkpoint.
  • Reading from an UnboundedSource - an example source over a partitioned message queue, reading it with beam.io.Read, and the poll_interval / max_records_per_bundle / max_read_time_seconds knobs on ReadFromUnboundedSource.

The example was run on the DirectRunner against a fake queue before being added: beam.io.Read(QueueSource(...)) emits the expected records and, thanks to the default_output_coder override, types the output PCollection as bytes.

This replaces the earlier revision of this PR, which described how to write an unbounded Splittable DoFn instead of documenting the UnboundedSource API.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @damccorm for label website.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@Eliaaazzz
Eliaaazzz force-pushed the python-unbounded-source-doc branch from 8e5b2cb to f5f2f74 Compare July 31, 2026 12:01
@Eliaaazzz Eliaaazzz changed the title [Docs] Add unbounded source guidance to the Python I/O connector guide [Docs] Document UnboundedSource in the Python I/O connector guide Jul 31, 2026
@Eliaaazzz
Eliaaazzz force-pushed the python-unbounded-source-doc branch from f5f2f74 to 01821a4 Compare July 31, 2026 13:10
The guide covered only the bounded BoundedSource and RangeTracker path.
Add the UnboundedSource, UnboundedReader, and CheckpointMark sections,
plus an example source and the Read and ReadFromUnboundedSource entry
points.

Group the source classes under "Implementing the Source subclass" and
the reader classes under "Implementing the RangeTracker and
UnboundedReader subclasses" so the page nests the same way as the Java
guide.
@Eliaaazzz
Eliaaazzz force-pushed the python-unbounded-source-doc branch from 01821a4 to ff50ad4 Compare July 31, 2026 13:12
@Abacn
Abacn self-requested a review August 3, 2026 20:18
You can find `BoundedSource` and `RangeTracker` in the
[apache_beam.io.iobase module](https://beam.apache.org/releases/pydoc/{{< param release_latest >}}/apache_beam.io.iobase.html),
and the unbounded classes in the
[apache_beam.io.unbounded_source module](https://github.com/apache/beam/blob/master/sdks/python/apache_beam/io/unbounded_source.py).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's use https://beam.apache.org/releases/pydoc/ website. This PR won't be merged until Beam 2.76.0 released, at that time pydoc website is updated to have unbounded_source

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the pointer. I switched it to the pydoc link with the release_latest param. It will resolve once 2.76.0 is out.

### Implementing the Source subclass

### Implementing the BoundedSource subclass
You must create a subclass of either `BoundedSource` or `UnboundedSource`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"You must ..." often used as SKILLs for agents. The audience of Beam documentation is both human (and agents). Consider a plain tense: Create a subclass of .... Check this throughout the change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip. I reworded to plain tense and checked the rest of the change for You must phrasing. I kept the two sentences saying your subclass must override the following methods, since they match the existing BoundedSource and RangeTracker sections word for word. Happy to reword those as well if you prefer.

@github-actions

Copy link
Copy Markdown
Contributor

Reminder, please take a look at this pr: @damccorm

@github-actions

Copy link
Copy Markdown
Contributor

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @shunping for label website.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

@damccorm damccorm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@damccorm
damccorm merged commit 6434f74 into apache:master Aug 21, 2026
9 checks passed
@Abacn

Abacn commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

@damccorm Thanks for merging it. I forgot to comment to here that I was intended to merge this after Beam 2.76.0 release as the content is only available in this upcoming release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants