From 54f636d396182f4e2f2dad8c72192b5bbae3453d Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Thu, 18 Jul 2024 22:03:40 -0500 Subject: [PATCH] Improve python bindings build/install flow --- .github/workflows/python-tests.yml | 6 +++--- .gitignore | 4 ++++ bindings/python/Makefile | 9 +++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 4cfc2ca23..621c74e31 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install PyYAML + pip install build PyYAML - name: Build BLST run: | cd src @@ -60,9 +60,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install PyYAML + pip install build PyYAML - name: Build sdist - run: python setup.py sdist + run: python -m build --sdist - name: Set up Visual Studio shell if: runner.os == 'Windows' uses: egor-tensin/vs-shell@v2 diff --git a/.gitignore b/.gitignore index 8cd120d52..48587fc84 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,10 @@ analysis-report/ __pycache__ .DS_Store +# python build +*dist/ +*ckzg.egg-info/ + # nimble build dir build/ diff --git a/bindings/python/Makefile b/bindings/python/Makefile index 2e5e38537..24a5cd085 100644 --- a/bindings/python/Makefile +++ b/bindings/python/Makefile @@ -2,9 +2,10 @@ all: install test .PHONY: install -install: ../../setup.py ckzg.c - python3 ../../setup.py install --force +install: $(CURDIR)/../../setup.py $(CURDIR)/ckzg.c + python3 -m build --skip-dependency-check --outdir $(CURDIR)/dist $(CURDIR)/../../ + python3 -m pip install $(CURDIR)/dist/*.whl --force-reinstall .PHONY: test -test: tests.py - python3 $< +test: $(CURDIR)/tests.py + python3 $< \ No newline at end of file