Skip to content

Commit

Permalink
Split binary into vineyard-bdist package (#1236)
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <[email protected]>
  • Loading branch information
sighingnow authored Mar 7, 2023
1 parent ca0ed9e commit fd89f72
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 27 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-test-graph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ name: Vineyard Graph CI
on:
push:
paths:
modules/graph
- modules/graph
pull_request:
branches:
- "*"
paths:
modules/graph
- modules/graph

concurrency:
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
Expand Down Expand Up @@ -227,8 +227,8 @@ jobs:
- name: Get test data
run: |
git clone https://github.com/7br/gstest.git --depth=1
git clone https://github.com/7br/gar-test.git --depth=1
git clone https://github.com/GraphScope/gstest.git --depth=1
git clone https://github.com/GraphScope/gar-test.git --depth=1
- name: Setup tmate session
if: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ jobs:
rm -rf build/lib* build/bdist.*
python3 setup.py bdist_wheel
for pkg in airflow dask io ml; do
for pkg in airflow bdist dask io ml; do
rm -rf build/lib* build/bdist.*
python3 setup_${pkg}.py bdist_wheel
done
Expand All @@ -313,7 +313,7 @@ jobs:
- name: Get test data
run: |
git clone https://github.com/7br/gstest.git --depth=1
git clone https://github.com/GraphScope/gstest.git --depth=1
- name: Setup tmate session
if: false
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/build-vineyardd-and-wheels-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
- name: Build vineyardctl
run: |
go build -a -o vineyardctl k8s/cmd/main.go
strip ./vineyardctl
strip ./vineyardctl || true
- name: Package vineyardctl artifact on Linux
run: |
Expand Down Expand Up @@ -185,8 +185,8 @@ jobs:
tar zxvf vineyardd.${{ runner.os }}-generic.${{ github.sha }}.tar.gz
tar zxvf vineyardctl.${{ runner.os }}-generic.${{ github.sha }}.tar.gz
mv vineyardd python/vineyard/vineyardd
mv vineyardctl python/vineyard/vineyardctl
mv vineyardd python/vineyard/bdist/vineyardd
mv vineyardctl python/vineyard/bdist/vineyardctl
- name: Login docker registry
run: |
Expand All @@ -208,6 +208,12 @@ jobs:
sudo docker run --rm -v `pwd`:/target ghcr.io/v6d-io/v6d/vineyard-wheel:${{ matrix.python }}.${{ github.sha }} sh -c "cp -r /work/fixed_wheels/ /target/"
ls -la ./fixed_wheels/
if [[ "${{ matrix.python }}" == "cp311-cp311" ]];
then
python3 setup_bdist.py bdist_wheel
cp dist/*.whl fixed_wheels/ || true
fi
- name: Extract tag name
id: tag
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/build-vineyardd-and-wheels-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ jobs:
tar zxvf vineyardd.${{ runner.os }}-generic.${{ github.sha }}.tar.gz
tar zxvf vineyardctl.${{ runner.os }}-generic.${{ github.sha }}.tar.gz
mv vineyardd python/vineyard/vineyardd
mv vineyardctl python/vineyard/vineyardctl
mv vineyardd python/vineyard/bdist/vineyardd
mv vineyardctl python/vineyard/bdist/vineyardctl
- name: Install python for MacOS
if: runner.os == 'macOS'
Expand Down Expand Up @@ -420,7 +420,15 @@ jobs:
-DPYTHON_EXECUTABLE=`which python`
make vineyard_client_python -j`nproc`
cd ..
rm -rf build/lib* build/bdist.*
python setup.py bdist_wheel
if [[ "${{ matrix.python }}" == "3.11" ]]; then
rm -rf build/lib* build/bdist.*
python setup_bdist.py bdist_wheel
fi
export LD_LIBRARY_PATH=`pwd`/build/lib:$LD_LIBRARY_PATH
for wheel in `ls dist/*`; do delocate-wheel -w fixed_wheels -v $wheel; done
ls -la ./fixed_wheels
Expand Down
2 changes: 2 additions & 0 deletions python/vineyard/bdist/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vineyardctl
vineyardd
17 changes: 17 additions & 0 deletions python/vineyard/bdist/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020-2023 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
10 changes: 10 additions & 0 deletions python/vineyard/deploy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ def find_vineyardd_path():
if vineyardd_path is None:
vineyardd_path = _check_executable(os.path.join(current_dir, '..', 'vineyardd'))

if vineyardd_path is None:
vineyardd_path = _check_executable(
os.path.join(current_dir, '..', 'bdist', 'vineyardd')
)

__vineyardd_path = vineyardd_path
return vineyardd_path

Expand Down Expand Up @@ -209,6 +214,11 @@ def find_vineyardctl_path():
os.path.join(current_dir, '..', 'vineyardctl')
)

if vineyardctl_path is None:
vineyardctl_path = _check_executable(
os.path.join(current_dir, '..', 'bdist', 'vineyardctl')
)

__vineyardctl_path = vineyardctl_path
return vineyardctl_path

Expand Down
13 changes: 2 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import subprocess
import sys
import textwrap
import warnings
from distutils.cmd import Command
from distutils.util import strtobool
from typing import List
Expand Down Expand Up @@ -186,14 +185,6 @@ def package_data():
'**/*.yaml.tpl',
'**/**/*.sh',
]
if os.path.exists(os.path.join(repo_root, 'python', 'vineyard', 'vineyardd')):
artifacts.append('vineyardd')
else:
warnings.warn('The artifact for `vineyardd` not found')
if os.path.exists(os.path.join(repo_root, 'python', 'vineyard', 'vineyardctl')):
artifacts.append('vineyardctl')
else:
warnings.warn('The artifact for `vineyardctl` not found')
return artifacts


Expand Down Expand Up @@ -249,12 +240,12 @@ def package_data():
'console_scripts': ['vineyard-codegen=vineyard.core.codegen:main'],
},
setup_requires=load_requirements_txt("-setup"),
install_requires=load_requirements_txt(),
install_requires=load_requirements_txt() + ['vineyard-bdist'],
extras_require={
'dev': load_requirements_txt("-dev"),
'kubernetes': load_requirements_txt("-kubernetes"),
},
platform=["POSIX", "MacOS"],
platforms=["POSIX", "MacOS"],
license="Apache License 2.0",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion setup_airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def find_airflow_packages(root):
'apache-airflow',
'vineyard',
],
platform=['POSIX', 'MacOS'],
platforms=['POSIX', 'MacOS'],
license="Apache License 2.0",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
122 changes: 122 additions & 0 deletions setup_bdist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2023 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import os
import textwrap
import warnings

from setuptools import setup
from setuptools.command.install import install
from wheel.bdist_wheel import bdist_wheel

repo_root = os.path.dirname(os.path.abspath(__file__))


class bdist_wheel_plat(bdist_wheel):
def finalize_options(self):
bdist_wheel.finalize_options(self)
self.root_is_pure = False

def get_tag(self):
self.root_is_pure = False
_, _, plat = bdist_wheel.get_tag(self)
return ('py3', 'none', plat)


class install_plat(install):
def finalize_options(self):
self.install_lib = self.install_platlib
install.finalize_options(self)


def package_data():
artifacts = []
if os.path.exists(os.path.join(repo_root, 'python', 'vineyard', 'bdist', 'vineyardd')):
artifacts.append('vineyardd')
else:
warnings.warn('The artifact for `vineyardd` not found')
if os.path.exists(os.path.join(repo_root, 'python', 'vineyard', 'bdist', 'vineyardctl')):
artifacts.append('vineyardctl')
else:
warnings.warn('The artifact for `vineyardctl` not found')
return artifacts


with open(
os.path.join(repo_root, 'README.rst'),
encoding='utf-8',
mode='r',
) as fp:
long_description = fp.read()

# Github doesn't respect "align: center", and pypi disables `.. raw`.
replacement = textwrap.dedent(
"""
.. image:: https://v6d.io/_static/vineyard_logo.png
:target: https://v6d.io
:align: center
:alt: vineyard
:width: 397px
vineyard: an in-memory immutable data manager
---------------------------------------------
"""
)
long_description = replacement + '\n'.join(long_description.split('\n')[8:])

setup(
name='vineyard-bdist',
author='The vineyard team',
author_email='[email protected]',
description='An in-memory immutable data manager',
long_description=long_description,
long_description_content_type='text/x-rst',
url='https://v6d.io',
package_dir={'vineyard.bdist': 'python/vineyard/bdist'},
packages=['vineyard.bdist'],
package_data={
'vineyard.bdist': package_data(),
},
cmdclass={'bdist_wheel': bdist_wheel_plat, 'install': install_plat},
zip_safe=False,
platforms=["POSIX", "MacOS"],
license="Apache License 2.0",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Distributed Computing",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
project_urls={
"Documentation": "https://v6d.io",
"Source": "https://github.com/v6d-io/v6d",
"Tracker": "https://github.com/v6d-io/v6d/issues",
},
)
2 changes: 1 addition & 1 deletion setup_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def find_dask_packages(root):
cmdclass={'bdist_wheel': bdist_wheel_plat, "install": install_plat},
zip_safe=False,
install_requires=['vineyard', 'dask[complete]', 'click<8.1'],
platform=['POSIX', 'MacOS'],
platforms=['POSIX', 'MacOS'],
license="Apache License 2.0",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion setup_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def resolve_vineyard_io_package_dir():
'pytest',
],
},
platform=['POSIX', 'MacOS'],
platforms=['POSIX', 'MacOS'],
license="Apache License 2.0",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion setup_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def find_ml_packages(root):
cmdclass={'bdist_wheel': bdist_wheel_plat, 'install': install_plat},
zip_safe=False,
install_requires=['vineyard'],
platform=['POSIX', 'MacOS'],
platforms=['POSIX', 'MacOS'],
license="Apache License 2.0",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion setup_ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def find_ray_packages(root):
cmdclass={'bdist_wheel': bdist_wheel_plat, "install": install_plat},
zip_safe=False,
install_requires=['vineyard', 'ray[default]'],
platform=['POSIX', 'MacOS'],
platforms=['POSIX', 'MacOS'],
license="Apache License 2.0",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down

0 comments on commit fd89f72

Please sign in to comment.