Skip to content

GH-40163: [Archery] Avoid setuptools_scm internal API - #50669

Merged
pitrou merged 2 commits into
apache:mainfrom
LarryHu0217:codex/archery-public-version-api-40163
Jul 28, 2026
Merged

GH-40163: [Archery] Avoid setuptools_scm internal API#50669
pitrou merged 2 commits into
apache:mainfrom
LarryHu0217:codex/archery-public-version-api-40163

Conversation

@LarryHu0217

@LarryHu0217 LarryHu0217 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Crossbow currently computes development versions through internal setuptools_scm APIs. Those APIs are unstable and require Archery to pin an otherwise unnecessary runtime dependency.

What changes are included in this PR?

  • Compute the development version from public git describe output.
  • Preserve the existing behavior for released, development, release-candidate, and dirty tags.
  • Remove setuptools_scm from the Crossbow extra.
  • Add unit coverage plus a real temporary Git repository test.

Are these changes tested?

  • python -m pytest -q dev/archery/archery/crossbow/tests/test_core.py (31 passed)
  • flake8 --max-line-length=88 on the changed Python files
  • autopep8 --diff --max-line-length=88 on the changed Python files
  • Verified Archery imports when setuptools_scm is not installed

Are there any user-facing changes?

No. This removes an internal dependency while preserving Crossbow version behavior.

Closes #40163

@LarryHu0217
LarryHu0217 requested a review from pitrou as a code owner July 28, 2026 01:40
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #40163 has been automatically assigned in GitHub to PR creator.

@github-actions github-actions Bot added the awaiting review Awaiting review label Jul 28, 2026
Comment on lines +88 to +90
version_file = tmp_path / "version.txt"
version_file.write_text("released\n")
run_git("add", "version.txt")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the version file for? It shouldn't be used for version parsing AFAICT.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed version.txt; the integration test now uses two --allow-empty commits only to establish the tagged commit and distance.

Comment thread dev/archery/archery/crossbow/core.py Outdated

import os
import re
import subprocess

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: please let's keep these imports (roughly) alphabetically-ordered :-)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reordered the standard-library imports.



def test_get_version_from_git_repository(tmp_path):
def run_git(*args):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test will fail if a git command is not available (which is unlikely on dev setups, for sure). Can we skip in that case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a pytest.mark.skipif guard using shutil.which("git").

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jul 28, 2026

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the update @LarryHu0217

@pitrou

pitrou commented Jul 28, 2026

Copy link
Copy Markdown
Member

Could you double-check this @raulcd ?

@pitrou

pitrou commented Jul 28, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit wheelcp314t*

@github-actions

Copy link
Copy Markdown

Revision: 2140393

Submitted crossbow builds: ursacomputing/crossbow @ actions-13a619705c

Task Status
wheel-macos-monterey-cp314-cp314t-amd64 GitHub Actions
wheel-macos-monterey-cp314-cp314t-arm64 GitHub Actions
wheel-manylinux-2-28-cp314-cp314t-amd64 GitHub Actions
wheel-manylinux-2-28-cp314-cp314t-arm64 GitHub Actions
wheel-musllinux-1-2-cp314-cp314t-amd64 GitHub Actions
wheel-musllinux-1-2-cp314-cp314t-arm64 GitHub Actions
wheel-windows-cp314-cp314t-amd64 GitHub Actions

@raulcd raulcd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This LGTM, thanks for the PR @LarryHu0217

@pitrou

pitrou commented Jul 28, 2026

Copy link
Copy Markdown
Member

The names of generated wheel files above seem as expected.

@pitrou
pitrou merged commit b1af964 into apache:main Jul 28, 2026
36 checks passed
@pitrou pitrou removed the awaiting committer review Awaiting committer review label Jul 28, 2026
@github-actions github-actions Bot added the awaiting merge Awaiting merge label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge Awaiting merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Archery] Avoid relying on internal setuptools_scm API

3 participants