From cd47733fb62d947ec3ac6a4f64ced2c991f2f3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Fri, 31 Jan 2025 18:49:59 -0600 Subject: [PATCH 1/3] Output the package name --- README.md | 4 +++- action.yml | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 630dcb2..81493f2 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,8 @@ While *build-and-inspect-python-package* will build a wheel for you by default, This is useful if you only want to define a matrix based on Python versions, because then you can just assign this to `strategy.matrix`. +- `package_name`: The name of the package as extracted from the package metadata. + - `package_version`: The version of the package as extracted from the package metadata. This is useful, for example, for displaying the PyPI URL on the GitHub UI for the publishing job: @@ -173,7 +175,7 @@ While *build-and-inspect-python-package* will build a wheel for you by default, needs: baipp environment: name: pypi - url: https://pypi.org/project/structlog/${{ needs.baipp.outputs.package-version }} + url: https://pypi.org/project/${{ needs.baipp.outputs.package-name }}/${{ needs.baipp.outputs.package-version }} ``` ### Artifacts diff --git a/action.yml b/action.yml index 3810915..38ca637 100644 --- a/action.yml +++ b/action.yml @@ -44,6 +44,9 @@ outputs: supported Python versions. In other words, you can assign it directly to the 'strategy.matrix' key. value: ${{ steps.metadata-setter.outputs.supported_python_classifiers_json_job_matrix_value }} + package_name: + description: The name of the package. + value: ${{ steps.metadata-setter.outputs.package_name }} package_version: description: The version of the package as declared in the metadata. value: ${{ steps.metadata-setter.outputs.package_version }} @@ -251,8 +254,10 @@ runs: if match := re.match(r"Programming Language :: Python :: (\d+\.\d+)$", classifier): version_tokens.append(match.group(1)) + package_name = pkg_info.get("Name") package_version = pkg_info.get("Version", "0.0.0") + print(f"package_name={package_name}") print(f"package_version={package_version}") print(f"supported_python_classifiers_json_array={json.dumps(version_tokens)}") print(f"""supported_python_classifiers_json_job_matrix_value={json.dumps({"python-version": version_tokens})}""") From d404ab0af268ab3b620596216ff47265da9c4d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Mon, 2 Jun 2025 16:40:37 -0600 Subject: [PATCH 2/3] Raise exception if package name is not found --- action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/action.yml b/action.yml index daeedbd..0b02525 100644 --- a/action.yml +++ b/action.yml @@ -255,6 +255,9 @@ runs: version_tokens.append(match.group(1)) package_name = pkg_info.get("Name") + if package_name is None: + raise RuntimeError("Package name is not set") + package_version = pkg_info.get("Version", "0.0.0") print(f"package_name={package_name}") From 09b4e2d427aec3f4717c635b8e91fbd4babbddf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Fri, 13 Jun 2025 14:10:01 -0600 Subject: [PATCH 3/3] Echo structlog package name --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 572a808..215071c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,10 @@ jobs: path: structlog upload-name-suffix: "-structlog-${{ matrix.os }}" - - run: echo Packages can be found at ${{ steps.baipp.outputs.dist }} and in artifact ${{ steps.baipp.outputs.artifact-name }} + - run: > + echo "Packages for ${{ steps.baipp.outputs.package_name }} (${{ steps.baipp.outputs.package_version }}) + can be found at ${{ steps.baipp.outputs.dist }} + and in artifact ${{ steps.baipp.outputs.artifact-name }}" check-pytest: name: Build & verify the pytest package.