From 4471066f11bae27e66fd5527f2e7282043b4adf6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Aug 2026 17:23:44 +0000 Subject: [PATCH 1/3] Tech refresh: migrate to scikit-build-core, upgrade GitHub Actions Co-authored-by: segevfiner <24731903+segevfiner@users.noreply.github.com> --- .github/workflows/build-and-test.yml | 32 +++++++++++++++++ .github/workflows/docs.yml | 48 +++++++++++++++++-------- .github/workflows/wheels.yml | 44 +++++++++++++---------- CMakeLists.txt | 13 ++++--- cyminhook/CMakeLists.txt | 9 ++--- pyproject.toml | 46 ++++++++++++++++++++++-- setup.py | 54 ---------------------------- 7 files changed, 150 insertions(+), 96 deletions(-) create mode 100644 .github/workflows/build-and-test.yml delete mode 100644 setup.py diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..6197fc7 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,32 @@ +name: Build & Test + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] + + steps: + - uses: actions/checkout@v7 + with: + submodules: true + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v7 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + - name: Install + run: | + pip install -e .[dev] diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 423ddab..d61f0ff 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -5,34 +5,54 @@ on: branches: - main -jobs: - docs: - runs-on: windows-2019 + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false - env: - # XXX https://github.com/scikit-build/scikit-build/issues/740 - SETUPTOOLS_ENABLE_FEATURES: legacy-editable +jobs: + build: + runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: submodules: true - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v7 with: - python-version: '3.12' + python-version: '3.14' - name: Install dependencies run: | - python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade pip - name: Install run: | pip install -e .[dev] + - name: Setup Pages + id: pages + uses: actions/configure-pages@v6 - name: Build documentation run: | make html working-directory: ./docs - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v5 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs/_build/html + path: ./docs/_build/html + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v5 diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9af9ccb..b6f18b4 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -5,7 +5,7 @@ on: branches: - main tags: - - v[0-9].* + - 'v[0-9].*' workflow_dispatch: jobs: @@ -13,56 +13,64 @@ jobs: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [windows-2019] + os: [windows-2022] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: submodules: true - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v7 with: - python-version: '3.12' + python-version: '3.14' - name: Build sdist - if: matrix.os == 'windows-2019' + if: matrix.os == 'windows-2022' run: | pip install build python -m build --sdist - name: Build wheels - uses: pypa/cibuildwheel@v2.21.3 + uses: pypa/cibuildwheel@v4.2.0 env: CIBW_SKIP: 'pp*' - CIBW_BEFORE_BUILD: | - if exist _skbuild rmdir /s /q _skbuild - # XXX https://github.com/scikit-build/scikit-build/issues/740 - CIBW_ENVIRONMENT: > - SETUPTOOLS_ENABLE_FEATURES=legacy-editable with: output-dir: dist - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v7 with: name: wheels-${{ matrix.os }} path: dist/* - upload_release: - name: Upload release + publish: + name: Publish needs: [build_wheels] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') + permissions: + contents: write + id-token: write + + environment: + name: pypi + url: https://pypi.org/project/cyminhook/ + steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v8 with: pattern: wheels-* merge-multiple: true path: dist + - name: Publish release distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist + - name: Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v3 with: - draft: true files: dist/* diff --git a/CMakeLists.txt b/CMakeLists.txt index a93d0ed..755003a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,13 @@ -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.22...4.4) -project(cyminhook) -find_package(PythonExtensions REQUIRED) -find_package(Cython REQUIRED) +project(${SKBUILD_PROJECT_NAME}) + +find_package( + Python + COMPONENTS Interpreter Development.Module + REQUIRED) +find_package(Cython MODULE REQUIRED VERSION 3.0) +include(UseCython) add_subdirectory(minhook) add_subdirectory(cyminhook) diff --git a/cyminhook/CMakeLists.txt b/cyminhook/CMakeLists.txt index fbf02f8..9ea48cb 100644 --- a/cyminhook/CMakeLists.txt +++ b/cyminhook/CMakeLists.txt @@ -1,5 +1,6 @@ -add_cython_target(_cyminhook) -add_library(_cyminhook MODULE ${_cyminhook}) -python_extension_module(_cyminhook) -target_link_libraries(_cyminhook minhook) +cython_transpile(_cyminhook.pyx LANGUAGE C + OUTPUT_VARIABLE _cyminhook_c) + +python_add_library(_cyminhook MODULE ${_cyminhook_c} WITH_SOABI) +target_link_libraries(_cyminhook PRIVATE minhook) install(TARGETS _cyminhook LIBRARY DESTINATION cyminhook) diff --git a/pyproject.toml b/pyproject.toml index 379e074..424fb19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,45 @@ [build-system] -requires = ["setuptools>=59", "scikit-build>=0.13.1", "cmake", "ninja; sys_platform != 'win32'", "cython"] -build-backend = "setuptools.build_meta" +requires = ["scikit-build-core", "cython>=3.0", "cython-cmake"] +build-backend = "scikit_build_core.build" + +[project] +name = "cyminhook" +dynamic = ["version"] +authors = [{ name = "Segev Finer", email = "segev208@gmail.com" }] +description = "Hook functions on Windows using MinHook" +keywords = ["MinHook"] +license = "MIT" +license-files = ["LICENSE"] +readme = "README.rst" +requires-python = ">=3.9" +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Win32 (MS Windows)", + "Intended Audience :: Developers", + "Topic :: Security", + "License :: OSI Approved :: MIT License", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Cython", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] + +[project.urls] +homepage = "https://github.com/segevfiner/cyminhook" +documentation = "https://segevfiner.github.io/cyminhook/" +issues = "https://github.com/segevfiner/cyminhook/issues" + +[project.optional-dependencies] +dev = [ + "sphinx==9.*; python_version >= '3.12'", +] + +[[tool.dynamic-metadata]] +provider = "scikit_build_core.metadata.regex" +field = "version" +input = "cyminhook/__init__.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index 36c580f..0000000 --- a/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -import re -from skbuild import setup -from setuptools import find_packages - - -with open("cyminhook/__init__.py", "r", encoding="utf-8") as f: - version = re.search(r'(?m)^__version__ = "([a-zA-Z0-9.-]+)"', f.read()).group(1) - -with open("README.rst", "r", encoding="utf-8") as f: - long_description = f.read() - - -setup( - name="cyminhook", - version=version, - author="Segev Finer", - author_email="segev208@gmail.com", - description="Hook functions on Windows using MinHook", - long_description=long_description, - long_description_content_type="text/x-rst", - url="https://github.com/segevfiner/cyminhook", - project_urls={ - "Documentation": "https://segevfiner.github.io/cyminhook/", - "Issue Tracker": "https://github.com/segevfiner/cyminhook/issues", - }, - license="MIT", - classifiers=[ - "Development Status :: 3 - Alpha", - "Environment :: Win32 (MS Windows)", - "Intended Audience :: Developers", - "Topic :: Security", - "License :: OSI Approved :: MIT License", - "Operating System :: Microsoft :: Windows", - "Programming Language :: Cython", - "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", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - ], - keywords="MinHook", - zip_safe=False, - packages=find_packages(), - python_requires='>=3.6', - extras_require={ - "dev": [ - "sphinx==5.*", - ], - }, -) From f61744efc3d8e35596618ba173276f052e49a0fb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Aug 2026 17:24:35 +0000 Subject: [PATCH 2/3] Merge cyminhook/CMakeLists.txt into root, add LANGUAGES C Co-authored-by: segevfiner <24731903+segevfiner@users.noreply.github.com> --- CMakeLists.txt | 10 ++++++++-- cyminhook/CMakeLists.txt | 6 ------ 2 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 cyminhook/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 755003a..4174dbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.22...4.4) -project(${SKBUILD_PROJECT_NAME}) +project(${SKBUILD_PROJECT_NAME} LANGUAGES C) find_package( Python @@ -10,4 +10,10 @@ find_package(Cython MODULE REQUIRED VERSION 3.0) include(UseCython) add_subdirectory(minhook) -add_subdirectory(cyminhook) + +cython_transpile(cyminhook/_cyminhook.pyx LANGUAGE C + OUTPUT_VARIABLE _cyminhook_c) + +python_add_library(_cyminhook MODULE ${_cyminhook_c} WITH_SOABI) +target_link_libraries(_cyminhook PRIVATE minhook) +install(TARGETS _cyminhook LIBRARY DESTINATION cyminhook) diff --git a/cyminhook/CMakeLists.txt b/cyminhook/CMakeLists.txt deleted file mode 100644 index 9ea48cb..0000000 --- a/cyminhook/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -cython_transpile(_cyminhook.pyx LANGUAGE C - OUTPUT_VARIABLE _cyminhook_c) - -python_add_library(_cyminhook MODULE ${_cyminhook_c} WITH_SOABI) -target_link_libraries(_cyminhook PRIVATE minhook) -install(TARGETS _cyminhook LIBRARY DESTINATION cyminhook) From a8991b8e4440ddfdb3b76efe8abc0eecc27a4e5e Mon Sep 17 00:00:00 2001 From: Segev Finer Date: Fri, 21 Aug 2026 21:54:09 +0300 Subject: [PATCH 3/3] Fixes --- CMakeLists.txt | 2 +- minhook | 2 +- pyproject.toml | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4174dbf..85ac771 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,4 +16,4 @@ cython_transpile(cyminhook/_cyminhook.pyx LANGUAGE C python_add_library(_cyminhook MODULE ${_cyminhook_c} WITH_SOABI) target_link_libraries(_cyminhook PRIVATE minhook) -install(TARGETS _cyminhook LIBRARY DESTINATION cyminhook) +install(TARGETS _cyminhook LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME}) diff --git a/minhook b/minhook index 0f25a24..d94c64d 160000 --- a/minhook +++ b/minhook @@ -1 +1 @@ -Subproject commit 0f25a2449b3cf878bcbdbf91b693c38149ecf029 +Subproject commit d94c64d32ea37bc4f5ee47d580709f70c6fb6080 diff --git a/pyproject.toml b/pyproject.toml index 424fb19..045b1a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,6 @@ classifiers = [ "Environment :: Win32 (MS Windows)", "Intended Audience :: Developers", "Topic :: Security", - "License :: OSI Approved :: MIT License", "Operating System :: Microsoft :: Windows", "Programming Language :: Cython", "Programming Language :: Python :: 3",