Skip to content

Commit

Permalink
update python to 311, 312 (#233)
Browse files Browse the repository at this point in the history
* update python to 311, 312

* update github actions

* deprecate Python 3.6 3.7

* update cibuildwheels

* fix setup.py

* update

* fix upload-artifact

* update boost version

* use c++14

* add BOOST_NO_CXX98_FUNCTION_BASE

* use download-artifact@v2

* use download-artifact@v3

* remove i686

* update badge

* fix readme
  • Loading branch information
kotarotanahashi authored Nov 9, 2024
1 parent 176df2c commit 058cbe9
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 58 deletions.
50 changes: 19 additions & 31 deletions .github/workflows/build_and_upolad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: ${{env.Python_Version}}
- name: Build sdist
run: |
pip install -r requirements.txt
python setup.py sdist
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: artifact
path: dist/*.tar.gz
Expand All @@ -33,8 +33,8 @@ jobs:
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: ${{env.Python_Version}}
Expand All @@ -52,8 +52,8 @@ jobs:
doctest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: ${{env.Python_Version}}
Expand All @@ -80,30 +80,18 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
arch: [x86_64, AMD64, i686, arm64]
python: [36, 37, 38, 39, 310, 311]
arch: [x86_64, AMD64, arm64]
python: [38, 39, 310, 311, 312, 313]

exclude:
- os: ubuntu-latest
arch: AMD64
- os: ubuntu-latest
arch: arm64

- os: macos-latest
arch: AMD64
- os: macos-latest
arch: i686
- os: macos-latest
arch: arm64
python: 36
- os: macos-latest
arch: arm64
python: 37

arch: AMD64
- os: windows-latest
arch: x86_64
- os: windows-latest
arch: i686
- os: windows-latest
arch: arm64

Expand Down Expand Up @@ -131,14 +119,14 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: ${{env.Python_Version}}

- name: Build wheels on ${{ matrix.CIBW_PLATFORM }} ${{matrix.arch}}
uses: pypa/cibuildwheel@v2.11.3
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_PLATFORM: ${{ matrix.CIBW_PLATFORM }}
CIBW_BUILD: cp${{matrix.python}}-*
Expand All @@ -155,9 +143,9 @@ jobs:
CIBW_REPAIR_WHEEL_COMMAND: ${{matrix.CIBW_REPAIR_WHEEL_COMMAND}}
CIBW_BUILD_VERBOSITY: 3

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: artifact
name: artifact-${{ github.sha }}
path: ./wheelhouse/*.whl
retention-days: 1

Expand All @@ -166,9 +154,9 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: artifact
name: artifact-${{ github.sha }}
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand All @@ -179,9 +167,9 @@ jobs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: artifact
name: artifact-${{ github.sha }}
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ else()
pybind11_add_module(cpp_pyqubo src/main.cpp)
endif()

add_compile_definitions(BOOST_NO_CXX98_FUNCTION_BASE)

target_compile_definitions(cpp_pyqubo PRIVATE VERSION_INFO=${PYQUBO_VERSION_INFO})
target_compile_features(cpp_pyqubo PRIVATE cxx_std_17)

target_compile_options(cpp_pyqubo PRIVATE
$<$<CXX_COMPILER_ID:GNU>: -Ofast -Wall -Wno-terminate>
$<$<CXX_COMPILER_ID:AppleClang>: -Ofast -Wno-exceptions>
Expand Down
14 changes: 4 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
.. image:: https://readthedocs.org/projects/pyqubo/badge/?version=latest
:target: http://pyqubo.readthedocs.io/en/latest/?badge=latest

.. image:: https://pepy.tech/badge/pyqubo
:target: https://pepy.tech/project/pyqubo
.. image:: https://static.pepy.tech/badge/pyqubo
:target: https://www.pepy.tech/projects/pyqubo

.. image:: https://github.com/recruit-communications/pyqubo/actions/workflows/build_and_upolad.yaml/badge.svg
:target: https://github.com/recruit-communications/pyqubo/actions/workflows/build_and_upolad.yaml
Expand Down Expand Up @@ -114,7 +114,7 @@ or
Supported Python Versions
-------------------------

Python 3.6, 3.7, 3.8, 3.9 and 3.10 are supported.
Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 are supported.

Supported Operating Systems
---------------------------
Expand All @@ -133,7 +133,7 @@ Run all tests.
.. code-block:: shell
export USE_TEST=1
python -m unittest discover test
python -m unittest discover tests
Show coverage report.

Expand All @@ -143,12 +143,6 @@ Show coverage report.
coverage run -m unittest discover
coverage html
Run test with circleci CLI.

.. code-block:: shell
circleci build --job $JOBNAME
Run doctest.

.. code-block:: shell
Expand Down
2 changes: 1 addition & 1 deletion external/boost_assert.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
boost_assert
GIT_REPOSITORY https://github.com/boostorg/assert
GIT_TAG boost-1.76.0
GIT_TAG boost-1.82.0
)

FetchContent_GetProperties(boost_assert)
Expand Down
2 changes: 1 addition & 1 deletion external/pybind11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(FetchContent)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.10.1
GIT_TAG v2.13.6
)

FetchContent_MakeAvailable(pybind11)
25 changes: 10 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
# The name must be the _single_ output extension from the CMake build.
# If you need multiple extensions, see scikit-build.
class CMakeExtension(Extension):
def __init__(self, name, sourcedir=""):
Extension.__init__(self, name, sources=[])
self.sourcedir = os.path.abspath(sourcedir)
def __init__(self, name: str, sourcedir: str = "") -> None:
super().__init__(name, sources=[])
self.sourcedir = os.fspath(Path(sourcedir).resolve())


class CMakeBuild(build_ext):
def build_extension(self, ext: CMakeExtension) -> None:
# Must be in this form due to bug in .resolve() only fixed in Python 3.10+
ext_fullpath = Path.cwd() / self.get_ext_fullpath(ext.name) # type: ignore[no-untyped-call]
ext_fullpath = Path.cwd() / self.get_ext_fullpath(ext.name)
extdir = ext_fullpath.parent.resolve()

# Using this requires trailing slash for auto-detection & inclusion of
Expand Down Expand Up @@ -56,7 +56,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
cmake_args += [item for item in os.environ["CMAKE_ARGS"].split(" ") if item]

# In this example, we pass in the version to C++. You might not need to.
cmake_args += [f"-DEXAMPLE_VERSION_INFO={self.distribution.get_version()}"] # type: ignore[attr-defined]
cmake_args += [f"-DEXAMPLE_VERSION_INFO={self.distribution.get_version()}"]

if self.compiler.compiler_type != "msvc":
# Using Ninja-build since it a) is available as a wheel and b)
Expand All @@ -66,7 +66,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
# 3.15+.
if not cmake_generator or cmake_generator == "Ninja":
try:
import ninja # noqa: F401
import ninja

ninja_executable_path = Path(ninja.BIN_DIR) / "ninja"
cmake_args += [
Expand All @@ -77,7 +77,6 @@ def build_extension(self, ext: CMakeExtension) -> None:
pass

else:

# Single config generators are handled "normally"
single_config = any(x in cmake_generator for x in {"NMake", "Ninja"})

Expand Down Expand Up @@ -117,10 +116,10 @@ def build_extension(self, ext: CMakeExtension) -> None:
build_temp.mkdir(parents=True)

subprocess.run(
["cmake", ext.sourcedir] + cmake_args, cwd=build_temp, check=True
["cmake", ext.sourcedir, *cmake_args], cwd=build_temp, check=True
)
subprocess.run(
["cmake", "--build", "."] + build_args, cwd=build_temp, check=True
["cmake", "--build", ".", *build_args], cwd=build_temp, check=True
)


Expand Down Expand Up @@ -157,7 +156,7 @@ def __getattribute__(self, name):
'codecov>=2.1.9'
]

python_requires = '>=3.6, <3.12'
python_requires = '>=3.8, <3.14'

setup(
name=package_info.__package_name__,
Expand All @@ -182,11 +181,7 @@ def __getattribute__(self, name):
tests_require=tests_require,
include_package_data=True,
classifiers=[
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python',
'License :: OSI Approved :: Apache Software License',
]
)

0 comments on commit 058cbe9

Please sign in to comment.