diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index abde6fb..cd72fbb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,7 +17,8 @@ "GitHub.copilot", "ms-vscode.cmake-tools", "ms-python.python", - "ms-azuretools.vscode-containers" + "ms-azuretools.vscode-containers", + "tamasfe.even-better-toml" ], "settings": { "clangd.arguments": [ diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 67a33b1..405d45b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,16 +1,36 @@ name: Publish on: + release: + types: [released] workflow_dispatch: jobs: + verify_version: + name: Verify tag matches pyproject version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Check tag and project version alignment + env: + TAG_REF: ${{ github.ref_name }} + run: | + echo "Git tag ref: $TAG_REF" + FILE_VERSION=$(grep '^version =' pyproject.toml | head -1 | cut -d '"' -f2) + echo "pyproject.toml version: $FILE_VERSION" + if [ "$FILE_VERSION" != "$TAG_REF" ]; then + echo "Error: tag ($TAG_REF) does not match pyproject version ($FILE_VERSION)" >&2 + exit 1 + fi + echo "Success: tag matches project version ($FILE_VERSION)" + build_wheels: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} - if: startsWith(github.ref, 'refs/tags/') strategy: matrix: os: [ubuntu-24.04, ubuntu-24.04-arm] + needs: verify_version concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ strategy.job-index }} cancel-in-progress: true @@ -20,7 +40,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.13" - name: Install cibuildwheel run: python -m pip install cibuildwheel @@ -36,13 +56,14 @@ jobs: build_sdist: name: Build source distribution runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + needs: verify_version steps: - uses: actions/checkout@v5 + - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.13" - name: Build sdist run: pipx run build --sdist @@ -56,7 +77,9 @@ jobs: name: Publish to PyPI needs: [build_wheels, build_sdist] runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + environment: + name: pypi + url: https://pypi.org/project/reelay/ permissions: id-token: write @@ -70,4 +93,5 @@ jobs: - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: + verbose: true repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 2e26a56..19c7c96 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -19,7 +19,10 @@ jobs: steps: - uses: actions/checkout@v5 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" - name: Install cibuildwheel run: python -m pip install cibuildwheel diff --git a/pyproject.toml b/pyproject.toml index f7392a7..42c2f4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,42 +1,41 @@ [project] -classifiers = [ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'Topic :: Scientific/Engineering', - 'Topic :: Scientific/Engineering :: Mathematics', - 'Topic :: Software Development :: Testing', - 'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)', - 'Programming Language :: Python :: 3', -] -keywords = ["reactive", "automata", "monitoring", "testing", "runtime"] name = "reelay" +version = "25.0.0rc2" +description = "Reelay: A runtime verification library for real-time systems" readme = "README.md" requires-python = ">=3.8" -license = { "file" = "LICENSE" } -authors = [{ "name" = "Dogan Ulus", "email" = "doganulus@gmail.com" }] -urls = { "Documentation" = "https://doganulus.github.io/reelay" } +license = { file = "LICENSE" } +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Mathematics", + "Topic :: Software Development :: Testing", + "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", + "Programming Language :: Python :: 3", +] +keywords = ["reactive", "automata", "monitoring", "testing", "runtime"] +authors = [{ name = "Dogan Ulus", email = "doganulus@gmail.com" }] +urls = { Documentation = "https://doganulus.github.io/reelay" } dependencies = [] -dynamic = ["version", "description"] [project.scripts] add = "pybind11_project.add:main" [project.optional-dependencies] -devel = [ - "pytest" -] +devel = ["pytest"] docs = [ "mkdocs", "mkdocs-material", "mkdocs-material-extensions", "mkdocs-minify-plugin", "mkdocs-redirects", - "mkdocs-git-revision-date-localized-plugin" + "mkdocs-git-revision-date-localized-plugin", ] [build-system] -requires = ["py-build-cmake~=0.1.8", "pybind11"] +requires = ["setuptools>=61", "py-build-cmake>=0.5.0", "pybind11"] build-backend = "py_build_cmake.build" [tool.py-build-cmake.module] @@ -71,11 +70,10 @@ env = {} "REELAY_BUILD_APPS:BOOL" = "OFF" "REELAY_BUILD_PYTHON_BINDINGS:BOOL" = "ON" -[tool.py-build-cmake.linux.cmake] # Linux-specific options +[tool.py-build-cmake.linux.cmake] generator = "Ninja" config = ["Release"] - -options = { "CMAKE_DEBUG_POSTFIX" = "_d" } +options = { CMAKE_DEBUG_POSTFIX = "_d" } [tool.pytest.ini_options] minversion = "7.0" @@ -85,9 +83,9 @@ cache_dir = "/tmp/reelay/.pytest_cache" [tool.cibuildwheel] container-engine = "podman" -manylinux-x86_64-image = "manylinux_2_28" -manylinux-aarch64-image = "manylinux_2_28" -skip = "cp314t-*" +manylinux-x86_64-image = "manylinux2014" +manylinux-aarch64-image = "manylinux2014" +skip = ["cp314t-*", "*-musllinux_*"] test-command = "pytest" test-requires = ["pytest"] test-sources = ["python/tests"] diff --git a/python/reelay/__init__.py b/python/reelay/__init__.py index fd05e7f..790212b 100644 --- a/python/reelay/__init__.py +++ b/python/reelay/__init__.py @@ -9,7 +9,6 @@ """ Python bindings for Reelay C++ library """ -__version__ = '25.0.0' from .dense_timed_monitor import dense_timed_monitor from .discrete_timed_monitor import discrete_timed_monitor diff --git a/src/pybind11/CMakeLists.txt b/src/pybind11/CMakeLists.txt index bfc3fa7..0b7d144 100644 --- a/src/pybind11/CMakeLists.txt +++ b/src/pybind11/CMakeLists.txt @@ -1,44 +1,31 @@ -set(PY_VERSION_SUFFIX "") -set(PY_FULL_VERSION ${PROJECT_VERSION}${PY_VERSION_SUFFIX}) +message(STATUS "Reelay version: ${PROJECT_VERSION}") +message(STATUS "Python version: ${PY_BUILD_CMAKE_PACKAGE_VERSION}") -message(STATUS "Python version: ${PY_FULL_VERSION}") - -# Make sure that the Python and CMake versions match +# Make sure that the Python and CMake versions match) if(DEFINED PY_BUILD_CMAKE_PACKAGE_VERSION) - if(NOT "${PY_BUILD_CMAKE_PACKAGE_VERSION}" MATCHES "^${PY_FULL_VERSION}$") + if(NOT "${PY_BUILD_CMAKE_PACKAGE_VERSION}" MATCHES + "^${PROJECT_VERSION}((a|b|rc)[0-9]+)?(\\.post[0-9]+)?(\\.dev[0-9]+)?$") message(FATAL_ERROR "Version number does not match " - "(${PY_BUILD_CMAKE_PACKAGE_VERSION} - ${PY_FULL_VERSION}).") + "(${PROJECT_VERSION} - ${PY_BUILD_CMAKE_PACKAGE_VERSION}).") endif() endif() -# include(cmake/QueryPythonForPybind11.cmake) -# find_pybind11_python_first() - # Find the Python development files find_package(Python3 REQUIRED COMPONENTS Development.Module) -# pybind11 is header-only, so finding a native version is fine -# find_package( -# pybind11 -# ${ARGN} -# REQUIRED -# CONFIG -# CMAKE_FIND_ROOT_PATH_BOTH) - include(FetchContent) -FetchContent_Declare( - pybind11 - GIT_REPOSITORY https://github.com/pybind/pybind11 - GIT_TAG v3.0.1 -) -FetchContent_MakeAvailable(pybind11) +fetchcontent_declare( + pybind11 + GIT_REPOSITORY https://github.com/pybind/pybind11 + GIT_TAG v3.0.1) +fetchcontent_makeavailable(pybind11) # Compile the example Python module pybind11_add_module(_pybind11_module MODULE "main.cpp") target_link_libraries(_pybind11_module PRIVATE pybind11::pybind11 reelay::reelay) target_compile_definitions( _pybind11_module PRIVATE MODULE_NAME=$ - VERSION_INFO="${PY_FULL_VERSION}") + VERSION_INFO="${PY_BUILD_CMAKE_PACKAGE_VERSION}") # Hide all symbols by default (including external libraries on Linux) set_target_properties( @@ -59,5 +46,4 @@ install( TARGETS _pybind11_module EXCLUDE_FROM_ALL COMPONENT python_modules - DESTINATION ${PY_BUILD_CMAKE_MODULE_NAME} -) + DESTINATION ${PY_BUILD_CMAKE_MODULE_NAME})