Skip to content

python: update & fix examples #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 13, 2025
Merged

Conversation

bryfox
Copy link
Contributor

@bryfox bryfox commented Mar 11, 2025

Changelog

None

Docs

None

Description

This updates and, in places, fixes the python examples.

  • Remove lock files
  • Add a CI job to run all examples
  • Fix some issues uncovered by the above (typing in python 3.9; renamed class)

This also updates node in other CI jobs for consistency; v18 will be EOL soon.

Once the API has stabilized, I would like to reference published SDK versions with flexible constraints. This will make them easier to run, since the current setup requires a rust toolchain. Having a CI step in place will make sure examples continue to run correctly as we publish new versions.

The new CI job is intended to catch basic errors in the python examples. Because many of the examples run a live server indefinitely, these run for 5s and then exit. I put the script at the top-level since we have scripts there already, and because I don't want to clutter the examples directory with auxiliary stuff. These also run sequentially as noted, because I don't want to update examples to serve this CI step; I don't think it'll be the bottleneck yet. There's room for improvement down the line.

Copy link

linear bot commented Mar 11, 2025

@bryfox bryfox requested review from gasmith, jtbandes and eloff March 12, 2025 13:55
@bryfox
Copy link
Contributor Author

bryfox commented Mar 12, 2025

Failures here are because of the breaking module change from #276. We could release a 0.3.1 with that change, and update here; I don't foresee other breaking changes until we gather more feedback in the next couple of weeks.

Long term, I don't have a better plan for breaking changes other than constraining versions until releases are available. We could keep referencing the local SDK for now. The big downside in my mind is that people wanting to run these examples then need to also set up the rust toolchain. Open to thoughts here.

edit: I kept the examples referencing the local SDK for now, and updated the PR description.


async function newTempFile() {
const prefix = `${tmpdir()}${path.sep}`;
const dir = await mkdtemp(prefix);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we clean this up on exit?

@bryfox
Copy link
Contributor Author

bryfox commented Mar 13, 2025

I bumped the minor version of pyo3 because of this build error; will need to look into our versioning constraints at some point. Also bumped pyo3-log a minor version.

@bryfox bryfox merged commit f4505f4 into main Mar 13, 2025
38 checks passed
@bryfox bryfox deleted the bryan/fg-10714-update-python-examples branch March 13, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants