diff --git a/pom.xml b/pom.xml
index 9e58ffe4e0c9..afe24ee37c64 100644
--- a/pom.xml
+++ b/pom.xml
@@ -778,7 +778,7 @@
org.apache.rat
apache-rat-plugin
- 0.11
+ 0.12
${project.build.directory}/${project.build.finalName}.rat
false
@@ -794,6 +794,7 @@
**/test/resources/**/*.txt
**/test/**/.placeholder
.repository/**/*
+ **/nose-*.egg/**/*
**/.checkstyle
diff --git a/sdks/pom.xml b/sdks/pom.xml
index aa9cbed41292..fe37e9630e76 100644
--- a/sdks/pom.xml
+++ b/sdks/pom.xml
@@ -34,6 +34,7 @@
java
+ python
@@ -53,8 +54,9 @@
+
-
\ No newline at end of file
+
diff --git a/sdks/python/MANIFEST.in b/sdks/python/MANIFEST.in
new file mode 100644
index 000000000000..baa2fdac6749
--- /dev/null
+++ b/sdks/python/MANIFEST.in
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+# This file is used from Python to sync versions
+include pom.xml
diff --git a/sdks/python/apache_beam/utils/dependency.py b/sdks/python/apache_beam/utils/dependency.py
index 7d1ae4194c68..aacaf903740c 100644
--- a/sdks/python/apache_beam/utils/dependency.py
+++ b/sdks/python/apache_beam/utils/dependency.py
@@ -66,7 +66,6 @@
from apache_beam.utils import processes
from apache_beam.utils.options import GoogleCloudOptions
from apache_beam.utils.options import SetupOptions
-from apache_beam.version import __version__
# Standard file names used for staging files.
diff --git a/sdks/python/apache_beam/utils/dependency_test.py b/sdks/python/apache_beam/utils/dependency_test.py
index 2f9a57b2100f..ca318067c6d9 100644
--- a/sdks/python/apache_beam/utils/dependency_test.py
+++ b/sdks/python/apache_beam/utils/dependency_test.py
@@ -29,7 +29,6 @@
from apache_beam.utils.options import GoogleCloudOptions
from apache_beam.utils.options import PipelineOptions
from apache_beam.utils.options import SetupOptions
-from apache_beam.version import __version__
class SetupTest(unittest.TestCase):
diff --git a/sdks/python/apache_beam/version.py b/sdks/python/apache_beam/version.py
index c4c99f3c1605..60d963482b2d 100644
--- a/sdks/python/apache_beam/version.py
+++ b/sdks/python/apache_beam/version.py
@@ -15,6 +15,44 @@
# limitations under the License.
#
-"""Apache Beam SDK version information."""
+"""Apache Beam SDK version information and utilities."""
-__version__ = '0.3.0'
+
+import re
+
+
+__version__ = '0.3.0-incubating.dev' # TODO: PEP 440 and incubating suffix
+
+
+# The following utilities are legacy code from the Maven integration;
+# see BEAM-378 for further details.
+
+
+# Reads the actual version from pom.xml file,
+def get_version_from_pom():
+ with open('pom.xml', 'r') as f:
+ pom = f.read()
+ regex = (r'.*\s*'
+ r'[a-z\.]+\s*'
+ r'[a-z\-]+\s*'
+ r'([0-9a-zA-Z\.\-]+).*')
+ pattern = re.compile(str(regex))
+ search = pattern.search(pom)
+ version = search.group(1)
+ version = version.replace("-SNAPSHOT", ".dev")
+ # TODO: PEP 440 and incubating suffix
+ return version
+
+
+# Synchronizes apache_beam.__version__ field for later usage
+def sync_version(version):
+ init_path = 'apache_beam/__init__.py'
+ regex = r'^__version__\s*=\s*".*"'
+ with open(init_path, "r") as f:
+ lines = f.readlines()
+ with open(init_path, "w") as f:
+ for line in lines:
+ if re.search(regex, line):
+ f.write(re.sub(regex, '__version__ = "%s"' % version, line))
+ else:
+ f.write(line)
diff --git a/sdks/python/pom.xml b/sdks/python/pom.xml
new file mode 100644
index 000000000000..79d20bf0e057
--- /dev/null
+++ b/sdks/python/pom.xml
@@ -0,0 +1,169 @@
+
+
+
+
+ 4.0.0
+
+
+ org.apache.beam
+ beam-sdks-parent
+ 0.3.0-incubating-SNAPSHOT
+ ../pom.xml
+
+
+ beam-sdks-python
+
+ pom
+
+ Apache Beam :: SDKs :: Python
+
+
+ python2
+ pip2
+ ${project.build.directory}/build
+ ${project.build.directory}/python
+
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+
+
+
+ none
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+
+
+ setuptools-clean
+ clean
+
+ exec
+
+
+ ${python.interpreter.bin}
+
+ setup.py
+ clean
+
+
+
+
+ setuptools-build
+ compile
+
+ exec
+
+
+ ${python.interpreter.bin}
+
+ setup.py
+ build
+ --build-base
+ ${python.build.base}
+
+
+
+
+ setup-test-create-python-base
+ process-test-resources
+
+ exec
+
+
+ mkdir
+
+ -p
+ ${python.user.base}
+
+
+
+
+ setup-test-tox
+ process-test-resources
+
+ exec
+
+
+ ${python.pip.bin}
+
+ install
+ --user
+ --upgrade
+ --ignore-installed
+ tox
+
+
+ ${python.user.base}
+
+
+
+
+ setuptools-test
+ test
+
+ exec
+
+
+ ${python.user.base}/bin/tox
+
+ -e
+ py27
+ -c
+ tox.ini
+
+
+ ${python.user.base}
+
+
+
+
+ setuptools-sdist
+ package
+
+ exec
+
+
+ ${python.interpreter.bin}
+
+ setup.py
+ sdist
+ --dist-dir
+ ${project.build.directory}
+
+
+ ${python.user.base}
+
+
+
+
+
+
+
+
+
diff --git a/sdks/python/setup.cfg b/sdks/python/setup.cfg
index 547a74b5cb10..fcfe003a7d36 100644
--- a/sdks/python/setup.cfg
+++ b/sdks/python/setup.cfg
@@ -26,3 +26,5 @@ verbosity=2
# fast_coders_test and typecoders_test.
exclude=fast_coders_test|typecoders_test
+[egg_info]
+egg_base = target
diff --git a/sdks/python/setup.py b/sdks/python/setup.py
index b0a5c85971c2..58e677e9bbe4 100644
--- a/sdks/python/setup.py
+++ b/sdks/python/setup.py
@@ -98,6 +98,6 @@ def get_version():
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
],
- license='Apache 2.0',
+ license='Apache License, Version 2.0',
keywords=PACKAGE_KEYWORDS,
)
diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini
index 5a2572ed1812..cba9626a0593 100644
--- a/sdks/python/tox.ini
+++ b/sdks/python/tox.ini
@@ -17,6 +17,9 @@
[tox]
envlist = py27
+toxworkdir={toxinidir}/target/tox
+distdir={toxinidir}/target/dist
+distshare={toxinidir}/target/distshare
[pep8]
# Disable all errors and warnings except for the ones related to blank lines.