-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Poetry build and release instructions #4844
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# How to release | ||
|
||
The guide to release the Python package. | ||
|
||
First we're going to release a release candidate (RC) and publish it to the public to test. Once the vote has passed on the RC, we can release the new version. | ||
|
||
## Running a release candidate | ||
|
||
Make sure that you're on the version that you want to release. | ||
|
||
```bash | ||
export RC=rc1 | ||
export VERSION=0.0.1${RC} | ||
export VERSION_WITHOUT_RC=${VERSION/rc?/} | ||
export VERSION_BRANCH=${VERSION_WITHOUT_RC//./-} | ||
|
||
git checkout -b apache-iceberg-python-${VERSION_BRANCH} | ||
|
||
git tag -s ${VERSION} -m "Apache Iceberg Python ${VERSION}" | ||
|
||
export GIT_TAG=$(git show-ref ${VERSION}) | ||
export GIT_TAG_HASH=${GIT_TAG:0:40} | ||
export LAST_COMMIT_ID=$(git rev-list ${VERSION} 2> /dev/null | head -n 1) | ||
``` | ||
|
||
The `-s` option will sign the commit. If you don't have a key yet, you can find the instructions [here](http://www.apache.org/dev/openpgp.html#key-gen-generate-key). To install gpg on a M1 based Mac, a couple of additional steps are required: https://gist.github.com/phortuin/cf24b1cca3258720c71ad42977e1ba57 | ||
|
||
Next we'll create a source distribution (`sdist`) which will generate a `.tar.gz` with all the source files. | ||
|
||
```bash | ||
# Update the version | ||
poetry version ${VERSION} | ||
|
||
git diff src/iceberg/__init__.py | ||
git add src/iceberg/__init__.py | ||
git commit -s -m "Set to version ${VERSION}" | ||
``` | ||
|
||
Now we can stage the version in pypi and upload the files to the Apache SVN. | ||
|
||
Next we're going to build the artifacts: | ||
|
||
```bash | ||
rm -rf dist/ | ||
poetry build | ||
``` | ||
|
||
This will create two artifacts: | ||
|
||
``` | ||
Building apache-iceberg (0.1.0) | ||
- Building sdist | ||
- Built apache-iceberg-0.1.0.tar.gz | ||
- Building wheel | ||
- Built apache_iceberg-0.1.0-py3-none-any.whl | ||
``` | ||
|
||
The `sdist` contains the source which can be used for checking licenses, and the wheel is a compiled version for quick installation. | ||
|
||
Next, we can upload them to pypi. Please keep in mind that this **won't** bump the version for everyone that hasn't pinned their version, since it is RC [pre-release and those are ignored](https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#pre-release-versioning). | ||
|
||
``` | ||
twine upload dist/* | ||
``` | ||
|
||
Before committing the files to the Apache SVN artifact distribution SVN, we need to generate hashes, and we need t o sign them using gpg: | ||
|
||
```bash | ||
for name in "apache_iceberg-${VERSION}-py3-none-any.whl" "apache-iceberg-${VERSION}.tar.gz" | ||
do | ||
gpg --yes --armor --local-user fokko@apache.org --output "dist/${name}.asc" --detach-sig "dist/${name}" | ||
shasum -a 512 "dist/${name}" > "dist/${name}.sha512" | ||
done | ||
``` | ||
|
||
Next, we'll clone the Apache SVN, copy and commit the files: | ||
|
||
```bash | ||
export SVN_TMP_DIR=/tmp/iceberg-${VERSION_BRANCH}/ | ||
svn checkout https://dist.apache.org/repos/dist/dev/iceberg $SVN_TMP_DIR | ||
|
||
export SVN_TMP_DIR_VERSIONED=${SVN_TMP_DIR}apache-iceberg-$VERSION/ | ||
mkdir -p $SVN_TMP_DIR_VERSIONED | ||
cp dist/* $SVN_TMP_DIR_VERSIONED | ||
svn add $SVN_TMP_DIR_VERSIONED | ||
svn ci -m "Apache Iceberg ${VERSION}" ${SVN_TMP_DIR_VERSIONED} | ||
``` | ||
|
||
Finally, we can generate the email what we'll send to the mail list: | ||
|
||
```bash | ||
cat << EOF > release-announcement-email.txt | ||
To: dev@iceberg.apache.org | ||
Subject: [VOTE] Release Apache Iceberg Python Client $VERSION | ||
Hi Everyone, | ||
|
||
I propose that we release the following RC as the official Apache Iceberg Python Client $VERSION release. | ||
|
||
The commit ID is $LAST_COMMIT_ID | ||
|
||
* This corresponds to the tag: $GIT_TAG_HASH | ||
* https://github.com/apache/iceberg/commits/apache-iceberg-python-$VERSION_BRANCH | ||
* https://github.com/apache/iceberg/tree/$GIT_TAG_HASH | ||
|
||
The release tarball, signature, and checksums are here: | ||
|
||
* https://dist.apache.org/repos/dist/dev/iceberg/apache-iceberg-python-$VERSION/ | ||
|
||
You can find the KEYS file here: | ||
|
||
* https://dist.apache.org/repos/dist/dev/iceberg/KEYS | ||
|
||
Convenience binary artifacts are staged on pypi: | ||
|
||
https://pypi.org/project/apache-iceberg/$VERSION/ | ||
|
||
And can be installed using: pip install apache-iceberg==$VERSION | ||
|
||
Please download, verify, and test. | ||
Please vote in the next 72 hours. | ||
[ ] +1 Release this as Apache Iceberg Python Client $VERSION | ||
[ ] +0 | ||
[ ] -1 Do not release this because... | ||
EOF | ||
|
||
cat release-announcement-email.txt | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a setup section that instructs you to run
pip install poetry
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also had to upgrade pip and virtualenv in Ubuntu 20.04 to get poetry working properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sudo pip install virtualenv --upgrade
andsudo python3 -m pip install --upgrade pip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I've added the commands 👍🏻 btw, some interesting combinations you have there.
sudo
shouldn't be required, andpip install
andpython3 -m pip install
are equivalent.