Skip to content

Commit

Permalink
v0.7.9
Browse files Browse the repository at this point in the history
- poetryで作成したsrcパッケージがコンパイルできないため、setuptoolsに戻す
  • Loading branch information
TadaoYamaoka committed Jan 15, 2024
1 parent 792f967 commit bcd06bd
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 107 deletions.
87 changes: 28 additions & 59 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,55 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
cache: "poetry"
cache-dependency-path: "pyproject.toml"
- name: Upgrade Poetry
if: ${{ matrix.python-minor-version >= 10 }}
run: |
pip install --upgrade poetry
- name: Install dependencies
- name: Install setuptools
run: |
poetry install --no-root
python -m pip install --upgrade pip
pip install setuptools wheel twine Cython
- name: Install Numpy 1.19.5
if: ${{ matrix.python-minor-version < 10 }}
run: pip install numpy==1.19.5
- name: Install Numpy 1.21.5
if: ${{ matrix.python-minor-version == 10 }}
run: pip install numpy==1.21.5
- name: Install Numpy
if: ${{ matrix.python-minor-version > 10 }}
run: pip install numpy
- name: Build 3_10
if: ${{ matrix.python-minor-version == 10 }}
run: |
poetry build -v
poetry install --only-root
run: python setup.py sdist bdist_wheel
- name: Build
if: ${{ matrix.python-minor-version != 10 }}
run: |
poetry build -v -f wheel
poetry install --only-root
run: python setup.py bdist_wheel
- name: Check
run: poetry run python -c "import cshogi"
run: python -c "import cshogi"
- name: Publish
if: github.event_name == 'release' && github.event.action == 'published'
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry run twine upload dist/*
run: twine upload dist/*
deploy-manylinux2010:
runs-on: ubuntu-20.04
env:
CC: g++
CXX: g++
strategy:
matrix:
python-version: ["cp36-cp36m", "cp37-cp37m", "cp38-cp38", "cp39-cp39"]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
- name: Install Twine
run: |
poetry install --no-root
python -m pip install --upgrade pip
pip install twine
- name: Build
run: |
poetry build -f sdist
tar zvxf ./dist/*.tar.gz -C ./dist
cp $(find ./dist -name setup.py) .
export PYTHON_BIN="/opt/python/${{ matrix.python-version }}/bin"
docker run --rm -v $(pwd):/work \
-w /work quay.io/pypa/manylinux2010_x86_64 \
Expand All @@ -90,7 +75,7 @@ jobs:
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry run twine upload dist/wheelhouse/*
run: twine upload dist/wheelhouse/*
deploy-manylinux_2_24:
runs-on: ubuntu-20.04
strategy:
Expand All @@ -99,24 +84,16 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
- name: Install Twine
run: |
poetry install --no-root
python -m pip install --upgrade pip
pip install twine
- name: Build
run: |
poetry build -f sdist
tar zvxf ./dist/*.tar.gz -C ./dist
cp $(find ./dist -name setup.py) .
export PYTHON_BIN="/opt/python/${{ matrix.python-version }}/bin"
docker run --rm -v $(pwd):/work \
-w /work quay.io/pypa/manylinux_2_24_x86_64 \
Expand All @@ -129,7 +106,7 @@ jobs:
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry run twine upload dist/wheelhouse/*
run: twine upload dist/wheelhouse/*
deploy-manylinux_2_28:
runs-on: ubuntu-20.04
strategy:
Expand All @@ -138,24 +115,16 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
cache-dependency-path: "pyproject.toml"
- name: Install dependencies
- name: Install Twine
run: |
poetry install --no-root
python -m pip install --upgrade pip
pip install twine
- name: Build
run: |
poetry build -f sdist
tar zvxf ./dist/*.tar.gz -C ./dist
cp $(find ./dist -name setup.py) .
export PYTHON_BIN="/opt/python/${{ matrix.python-version }}/bin"
docker run --rm -v $(pwd):/work \
-w /work quay.io/pypa/manylinux_2_28_x86_64 \
Expand All @@ -168,4 +137,4 @@ jobs:
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry run twine upload dist/wheelhouse/*
run: twine upload dist/wheelhouse/*
41 changes: 2 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
[build-system]
requires = ["setuptools", "cython", "numpy", "poetry_core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "cshogi"
version = "0.7.8"
license = "GPL-v3"
authors = ["Tadao Yamaoka <[email protected]>"]
maintainers = ["Tadao Yamaoka <[email protected]>"]
description = "A fast Python shogi library"
repository = "https://github.com/TadaoYamaoka/cshogi"
homepage = "https://github.com/TadaoYamaoka/cshogi"

packages = [{ include = "cshogi" }]
exclude = ["docs/*", "build/*", "test/*", "test_cpp/*", ".mypy_cache/*"]

classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: OS Independent",
]

[tool.poetry.build]
script = "build.py"
generate-setup-file = true

[tool.poetry.dependencies]
python = ">=3.6"
numpy = [
{ version = "~1.26.0", python = "^3.12" },
{ version = "*", python = ">=3.8,<3.12" },
{ version = "~1.21.6", python = "=3.7" },
{ version = "~1.19.5", python = "=3.6" },
]

[tool.poetry.group.dev.dependencies]
setuptools = "^57.4.0"
cython = "0.29.22"
twine = "*"
requires = ["setuptools>=57.4.0", "cython==0.29.22", "numpy"]
build-backend = "setuptools.build_meta"
48 changes: 39 additions & 9 deletions build.py → setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from setuptools import setup
from Cython.Build import build_ext, cythonize
from setuptools import Extension

Expand Down Expand Up @@ -81,12 +82,41 @@ def finalize_options(self):
]


def build(setup_kwargs):
setup_kwargs.update(
{
"ext_modules": cythonize(ext_modules, language_level="3"),
"cmdclass": {"build_ext": MyBuildExt},
"package_data": {"cshogi.web.templates": ["*"], "cshogi.web.static": ["*"]},
"extras_require": {"web": ["flask", "portpicker"]},
}
)
packages = [
"cshogi",
"cshogi.dlshogi",
"cshogi.gym_shogi",
"cshogi.gym_shogi.envs",
"cshogi.usi",
"cshogi.web",
]

package_data = {"": ["*"], "cshogi.web": ["static/*", "templates/*"]}

extras_require = {
':python_version == "3.6"': ["numpy>=1.19.5,<1.20.0"],
':python_version == "3.7"': ["numpy>=1.21.6,<1.22.0"],
':python_version >= "3.12" and python_version < "4.0"': ["numpy>=1.26.0,<1.27.0"],
':python_version >= "3.8" and python_version < "3.12"': ["numpy"],
"web": ["flask", "portpicker"],
}

setup_kwargs = {
"name": "cshogi",
"version": "0.7.9",
"description": "A fast Python shogi library",
"long_description": None,
"author": "Tadao Yamaoka",
"author_email": "[email protected]",
"maintainer": "Tadao Yamaoka",
"maintainer_email": "[email protected]",
"url": "https://github.com/TadaoYamaoka/cshogi",
"packages": packages,
"package_data": package_data,
"extras_require": extras_require,
"python_requires": ">=3.6",
"ext_modules": cythonize(ext_modules, language_level="3"),
"cmdclass": {"build_ext": MyBuildExt},
}

setup(**setup_kwargs)

0 comments on commit bcd06bd

Please sign in to comment.