Skip to content

[SYNPY-1375] Add Activity/Provenance tutorial#1351

Merged
thomasyu888 merged 7 commits intodevelopfrom
SYNPY-1375-activity-provenance-tutorial
Apr 16, 2026
Merged

[SYNPY-1375] Add Activity/Provenance tutorial#1351
thomasyu888 merged 7 commits intodevelopfrom
SYNPY-1375-activity-provenance-tutorial

Conversation

@thomasyu888
Copy link
Copy Markdown
Member

@thomasyu888 thomasyu888 commented Apr 5, 2026

Problem:

  • The docs/tutorials/python/activity.md page was a placeholder with no working tutorial content, only an "Under Construction" banner and a redirect to the legacy docs.
  • Users had no OOP-style tutorial for working with Activity/Provenance using the new synapseclient.models API introduced in PR [SYNPY-1334] Revamp getting started docs #1036.

Solution:

  • Replaced the placeholder activity.md with a full tutorial that walks through the four planned steps: add an activity to a file, add an activity to a specific file version, print stored activities, and delete an activity.
  • Added docs/tutorials/python/tutorial_scripts/activity.py — a self-contained runnable script that backs the tutorial page, following the same pattern as all other tutorial scripts in the directory.
  • The tutorial uses the Activity, UsedEntity, and UsedURL OOP models and demonstrates both file.activity = ...; file.store() and the direct Activity.store(parent=...) / Activity.from_parent() / Activity.delete() class methods.
  • No changes to production code — documentation only.

Testing:

  • Pre-commit hooks (ruff, black, isort, bandit) all passed on commit.
  • Manual review of line ranges in the pymdownx.snippets includes against the script to confirm each section renders the intended code.
  • Full end-to-end execution against a real Synapse project is included as a checklist item for reviewers (requires a project with a file in biospecimen_experiment_1).

https://synapsepythonclient--1351.org.readthedocs.build/en/1351/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread docs/tutorials/python/tutorial_scripts/activity.py Outdated
Comment thread docs/tutorials/python/tutorial_scripts/activity.py
Comment thread docs/tutorials/python/tutorial_scripts/activity.py Outdated
@andrewelamb
Copy link
Copy Markdown
Contributor

I have two main suggesstions:

I think there should be a setup section at the top that either:

  • Specifies what needs to be setup by the user in Synapse (Project, Folder, File)
  • Globals Synapse Ids that the user fills out

There's an issue where the second version fo the file isn't being created. I'm not sure it's a bug per se, but you may want to re-write the comments to reflect that.

@thomasyu888 thomasyu888 marked this pull request as ready for review April 16, 2026 02:34
@thomasyu888 thomasyu888 requested a review from a team as a code owner April 16, 2026 02:34
Copilot AI review requested due to automatic review settings April 16, 2026 02:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a complete Activity/Provenance tutorial to the Python docs, backed by a runnable tutorial script using the synapseclient.models OOP API.

Changes:

  • Introduces a new runnable tutorial script demonstrating creating, storing, retrieving, and deleting Activity provenance.
  • Replaces the placeholder Activity/Provenance docs page with a full step-by-step tutorial that embeds snippets from the script.
  • Adds example outputs and reference links for the tutorial’s API surface (Activity, UsedEntity, UsedURL).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
docs/tutorials/python/tutorial_scripts/activity.py Adds the end-to-end tutorial script used for snippet includes in the docs.
docs/tutorials/python/activity.md Replaces placeholder content with a full tutorial that embeds script snippets and expected outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/tutorials/python/activity.md
Comment thread docs/tutorials/python/tutorial_scripts/activity.py
Comment thread docs/tutorials/python/tutorial_scripts/activity.py
Comment thread docs/tutorials/python/tutorial_scripts/activity.py Outdated
Comment thread docs/tutorials/python/activity.md
Comment thread docs/tutorials/python/tutorial_scripts/activity.py
@thomasyu888 thomasyu888 requested a review from andrewelamb April 16, 2026 19:00
@andrewelamb
Copy link
Copy Markdown
Contributor

LGTM!

@thomasyu888 thomasyu888 merged commit 520760b into develop Apr 16, 2026
21 checks passed
@thomasyu888 thomasyu888 deleted the SYNPY-1375-activity-provenance-tutorial branch April 16, 2026 19:08
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.

3 participants