Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@ jobs:
permissions:
id-token: write
steps:
- name: Setup python to build package
uses: actions/setup-python@v6
- name: Install uv & Python
uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
- name: Install build
run: python -m pip install build
python-version: "3.13"
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Build ext package
run: python -m build ext/
run: uv build --package=django-stubs-ext
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

no worries, they behave the same anyway

- name: Publish ext to PyPI
uses: pypa/[email protected]
with:
packages-dir: ext/dist/
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Top-level dist/ directory is now used for both packages.

Copy link
Contributor

Choose a reason for hiding this comment

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

how does it look inside ?

Is there a risk we upload part of django-stub-ext in django-stubs or the other way around ?

And does it mean that a bare uv publish will publish both ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there a risk we upload part of django-stub-ext in django-stubs or the other way around ?

Not as long as uv build respects the --package= switch. It only creates package files for one or the other package, not both.

And does it mean that a bare uv publish will publish both ?

Seems like it just looks at the dist/ directory and uploads whatever is present.

% uv publish --dry-run
error: No files found to publish

% uv build --package=django-stubs
...
Successfully built dist/django_stubs-5.2.5.tar.gz
Successfully built dist/django_stubs-5.2.5-py3-none-any.whl
% uv publish --dry-run
Checking 2 files against https://upload.pypi.org/legacy/
Enter username ('__token__' if using a token): ^C

% uv build --package=django-stubs-ext
...
Successfully built dist/django_stubs_ext-5.2.5.tar.gz
Successfully built dist/django_stubs_ext-5.2.5-py3-none-any.whl
% uv publish --dry-run
Checking 4 files against https://upload.pypi.org/legacy/
Enter username ('__token__' if using a token): ^C

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

how does it look inside ?

After running both build commands it has 4 files:

django_stubs-5.2.5-py3-none-any.whl
django_stubs-5.2.5.tar.gz
django_stubs_ext-5.2.5-py3-none-any.whl
django_stubs_ext-5.2.5.tar.gz

Copy link
Contributor

Choose a reason for hiding this comment

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

Then I suppose a simple uv publish might be enough here, I'm using this action for one of my packages ?

We can probably test with test pypi uv publish --publish-url https://test.pypi.org/legacy/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I suppose a simple uv publish might be enough here

We don't use manually configured PyPI credentials like the one linked above. There's some authentication magic that happens between GitHub Actions and PyPI.

No idea how it works, I'd rather not touch it myself. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

There's some authentication magic that happens between GitHub Actions and PyPI.

oh right, that's probably good to keep indeed


build-and-publish:
runs-on: ubuntu-latest
Expand All @@ -49,6 +45,6 @@ jobs:
with:
fetch-depth: 0
- name: Build package
run: uv build
run: uv build --package=django-stubs
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In theory, we could use uv build --all here and publish in one GitHub job.

But I couldn't figure out whether pypa/gh-action-pypi-publish supports atomic uploads for multiple different packages.

So the original concern for splitting GitHub jobs may be still valid. --> #2183 (comment)

A problem that then shows up is that if e.g. django-stubs-ext succeeds but django-stubs fails, it's not possible to rerun the release action.

Copy link
Member

Choose a reason for hiding this comment

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

I think one job is even better: because now the first one can finish and the second one can fail.

- name: Publish to PyPI
uses: pypa/[email protected]
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,4 @@ jobs:
- name: Ensure uv.lock is up to date
run: env --unset=UV_FROZEN uv lock --check
- name: Build
run: |
uv build .
uv build ext/
run: uv build --all-packages
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ Funding = "https://github.com/sponsors/typeddjango"

[tool.uv.sources]
django-stubs = { workspace = true }
django-stubs-ext = { path = "ext", editable = true }
django-stubs-ext = { workspace = true }

[tool.uv.workspace]
members = ["ext"]

[build-system]
requires = ["uv_build>=0.8.22,<0.9.0"]
Expand Down
6 changes: 6 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading