Skip to content
Draft
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased](https://github.com/hynek/build-and-inspect-python-package/compare/v2.13.0...main)

### Added

- New `package` input to support building a single package from a `uv` workspace, or all packages in it.
[#170](https://github.com/hynek/build-and-inspect-python-package/pull/170)


## [2.13.0](https://github.com/hynek/build-and-inspect-python-package/compare/v2.12.0...2.13.0)

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ While *build-and-inspect-python-package* will build a wheel for you by default,
Requires `attestations: write` and `id-token: write` permissions.
The only meaningful value is `'true'` (note the quotes – GitHub Actions only allow string inputs) and everything else is treated as falsey.
(*optional*, default: `'false'`).
- `package`: The package to build.
If not specified, the package in the current directory is built.
If set to `all`, all packages in the `uv` [workspace](https://docs.astral.sh/uv/concepts/workspaces/) are built.
Copy link
Contributor

Choose a reason for hiding this comment

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

Wdyt of adding a note that one can use uv tree --depth 0 to view all packages in the current workspace?

Copy link
Owner

Choose a reason for hiding this comment

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

pr welcome ;)

(*optional*, default: `''`).

> [!IMPORTANT]
> [GitHub's artifact attestations](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds) are different from PyPI's [Sigstore](https://www.sigstore.dev) attestations that you can generate while uploading using [*pypa/gh-action-pypi-publish*](https://github.com/pypa/gh-action-pypi-publish?tab=readme-ov-file#generating-and-uploading-attestations).
Expand Down
18 changes: 16 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ inputs:
description: "Attest provenance using GitHub's own action. Requires 'attestations: write' and 'id-token: write' permissions."
required: false
default: 'false'
package:
description: "The package to build. If not specified, the package in the current directory is built. If 'all', all packages in the workspace are built."
required: false
default: ''
outputs:
artifact-name:
description: The name of the uploaded artifact.
Expand Down Expand Up @@ -120,10 +124,20 @@ runs:
echo Setting SOURCE_DATE_EPOCH to $(git log -1 --pretty=%ct).
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)

if [[ -n "${{ inputs.package }}" ]]; then
if [[ "${{ inputs.package }}" == "all" ]]; then
PACKAGE_ARGS="--all-packages"
else
PACKAGE_ARGS="--package ${{ inputs.package }}"
fi
else
PACKAGE_ARGS=""
fi

if [[ "${{ inputs.skip-wheel }}" == "true" ]]; then
uv build --sdist --out-dir /tmp/baipp/dist
uv build --sdist --out-dir /tmp/baipp/dist $PACKAGE_ARGS
else
uv build --out-dir /tmp/baipp/dist
uv build --out-dir /tmp/baipp/dist $PACKAGE_ARGS
fi

# We don't need .gitignores and it litters the provenance output.
Expand Down