You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2022/07/21 15:34:01 UTC
[iceberg] branch master updated: Python: Add __version__ to the package (#5315)
This is an automated email from the ASF dual-hosted git repository.
blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/master by this push:
new debad8e81e Python: Add __version__ to the package (#5315)
debad8e81e is described below
commit debad8e81ed1d0df91b37d9d0fdc284324d47b2b
Author: Fokko Driesprong <fo...@apache.org>
AuthorDate: Thu Jul 21 17:33:52 2022 +0200
Python: Add __version__ to the package (#5315)
---
python/dev/RELEASE.md | 4 ++--
python/pyiceberg/__init__.py | 3 +++
python/pyproject.toml | 2 +-
python/{pyiceberg/__init__.py => tests/test_version.py} | 13 +++++++++++++
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/python/dev/RELEASE.md b/python/dev/RELEASE.md
index d54fa0132d..03ec767808 100644
--- a/python/dev/RELEASE.md
+++ b/python/dev/RELEASE.md
@@ -28,8 +28,8 @@ First we're going to release a release candidate (RC) and publish it to the publ
Make sure that you're on the version that you want to release.
```bash
-export RC=rc1
-export VERSION=0.0.1${RC}
+export RC=rc0
+export VERSION=0.0.1.${RC}
export VERSION_WITHOUT_RC=${VERSION/rc?/}
export VERSION_BRANCH=${VERSION_WITHOUT_RC//./-}
diff --git a/python/pyiceberg/__init__.py b/python/pyiceberg/__init__.py
index 13a83393a9..0c4a31db7a 100644
--- a/python/pyiceberg/__init__.py
+++ b/python/pyiceberg/__init__.py
@@ -14,3 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+from importlib import metadata
+
+__version__ = metadata.version(__package__)
diff --git a/python/pyproject.toml b/python/pyproject.toml
index a3e35bfc94..3d080332ca 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -17,7 +17,7 @@
[tool.poetry]
name = "pyiceberg"
-version = "0.0.1rc1"
+version = "0.1.0.dev0"
readme = "README.md"
homepage = "https://iceberg.apache.org/"
repository = "https://github.com/apache/iceberg/"
diff --git a/python/pyiceberg/__init__.py b/python/tests/test_version.py
similarity index 71%
copy from python/pyiceberg/__init__.py
copy to python/tests/test_version.py
index 13a83393a9..12a058e3f3 100644
--- a/python/pyiceberg/__init__.py
+++ b/python/tests/test_version.py
@@ -14,3 +14,16 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+import re
+
+from pyiceberg import __version__
+
+VERSION_REGEX = re.compile(r"^\d+.\d+.\d+(.(dev|rc)\d+)?$")
+
+
+def test_version_format():
+ # should be in the format of 0.14.0 or 0.14.0.dev0
+ assert VERSION_REGEX.search(__version__)
+
+ # RCs should work as well
+ assert VERSION_REGEX.search("0.1.0.rc0")