Skip to content

Commit

Permalink
rewrite deploy with macos
Browse files Browse the repository at this point in the history
  • Loading branch information
SunsetWolf committed Dec 19, 2024
1 parent 5222de4 commit 7e6bdc9
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 42 deletions.
78 changes: 39 additions & 39 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,45 +128,45 @@ jobs:
# make build
- name: Build 1
run: |
make build
- name: Rename 1
run: |
python -c "
from pathlib import Path
plat_info = '${{ matrix.buildplat[1] }}'.split('_', 1)[-1]
sys_ver_info = '${{ matrix.buildplat[0] }}'.split('-')[-1]
replaced = f'{sys_ver_info}_0_{plat_info}'
print(replaced)
for whl_file in Path('./dist').glob('*.whl'):
parts = whl_file.stem.split('_')
print(parts)
be_replaced = '_'.join(parts[1:])
print(be_replaced)
new_name = whl_file.name.replace(be_replaced, replaced)
print(new_name)
new_whl_file = whl_file.with_name(new_name)
print(new_whl_file)
whl_file.rename(new_whl_file)
print(f'Renamed: {whl_file} -> {new_whl_file}')
"
- name: Build 2
if: ${{ (matrix.buildplat[0] != 'macos-13' || matrix['python-version'] != '3.11') && (matrix.buildplat[0] != 'macos-13' || matrix['python-version'] != '3.12') }}
run: |
make build
- name: Rename 2
if: ${{ (matrix.buildplat[0] != 'macos-13' || matrix['python-version'] != '3.11') && (matrix.buildplat[0] != 'macos-13' || matrix['python-version'] != '3.12') }}
run: |
python -c "
from pathlib import Path
plat_info = '${{ matrix.buildplat[1] }}'.split('_', 1)[-1]
for whl_file in Path('./dist').glob('*.whl'):
parts = whl_file.stem.split('_', 3)
be_replaced = parts[-1]
new_name = whl_file.name.replace(be_replaced, plat_info)
new_whl_file = whl_file.with_name(new_name)
whl_file.rename(new_whl_file)
print(f'Renamed: {whl_file} -> {new_whl_file}')
"
python setup.py bdist_wheel
# - name: Rename 1
# run: |
# python -c "
# from pathlib import Path
# plat_info = '${{ matrix.buildplat[1] }}'.split('_', 1)[-1]
# sys_ver_info = '${{ matrix.buildplat[0] }}'.split('-')[-1]
# replaced = f'{sys_ver_info}_0_{plat_info}'
# print(replaced)
# for whl_file in Path('./dist').glob('*.whl'):
# parts = whl_file.stem.split('_')
# print(parts)
# be_replaced = '_'.join(parts[1:])
# print(be_replaced)
# new_name = whl_file.name.replace(be_replaced, replaced)
# print(new_name)
# new_whl_file = whl_file.with_name(new_name)
# print(new_whl_file)
# whl_file.rename(new_whl_file)
# print(f'Renamed: {whl_file} -> {new_whl_file}')
# "
# - name: Build 2
# if: ${{ (matrix.buildplat[0] != 'macos-13' || matrix['python-version'] != '3.11') && (matrix.buildplat[0] != 'macos-13' || matrix['python-version'] != '3.12') }}
# run: |
# make build
# - name: Rename 2
# if: ${{ (matrix.buildplat[0] != 'macos-13' || matrix['python-version'] != '3.11') && (matrix.buildplat[0] != 'macos-13' || matrix['python-version'] != '3.12') }}
# run: |
# python -c "
# from pathlib import Path
# plat_info = '${{ matrix.buildplat[1] }}'.split('_', 1)[-1]
# for whl_file in Path('./dist').glob('*.whl'):
# parts = whl_file.stem.split('_', 3)
# be_replaced = parts[-1]
# new_name = whl_file.name.replace(be_replaced, plat_info)
# new_whl_file = whl_file.with_name(new_name)
# whl_file.rename(new_whl_file)
# print(f'Renamed: {whl_file} -> {new_whl_file}')
# "
# - name: Build 3
# run: |
# make build
Expand Down
2 changes: 1 addition & 1 deletion qlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the MIT License.
from pathlib import Path

__version__ = "0.9.5.84"
__version__ = "0.9.5.83"
__version__bak = __version__ # This version is backup for QlibConfig.reset_qlib_version
import os
from typing import Union
Expand Down
37 changes: 35 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from setuptools import setup, Extension
from setuptools import find_packages, setup, Extension
import tomli
import numpy
import os

Expand All @@ -16,6 +17,21 @@ def get_version(rel_path: str) -> str:
return line.split(delim)[1]
raise RuntimeError("Unable to find version string.")

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

with open("pyproject.toml", "rb") as f:
pyproject_data = tomli.load(f)

with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()

project_config = pyproject_data.get("project", {})
name = project_config.get("name", "default-package-name")
description = project_config.get("description", "")
dependencies = project_config.get("dependencies", [])
classifiers = project_config.get("classifiers", [])
python_requires = project_config.get("requires-python", ">=3.8.0")
optional_dependencies = pyproject_data.get("project", {}).get("optional-dependencies", {})

NUMPY_INCLUDE = numpy.get_include()

Expand All @@ -24,6 +40,23 @@ def get_version(rel_path: str) -> str:

setup(
version=VERSION,
name=name,
description=description,
install_requires=dependencies,
long_description=long_description,
long_description_content_type="text/markdown",
include_package_data=True,
classifiers=classifiers,
extras_require=optional_dependencies,
python_requires=python_requires,
license="MIT Licence",
url="https://github.com/microsoft/qlib",
packages=find_packages(exclude=("tests",)),
entry_points={
"console_scripts": [
"qrun=qlib.workflow.cli:run",
],
},
ext_modules=[
Extension(
"qlib.data._libs.rolling",
Expand All @@ -37,5 +70,5 @@ def get_version(rel_path: str) -> str:
language="c++",
include_dirs=[NUMPY_INCLUDE],
),
]
],
)

0 comments on commit 7e6bdc9

Please sign in to comment.