Skip to content

Commit d0ffe46

Browse files
committed
Merge branch 'main' of github.com:apache/iceberg-python into fd-warnings
2 parents 3c1cc1e + 6a77195 commit d0ffe46

File tree

7 files changed

+76
-31
lines changed

7 files changed

+76
-31
lines changed

mkdocs/docs/how-to-release.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,24 @@ Before committing the files to the Apache SVN artifact distribution SVN hashes n
5757
Go to [Github Actions and run the `Python release` action](https://github.com/apache/iceberg/actions/workflows/python-release.yml). **Set the version to master, since we cannot modify the source**. Download the zip, and sign the files:
5858

5959
```bash
60-
for name in $(ls release-master/pyiceberg-*.whl release-master/pyiceberg-*.tar.gz)
60+
cd release-master/
61+
62+
for name in $(ls pyiceberg-*.whl pyiceberg-*.tar.gz)
6163
do
6264
gpg --yes --armor --local-user [email protected] --output "${name}.asc" --detach-sig "${name}"
63-
shasum -a 512 "${name}.asc" > "${name}.asc.sha512"
65+
shasum -a 512 "${name}" > "${name}.sha512"
6466
done
6567
```
6668

67-
Now we can upload the files
69+
Now we can upload the files from the same directory:
6870

6971
```bash
7072
export SVN_TMP_DIR=/tmp/iceberg-${VERSION_BRANCH}/
7173
svn checkout https://dist.apache.org/repos/dist/dev/iceberg $SVN_TMP_DIR
7274

7375
export SVN_TMP_DIR_VERSIONED=${SVN_TMP_DIR}pyiceberg-$VERSION/
7476
mkdir -p $SVN_TMP_DIR_VERSIONED
75-
cp release-master/* $SVN_TMP_DIR_VERSIONED
77+
cp * $SVN_TMP_DIR_VERSIONED
7678
svn add $SVN_TMP_DIR_VERSIONED
7779
svn ci -m "PyIceberg ${VERSION}" ${SVN_TMP_DIR_VERSIONED}
7880
```
@@ -92,11 +94,15 @@ Final step is to generate the email to the dev mail list:
9294
```bash
9395
cat << EOF > release-announcement-email.txt
9496
95-
Subject: [VOTE] Release Apache PyIceberg $VERSION_WITHOUT_RC
97+
Subject: [VOTE] Release Apache PyIceberg $VERSION
9698
Hi Everyone,
9799
98100
I propose that we release the following RC as the official PyIceberg $VERSION_WITHOUT_RC release.
99101
102+
A summary of the high level features:
103+
104+
* <Add summary by hand>
105+
100106
The commit ID is $LAST_COMMIT_ID
101107
102108
* This corresponds to the tag: $GIT_TAG ($GIT_TAG_HASH)

mkdocs/docs/verify-release.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,29 @@ gpg --import KEYS
4747
Next, verify the `.asc` file.
4848

4949
```sh
50-
gpg --verify pyiceberg-0.4.0-py3-none-any.whl.asc pyiceberg-0.4.0-py3-none-any.whl
50+
svn checkout https://dist.apache.org/repos/dist/dev/iceberg/pyiceberg-0.5.0rc1/ /tmp/pyiceberg/
51+
52+
for name in $(ls /tmp/pyiceberg/pyiceberg-*.whl /tmp/pyiceberg/pyiceberg-*.tar.gz)
53+
do
54+
gpg --verify ${name}.asc ${name}
55+
done
5156
```
5257

5358
## Verifying checksums
5459

5560
```sh
56-
shasum -a 512 --check pyiceberg-0.4.0-py3-none-any.whl.sha512
61+
cd /tmp/pyiceberg/
62+
for name in $(ls /tmp/pyiceberg/pyiceberg-*.whl.asc.sha512 /tmp/pyiceberg/pyiceberg-*.tar.gz.asc.sha512)
63+
do
64+
shasum -a 512 --check ${name}
65+
done
5766
```
5867

5968
## Verifying License Documentation
6069

6170
```sh
62-
tar xzf pyiceberg-0.4.0.tar.gz
63-
cd pyiceberg-0.4.0
71+
tar xzf pyiceberg-0.5.0.tar.gz
72+
cd pyiceberg-0.5.0
6473
```
6574

6675
Run RAT checks to validate license header:

mkdocs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
# under the License.
1717

1818
mkdocs==1.5.3
19-
griffe==0.36.2
19+
griffe==0.36.4
2020
jinja2==3.1.2
2121
mkdocstrings==0.23.0
2222
mkdocstrings-python==1.7.1
2323
mkdocs-literate-nav==0.6.1
2424
mkdocs-autorefs==0.5.0
2525
mkdocs-gen-files==0.5.0
26-
mkdocs-material==9.4.1
26+
mkdocs-material==9.4.2
2727
mkdocs-material-extensions==1.2
2828
mkdocs-section-index==0.3.8

poetry.lock

Lines changed: 18 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyiceberg/table/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from __future__ import annotations
1818

1919
import itertools
20+
import uuid
2021
from abc import ABC, abstractmethod
2122
from copy import copy
2223
from dataclasses import dataclass
@@ -498,6 +499,14 @@ def location(self) -> str:
498499
"""Return the table's base location."""
499500
return self.metadata.location
500501

502+
def new_snapshot_id(self) -> int:
503+
"""Generate a new snapshot-id that's not in use."""
504+
snapshot_id = _generate_snapshot_id()
505+
while self.snapshot_by_id(snapshot_id) is not None:
506+
snapshot_id = _generate_snapshot_id()
507+
508+
return snapshot_id
509+
501510
def current_snapshot(self) -> Optional[Snapshot]:
502511
"""Get the current snapshot for this table, or None if there is no current snapshot."""
503512
if snapshot_id := self.metadata.current_snapshot_id:
@@ -1566,3 +1575,17 @@ def _add_and_move_fields(
15661575
elif len(moves) > 0:
15671576
return _move_fields(fields, moves)
15681577
return None if len(adds) == 0 else tuple(*fields, *adds)
1578+
1579+
1580+
def _generate_snapshot_id() -> int:
1581+
"""Generate a new Snapshot ID from a UUID.
1582+
1583+
Returns: An 64 bit long
1584+
"""
1585+
rnd_uuid = uuid.uuid4()
1586+
snapshot_id = int.from_bytes(
1587+
bytes(lhs ^ rhs for lhs, rhs in zip(rnd_uuid.bytes[0:8], rnd_uuid.bytes[8:16])), byteorder='little', signed=True
1588+
)
1589+
snapshot_id = snapshot_id if snapshot_id >= 0 else snapshot_id * -1
1590+
1591+
return snapshot_id

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ requests = ">=2.20.0,<3.0.0"
5252
click = ">=7.1.1,<9.0.0"
5353
rich = ">=10.11.0,<14.0.0"
5454
strictyaml = ">=1.7.0,<2.0.0" # CVE-2020-14343 was fixed in 5.4.
55-
pydantic = ">=2.0,<3.0"
55+
pydantic = ">=2.0,<3.0,!=2.4.0,!=2.4.1" # 2.4.0, 2.4.1 has a critical bug
5656
sortedcontainers = "2.4.0"
5757
fsspec = ">=2023.1.0,<2024.1.0"
5858
pyparsing = ">=3.1.0,<4.0.0"
@@ -78,8 +78,8 @@ pre-commit = "3.4.0"
7878
fastavro = "1.8.3"
7979
coverage = { version = "^7.3.1", extras = ["toml"] }
8080
requests-mock = "1.11.0"
81-
moto = "^4.2.4"
82-
typing-extensions = "4.7.1"
81+
moto = "^4.2.5"
82+
typing-extensions = "4.8.0"
8383
pytest-mock = "3.11.1"
8484
cython = "3.0.2"
8585

tests/table/test_init.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
StaticTable,
4242
Table,
4343
UpdateSchema,
44+
_generate_snapshot_id,
4445
_match_deletes_to_datafile,
4546
)
4647
from pyiceberg.table.metadata import INITIAL_SEQUENCE_NUMBER
@@ -506,3 +507,8 @@ def test_add_nested_list_type_column(table: Table) -> None:
506507
element_required=False,
507508
)
508509
assert new_schema.highest_field_id == 7
510+
511+
512+
def test_generate_snapshot_id(table: Table) -> None:
513+
assert isinstance(_generate_snapshot_id(), int)
514+
assert isinstance(table.new_snapshot_id(), int)

0 commit comments

Comments
 (0)