-
Notifications
You must be signed in to change notification settings - Fork 648
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
Publish to PyPI via github action #247
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6c4163f
Add build script, publish workflow
c24t 1bf9edb
Remove twine dependency in build script
c24t 564a4cd
Use py3.7 in publish action
c24t 65c0d12
Set long_description_content_type in non-ext pkgs
c24t 78e45b1
Use twine directly instead of upload action
c24t 1603e54
Shell build script set -ev
c24t b14a998
Trigger upload on release create, not publish
c24t 2a5a51e
Reblacken
c24t f387491
Merge branch 'master' into gh-actions-publish
c24t 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.7' | ||
- name: Build wheels | ||
run: ./scripts/build.sh | ||
- name: Publish to PyPI | ||
env: | ||
TWINE_USERNAME: '__token__' | ||
TWINE_PASSWORD: ${{ secrets.pypi_password }} | ||
run: | | ||
pip install twine | ||
twine upload --skip-existing --verbose dist/* |
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,24 @@ | ||
#!/bin/sh | ||
|
||
# This script builds wheels for the API, SDK, and extension packages in the | ||
# dist/ dir, to be uploaded to PyPI. | ||
|
||
set -ev | ||
|
||
# Get the latest versions of packaging tools | ||
python3 -m pip install --upgrade pip setuptools wheel | ||
|
||
BASEDIR=$(dirname $(readlink -f $(dirname $0))) | ||
|
||
( | ||
cd $BASEDIR | ||
mkdir -p dist | ||
rm -rf dist/* | ||
|
||
for d in opentelemetry-api/ opentelemetry-sdk/ ext/*/ ; do | ||
( | ||
cd "$d" | ||
python3 setup.py --verbose bdist_wheel --dist-dir "$BASEDIR/dist/" | ||
) | ||
done | ||
) |
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.
Shouldn't we use
pip wheel
instead of invokingsetup.py
directly?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.
seems like it just calls setup.py under the hood. Not sure why we'd want to abstract ourselves away a layer: https://pip.pypa.io/en/stable/reference/pip_wheel/#build-system-interface
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 couldn't find any guidance on whether
pip wheel
orsetup.py bdist_wheel
is preferred. I know thatpip install
is preferred oversetup.py install
but I guess the arguments there don't apply topip wheel
. So I think it's fine either way.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.
Looking at https://github.com/pypa/pip/blob/master/src/pip/_internal/commands/wheel.py, I think it's safe to say that pip wheel just calls setup.py is a gross oversimplification. But if we need all the extra work that pip does is a whole other question.
What would be useful is generating a source distribution first using setup.py and then generate a wheel from that using
pip wheel
. That would verify that our MANIFEST.in, etc. is working correctly.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 added #252 for building a source distribution first. I'll have to dig into the docs to develop an opinion here.
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.
One complication to note here is that
pip wheel
isolates builds from the env.setup.py bdist_wheel
builds as expected:pip wheel
fails because it tries to pip-install dependencies instead of using the current env: