diff --git a/.github/workflows/CI_PublishTestPyPI.yml b/.github/workflows/CI_PublishTestPyPI.yml index a63db904..1fa0481f 100644 --- a/.github/workflows/CI_PublishTestPyPI.yml +++ b/.github/workflows/CI_PublishTestPyPI.yml @@ -35,6 +35,11 @@ jobs: shell: bash run: | rm -f python/.gitignore + - name: prepare build + shell: bash + run: | + cd python + python prepare_build.py - uses: pypa/cibuildwheel@v3.1.4 env: CIBW_DEPENDENCY_VERSIONS: "latest" diff --git a/.github/workflows/PublishPyPI.yml b/.github/workflows/PublishPyPI.yml index edd50dec..de374947 100644 --- a/.github/workflows/PublishPyPI.yml +++ b/.github/workflows/PublishPyPI.yml @@ -1,9 +1,10 @@ -name: Python Build & Publish (Trusted) +name: Build & Publish on: - push: - tags: ["v*"] # Example: triggers on push of v0.1.0 - workflow_dispatch: + workflow_run: + workflows: ["Create Tag & Release from Version Header"] + types: + - completed jobs: build-wheels: @@ -80,6 +81,11 @@ jobs: shell: bash run: | rm -f python/.gitignore + - name: prepare build + shell: bash + run: | + cd python + python prepare_build.py - uses: pypa/cibuildwheel@v3.1.4 env: CIBW_DEPENDENCY_VERSIONS: "latest" diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 5254f177..e8594871 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -100,12 +100,12 @@ endif() set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME sparseir) # Check if source files exist and provide helpful error message -if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp") - message(FATAL_ERROR "Source files not found. Please run: python3 prepare_build.py") -endif() +#if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../src/utils.cpp") + #message(FATAL_ERROR "Source files not found. Please run: python3 prepare_build.py") +#endif() # Explicitly list source files from copied directories -file(GLOB SPARSEIR_SOURCES "src/*.cpp") +file(GLOB SPARSEIR_SOURCES "../src/*.cpp") add_library(sparseir SHARED ${SPARSEIR_SOURCES}) if(NOT MSVC) target_compile_options(sparseir PRIVATE -Wall -Wextra -pedantic) @@ -125,7 +125,7 @@ endif() target_include_directories(sparseir PUBLIC - $ + $ $ PRIVATE $ diff --git a/python/Makefile b/python/Makefile new file mode 100644 index 00000000..00f61700 --- /dev/null +++ b/python/Makefile @@ -0,0 +1,13 @@ +.PHONY: test clean build + +test: + rm -rf src && python prepare_build.py && uv run pytest + +clean: + rm -rf src build dist *.egg-info __pycache__ .pytest_cache + +build: + rm -rf src && python prepare_build.py && uv build + +sync: + rm -rf src && python prepare_build.py && uv sync diff --git a/python/pyproject.toml b/python/pyproject.toml index 8116cdd5..3404d8c8 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ ] requires-python = ">=3.10" dependencies = [ - "numpy", + "numpy>=2.0.0", "scipy", ]