forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apacheGH-37929: [Python] begin moving static settings to pyproject.to…
…ml (apache#41041) ### Rationale for this change To migrate Arrow to modern Python packaging standards, see [PEP-517](https://peps.python.org/pep-0517/) and [PEP-518](https://peps.python.org/pep-0518/). * GitHub Issue: apache#37929 This PR focuses on migrating the static settings, the metadata and version, to pyproject.toml. Future PRs will migrate more of the build process to pyproject.toml. Lead-authored-by: anjakefala <[email protected]> Co-authored-by: Raúl Cumplido <[email protected]> Co-authored-by: Joris Van den Bossche <[email protected]> Signed-off-by: Jacob Wujciak-Jens <[email protected]>
- Loading branch information
Showing
12 changed files
with
89 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,63 @@ requires = [ | |
# continue using oldest-support-numpy. | ||
"oldest-supported-numpy>=0.14; python_version<'3.9'", | ||
"numpy>=1.25; python_version>='3.9'", | ||
"setuptools_scm", | ||
"setuptools >= 40.1.0", | ||
"wheel" | ||
# configuring setuptools_scm in pyproject.toml requires | ||
# versions released after 2022 | ||
"setuptools_scm[toml]>=8", | ||
"setuptools>=64", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "pyarrow" | ||
dynamic = ["version"] | ||
requires-python = ">=3.8" | ||
dependencies = [ | ||
"numpy >= 1.16.6" | ||
] | ||
description = "Python library for Apache Arrow" | ||
readme = {file = "README.md", content-type = "text/markdown"} | ||
license = {text = "Apache Software License"} | ||
classifiers = [ | ||
'License :: OSI Approved :: Apache Software License', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Programming Langauge :: Python :: 3.12', | ||
] | ||
maintainers = [ | ||
{name = "Apache Arrow Developers", email = "[email protected]"} | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://arrow.apache.org/" | ||
Documentation = "https://arrow.apache.org/docs/python" | ||
Repository = "https://github.com/apache/arrow" | ||
Issues = "https://github.com/apache/arrow/issues" | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
'pytest', | ||
'hypothesis', | ||
'cffi', | ||
'pytz', | ||
'pandas' | ||
] | ||
|
||
[tool.setuptools] | ||
zip-safe=false | ||
include-package-data=true | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["."] | ||
|
||
[tool.setuptools.package-data] | ||
pyarrow = ["*.pxd", "*.pyx", "includes/*.pxd"] | ||
|
||
[tool.setuptools_scm] | ||
root = '..' | ||
version_file = 'pyarrow/_generated_version.py' | ||
version_scheme = 'guess-next-dev' | ||
git_describe_command = 'git describe --dirty --tags --long --match "apache-arrow-[0-9]*.*"' | ||
fallback_version = '17.0.0a0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
cython>=0.29.31 | ||
oldest-supported-numpy>=0.14; python_version<'3.9' | ||
numpy>=1.25; python_version>='3.9' | ||
setuptools_scm | ||
setuptools>=38.6.0 | ||
setuptools_scm>=8 | ||
setuptools>=64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,61 +352,11 @@ def get_outputs(self): | |
for name in self.get_names()] | ||
|
||
|
||
# If the event of not running from a git clone (e.g. from a git archive | ||
# or a Python sdist), see if we can set the version number ourselves | ||
default_version = '17.0.0-SNAPSHOT' | ||
if (not os.path.exists('../.git') and | ||
not os.environ.get('SETUPTOOLS_SCM_PRETEND_VERSION')): | ||
os.environ['SETUPTOOLS_SCM_PRETEND_VERSION'] = \ | ||
default_version.replace('-SNAPSHOT', 'a0') | ||
|
||
|
||
# See https://github.com/pypa/setuptools_scm#configuration-parameters | ||
scm_version_write_to_prefix = os.environ.get( | ||
'SETUPTOOLS_SCM_VERSION_WRITE_TO_PREFIX', setup_dir) | ||
|
||
|
||
def parse_git(root, **kwargs): | ||
""" | ||
Parse function for setuptools_scm that ignores tags for non-C++ | ||
subprojects, e.g. apache-arrow-js-XXX tags. | ||
""" | ||
from setuptools_scm.git import parse | ||
kwargs['describe_command'] =\ | ||
'git describe --dirty --tags --long --match "apache-arrow-[0-9]*.*"' | ||
return parse(root, **kwargs) | ||
|
||
|
||
def guess_next_dev_version(version): | ||
if version.exact: | ||
return version.format_with('{tag}') | ||
else: | ||
def guess_next_version(tag_version): | ||
return default_version.replace('-SNAPSHOT', '') | ||
return version.format_next_version(guess_next_version) | ||
|
||
|
||
with open('README.md') as f: | ||
long_description = f.read() | ||
|
||
|
||
class BinaryDistribution(Distribution): | ||
def has_ext_modules(foo): | ||
return True | ||
|
||
|
||
install_requires = ( | ||
'numpy >= 1.16.6', | ||
) | ||
|
||
|
||
# Only include pytest-runner in setup_requires if we're invoking tests | ||
if {'pytest', 'test', 'ptr'}.intersection(sys.argv): | ||
setup_requires = ['pytest-runner'] | ||
else: | ||
setup_requires = [] | ||
|
||
|
||
if strtobool(os.environ.get('PYARROW_INSTALL_TESTS', '1')): | ||
packages = find_namespace_packages(include=['pyarrow*']) | ||
exclude_package_data = {} | ||
|
@@ -420,47 +370,12 @@ def has_ext_modules(foo): | |
|
||
|
||
setup( | ||
name='pyarrow', | ||
packages=packages, | ||
zip_safe=False, | ||
package_data={'pyarrow': ['*.pxd', '*.pyx', 'includes/*.pxd']}, | ||
include_package_data=True, | ||
exclude_package_data=exclude_package_data, | ||
distclass=BinaryDistribution, | ||
# Dummy extension to trigger build_ext | ||
ext_modules=[Extension('__dummy__', sources=[])], | ||
cmdclass={ | ||
'build_ext': build_ext | ||
}, | ||
use_scm_version={ | ||
'root': os.path.dirname(setup_dir), | ||
'parse': parse_git, | ||
'write_to': os.path.join(scm_version_write_to_prefix, | ||
'pyarrow/_generated_version.py'), | ||
'version_scheme': guess_next_dev_version | ||
}, | ||
setup_requires=['setuptools_scm', 'cython >= 0.29.31'] + setup_requires, | ||
install_requires=install_requires, | ||
tests_require=['pytest', 'pandas', 'hypothesis'], | ||
python_requires='>=3.8', | ||
description='Python library for Apache Arrow', | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
classifiers=[ | ||
'License :: OSI Approved :: Apache Software License', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Programming Language :: Python :: 3.12', | ||
], | ||
license='Apache License, Version 2.0', | ||
maintainer='Apache Arrow Developers', | ||
maintainer_email='[email protected]', | ||
test_suite='pyarrow.tests', | ||
url='https://arrow.apache.org/', | ||
project_urls={ | ||
'Documentation': 'https://arrow.apache.org/docs/python', | ||
'Source': 'https://github.com/apache/arrow', | ||
}, | ||
) |