-
Notifications
You must be signed in to change notification settings - Fork 65
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
Setup binder as a Python package and publish pre-built wheels to PyPI #303
Open
haiiliin
wants to merge
62
commits into
RosettaCommons:master
Choose a base branch
from
haiiliin:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
e11ff3e
Publish cppbinder as a Python package (#1)
haiiliin 02efc6a
Fix release workflow: move built executable
haiiliin 63f8c74
Set github token when downloading wheels
haiiliin f440855
Checkout the repository before download wheels
haiiliin bd74915
Manylinux wheels should be built with cibuildwheel
haiiliin a8620db
Use scikit-build-core and cibuildwheel to build the package (#2)
haiiliin 90b75da
Rename build.py to build-binder.py to avoid conflicts
haiiliin b1e4f0d
Create dependabot.yml
haiiliin 9c6464e
Update version getting function
haiiliin 1b9e6a0
Support both Python 2 and Python 3 (#3)
haiiliin 459ddde
Use scikit-build-core to write version to _version.py file
haiiliin fc0008a
Move the project to sub-directory python
haiiliin 58fe1eb
Update documentation
haiiliin e0c8c40
Merge remote-tracking branch 'upstream/master'
haiiliin d4bfb90
Update wheels artifacts name
haiiliin a285a52
Skip some build on pull request
haiiliin f81fa9c
Update working directory
haiiliin a685a9a
Update README and LICENSE in pyproject.toml
haiiliin cacebb1
[skip ci] Update root directory for setuptools-scm
haiiliin ed28689
Update wheels.yml
haiiliin d83a3ac
Delete
haiiliin da8a9c7
Add
haiiliin 355a879
Update wheels.yml
haiiliin 534dc4e
Build the package in the root directory
haiiliin 441c913
Delete README and LICENSE
haiiliin 22e4431
Add README and LICENSE back to symbolic links
haiiliin b26f4fc
Update __init__.py
haiiliin 70319d4
Update artifacts name
haiiliin f51a330
Update installation documentation
haiiliin 68ecb1a
Update llvm-project
haiiliin 9c348ce
Update version scheme to no-guess-dev
haiiliin 0e6a79e
Add test to check binder and llvm versions
haiiliin aa1ec55
Do not check binder version
haiiliin a4e13b1
Build wheels on all archs
haiiliin bde1fe9
Revert: install binder to CMAKE_INSTALL_BINDIR
haiiliin 9ba4039
Setup QEMU on linux when building wheels
haiiliin 1e07666
Always upload wheels to release assets
haiiliin 6ea8f96
Skip some archs
haiiliin 79a13db
Build universal2 wheels on macos
haiiliin f2741d1
Do not build aarch64, ppc64le and s390x wheels
haiiliin aaca914
Wheels can be built manually
haiiliin dbd076d
Build the default wheels
haiiliin d0d9f7b
Update version configurations
haiiliin dbf1ec8
Use cp313 to build the wheels
haiiliin 1b61466
Only build source distribution on release
haiiliin 7bfbb06
Merge branch 'RosettaCommons:master' into master
haiiliin e731726
Test wheels on different platforms and archs (#4)
haiiliin 61c1b6b
Update wheels.yml
haiiliin 0b809de
Update .gitignore
haiiliin 264c34d
Remove `__version__` in the root package
haiiliin 5bcdf7d
Revert `CMAKE_CXX_FLAGS` changes (#6)
haiiliin b7ec5b5
Update install.rst
haiiliin 42bff71
Do not include version file in source distribution
haiiliin a6c79a4
Do not generate version file
haiiliin 3da932e
Build source distribution always
haiiliin 9101aa7
Do not always upload wheels
haiiliin 9a9ac91
Update wheels.yml
haiiliin 8249e09
Do not upload wheels to release (#8)
haiiliin 2b65ece
Clone the LLVM project on building phase (#7)
haiiliin c326299
[skip ci] Set `impl` for windows and macos wheels
haiiliin e207c5e
Delete .github/dependabot.yml
haiiliin 332c486
Remove pybind11 build dependency
haiiliin 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,140 @@ | ||
name: Wheels | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- ".github/workflows/wheels.yml" | ||
- "python/**" | ||
- "source/**" | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- ".github/workflows/wheels.yml" | ||
- "python/**" | ||
- "source/**" | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: wheels-${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-wheels: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-22.04 | ||
archs: | ||
- "x86_64" | ||
- "i686" | ||
impl: | ||
- "manylinux" | ||
- "musllinux" | ||
include: | ||
- os: windows-2022 | ||
archs: "AMD64" | ||
impl: win | ||
- os: windows-2022 | ||
archs: "x86" | ||
impl: win | ||
- os: macos-13 | ||
archs: "universal2" | ||
impl: macosx | ||
fail-fast: false | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup QEMU for Linux cross-compilation | ||
if: runner.os == 'Linux' | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: all | ||
|
||
- name: Clone LLVM project | ||
shell: bash | ||
run: | | ||
git clone -b release/6.x https://github.com/llvm/llvm-project.git | ||
working-directory: python | ||
|
||
- name: Setup LLVM project | ||
shell: bash | ||
run: | | ||
echo 'add_subdirectory(binder)' > python/llvm-project/clang-tools-extra/CMakeLists.txt | ||
cp -r source python/llvm-project/clang-tools-extra/binder | ||
|
||
- name: Setup cibuildwheel and build wheels | ||
run: | | ||
pipx install cibuildwheel | ||
pipx run cibuildwheel python | ||
env: | ||
CIBW_BUILD: cp313-${{ matrix.impl }}* | ||
CIBW_ARCHS: ${{ matrix.archs }} | ||
|
||
- name: Upload wheels to artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cppbinder-wheels-${{ matrix.os }}-${{ matrix.archs }}-${{ matrix.impl }}-${{ github.event_name == 'release' && github.ref_name || github.sha }} | ||
path: ./wheelhouse/*.whl | ||
|
||
build-sdist: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Clone LLVM project | ||
shell: bash | ||
run: | | ||
git clone -b release/6.x https://github.com/llvm/llvm-project.git | ||
working-directory: python | ||
|
||
- name: Setup LLVM project | ||
shell: bash | ||
run: | | ||
echo 'add_subdirectory(binder)' > python/llvm-project/clang-tools-extra/CMakeLists.txt | ||
cp -r source python/llvm-project/clang-tools-extra/binder | ||
|
||
- name: Setup build and build source distribution | ||
run: | | ||
pipx install build | ||
pipx run build --sdist --outdir dist | ||
working-directory: python | ||
|
||
- name: Upload source distribution to artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cppbinder-sdist-${{ github.event_name == 'release' && github.ref_name || github.sha }} | ||
path: ./python/dist/*.tar.gz | ||
|
||
publish: | ||
needs: [build-wheels, build-sdist] | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download wheels and source distribution | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: cppbinder-* | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: Publish package to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages-dir: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# IDE config files | ||
.vs/ | ||
.vscode/ | ||
.VSCodeCounter/ | ||
.idea/ | ||
|
||
# CMake build/debug directory | ||
cmake-build-*/ | ||
|
||
# Binder build files | ||
binder/_version.py | ||
binder/bin |
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,4 @@ | ||
cmake_minimum_required(VERSION 3.4.3) | ||
project(binder LANGUAGES CXX C) | ||
|
||
add_subdirectory(llvm-project/llvm) |
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 @@ | ||
../LICENSE |
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 @@ | ||
../README.md |
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,8 @@ | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
|
||
def binder(): | ||
BINDER_BIN_DIR = os.path.join(os.path.dirname(__file__), "bin") | ||
raise SystemExit(subprocess.call([os.path.join(BINDER_BIN_DIR, "binder"), *sys.argv[1:]], close_fds=False)) |
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,4 @@ | ||
from binder import binder | ||
|
||
if __name__ == "__main__": | ||
binder() |
Oops, something went wrong.
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.
Have you checked how well this works when deployment system is different (ie lib stdc++ is different) from the the one you build wheels one? For my projects this was significant issue so i end up just rebuilding Binder on target system.