Files
Liang Hu b1af964af0 GH-40163: [Archery] Avoid setuptools_scm internal API (#50669)
### 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
* GitHub Issue: #40163

Authored-by: Liang Hu <lh3057@columbia.edu>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2026-07-28 17:18:43 +02:00

61 lines
2.0 KiB
Python
Executable File

#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import functools
import operator
import sys
from setuptools import setup, find_packages
if sys.version_info < (3, 11):
sys.exit('Python < 3.11 is not supported')
# For pathlib.Path compatibility
jinja_req = 'jinja2>=2.11'
extras = {
'benchmark': ['pandas'],
'crossbow': [jinja_req, 'pygit2>=1.14.0', 'pygithub>=2.5.0', 'requests',
'ruamel.yaml'],
'docker': ['ruamel.yaml', 'python-dotenv'],
'integration': ['cffi', 'numpy'],
'integration-java': ['jpype1'],
'numpydoc': ['numpydoc==1.1.0'],
'release': ['pygithub<2.9.0', jinja_req, 'semver', 'gitpython'],
}
extras['bot'] = extras['crossbow'] + ['pygithub<2.9.0']
extras['all'] = list(set(functools.reduce(operator.add, extras.values())))
setup(
name='archery',
version="0.1.0",
description='Apache Arrow Developers Tools',
url='http://github.com/apache/arrow',
maintainer='Arrow Developers',
maintainer_email='dev@arrow.apache.org',
packages=find_packages(),
include_package_data=True,
python_requires='>=3.11',
install_requires=['click>=7'],
tests_require=['pytest', 'responses'],
extras_require=extras,
entry_points='''
[console_scripts]
archery=archery.cli:archery
'''
)