Skip to content

Conversation

@birdcar
Copy link

@birdcar birdcar commented Nov 20, 2025

Description

I ran this by @nicknisi, but this is an upgrade to the plumbing behind our package building a testing to use UV instead of setup.py.

"Why?" I hear you asking; ultimately a few reasons.

  • Speed of development: UV is fast as hell and can manage/install its own versions of python, which means testing against multiple versions of Python is easier / more straightforward (I will open some future PRs to make this a single command, in fact)
  • Keeping up with Python conventions: There are still a lot of tutorials and old recommendations laying around that call for a setup.py file and direct invocation, but all direct invocations of setup.py have been essentially deprecated for years, and since PEP 518/621 landed, it's preferred to move away from the file entirely towards non-code files (namely, pyproject.toml).
  • Reproducibility: Moving to a src/ layout (i.e. the python package is in the src directory instead of the root directory) and managing its installation with uv also means we avoid some common and easy to hit bugs when it comes to catching import problems etc.

There are other reasons I could probably elucidate, but I genuinely think this is a fairly uncontroversial change since a lot of the Python community is running to use UV as it stands.

Importantly, this does not change user workflows at all, with the minor exception of affecting those who were executing python setup.py install directly previously (I'm unclear if there's a way to know that up front. We can bump the version and communicate this as a breaking change if so).

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@birdcar birdcar self-assigned this Nov 20, 2025
@birdcar birdcar requested a review from a team as a code owner November 20, 2025 16:24
@birdcar birdcar requested a review from nicknisi November 20, 2025 16:24
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 20, 2025

Skipped: This PR changes more files than the configured file change limit: (150 files found, 100 file limit)

@birdcar
Copy link
Author

birdcar commented Nov 20, 2025

Just realized I need to update the release workflow as well. Don't merge before I do that (should only take a moment or two)

@birdcar birdcar force-pushed the @birdcar/refactor/setup-py-to-pyproject-and-uv branch from b5af0ef to ffcc2a3 Compare November 20, 2025 16:51
@birdcar
Copy link
Author

birdcar commented Nov 20, 2025

The release workflow has been updated now, and according to the UV docs the way we should go about authentication for publishing a package is to configure this release action as a trusted publisher on PyPI.

I can only make part of that process happen, namely, I can follow the guide for creating the release workflow, including the recommended environment (which I did in ffcc2a3). The rest will, I'm sure, need to be discussed or acted on by someone else (@nicknisi maybe?).

Previously, we were using setuptools via a setup.py file
and various requirements*.txt files. This updates the
package to the more modern pyproject.toml file and switches
our build system to uv.

Additionally, the package was previously a top level package,
which improves testability since the package will no longer be
automatically added to sys.path.

This change will improve both our developer experience and the
packages reproducibility.
@birdcar birdcar force-pushed the @birdcar/refactor/setup-py-to-pyproject-and-uv branch from ffcc2a3 to 76de821 Compare November 21, 2025 16: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