Skip to content

Commit

Permalink
ARROW-379: Use setuptools_scm for Python versioning
Browse files Browse the repository at this point in the history
Author: Uwe L. Korn <uwelk@xhochy.com>

Closes #224 from xhochy/ARROW-379 and squashes the following commits:

3a68d9f [Uwe L. Korn] Remove deprecated version import
15fe9b2 [Uwe L. Korn] Add license header
aa9bd49 [Uwe L. Korn] ARROW-379: Use setuptools_scm for Python versioning
  • Loading branch information
xhochy authored and wesm committed Dec 4, 2016
1 parent b5de9e5 commit 0ac01a5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 28 deletions.
5 changes: 0 additions & 5 deletions dev/release/00-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,4 @@ mvn release:prepare -Dtag=${tag} -DreleaseVersion=${version} -DautoVersionSubmod

cd -

cd "${SOURCE_DIR}/../../python"
sed -i "s/VERSION = '[^']*'/VERSION = '${version}'/g" setup.py
sed -i "s/ISRELEASED = False/ISRELEASED = True/g" setup.py
cd -

echo "Finish staging binary artifacts by running: sh dev/release/01-perform.sh"
1 change: 1 addition & 0 deletions python/.git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions python/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
10 changes: 8 additions & 2 deletions python/pyarrow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@

# flake8: noqa

from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass


import pyarrow.config

from pyarrow.array import (Array,
Expand All @@ -43,5 +51,3 @@

from pyarrow.table import (Column, RecordBatch, dataframe_from_batches, Table,
from_pandas_dataframe)

from pyarrow.version import version as __version__
20 changes: 20 additions & 0 deletions python/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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.

[build_sphinx]
source-dir = doc/
build-dir = doc/_build
23 changes: 2 additions & 21 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,9 @@
if Cython.__version__ < '0.19.1':
raise Exception('Please upgrade to Cython 0.19.1 or newer')

VERSION = '0.1.0'
ISRELEASED = False

if not ISRELEASED:
VERSION += '.dev'

setup_dir = os.path.abspath(os.path.dirname(__file__))


def write_version_py(filename=os.path.join(setup_dir, 'pyarrow/version.py')):
a = open(filename, 'w')
file_content = "\n".join(["",
"# THIS FILE IS GENERATED FROM SETUP.PY",
"version = '%(version)s'",
"isrelease = '%(isrelease)s'"])

a.write(file_content % {'version': VERSION,
'isrelease': str(ISRELEASED)})
a.close()


class clean(_clean):

def run(self):
Expand Down Expand Up @@ -261,15 +243,12 @@ def get_outputs(self):
return [self._get_cmake_ext_path(name)
for name in self.get_names()]

write_version_py()

DESC = """\
Python library for Apache Arrow"""

setup(
name="pyarrow",
packages=['pyarrow', 'pyarrow.tests'],
version=VERSION,
zip_safe=False,
package_data={'pyarrow': ['*.pxd', '*.pyx']},
# Dummy extension to trigger build_ext
Expand All @@ -279,6 +258,8 @@ def get_outputs(self):
'clean': clean,
'build_ext': build_ext
},
use_scm_version = {"root": "..", "relative_to": __file__},
setup_requires=['setuptools_scm', 'setuptools_scm_git_archive'],
install_requires=['cython >= 0.23', 'numpy >= 1.9', 'six >= 1.0.0'],
description=DESC,
license='Apache License, Version 2.0',
Expand Down

0 comments on commit 0ac01a5

Please sign in to comment.