diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c6ef4c..4167825 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ on: jobs: - packaging: + testing: runs-on: ubuntu-latest @@ -25,19 +25,5 @@ jobs: with: python-version: '3.11' - - name: Package - run: | - python -m pip install build - python -m build - - - name: Install wheel - run: | - python -m pip install dist/*.whl - - - name: Delete the repo - run: | - rm -rf * - - - name: Run tests shipped with the package - run: | - python -m project_euromir.tests + - name: Test using makefile + run: make test diff --git a/.gitignore b/.gitignore index 2cce527..02c51ca 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ htmlcov/ # C extensions *.so +*.dylib +*.dll # misc .DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index 30a8bbb..1167578 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 3.10.1) project(project_euromir) -set(src "project_euromir") -set(linear_algebra_src "project_euromir/linear_algebra.c") -add_library(linear_algebra SHARED ${linear_algebra_src}) \ No newline at end of file +set(SRC + project_euromir/linear_algebra.c +) +add_library(project_euromir SHARED ${SRC}) diff --git a/DISABLED_PY_PROJECT.toml b/DISABLED_PY_PROJECT.toml index ca8eb90..3933f0f 100644 --- a/DISABLED_PY_PROJECT.toml +++ b/DISABLED_PY_PROJECT.toml @@ -10,8 +10,7 @@ dependencies = ['numpy', 'scipy'] [project.optional-dependencies] docs = ["sphinx"] dev = [ - "build", "twine", "pylint", "isort", "autopep8", "docformatter", "numpy", - "scipy"] + "build", "twine", "pylint", "isort", "autopep8", "docformatter"] [build-system] requires = ["setuptools", "cmake"] diff --git a/setup.py b/DISABLED_SETUP.py similarity index 100% rename from setup.py rename to DISABLED_SETUP.py diff --git a/Makefile b/Makefile index c6444b8..e9dd62e 100644 --- a/Makefile +++ b/Makefile @@ -26,14 +26,17 @@ endif .PHONY: env clean update test lint docs fix release build -env: ## create environment - $(PYTHON) -m venv $(VENV_OPTS) $(ENVDIR) - $(BINDIR)/python -m pip install .[dev,docs] +# env: build ## create environment +# $(PYTHON) -m venv $(VENV_OPTS) $(ENVDIR) +# $(BINDIR)/python -m pip install numpy scipy build: ## build locally (instead of editable install) - cmake -S . -B $(BUILDDIR) + cmake -B$(BUILDDIR) cmake --build $(BUILDDIR) - cp $(BUILDDIR)/*.so $(PROJECT)/ + cp $(BUILDDIR)/*.so $(PROJECT)/ || true + cp $(BUILDDIR)/*.dylib $(PROJECT)/ || true + cp $(BUILDDIR)/*.dll $(PROJECT)/ || true + clean: ## clean environment -rm -rf $(DOCBUILDDIR)/* @@ -59,10 +62,10 @@ fix: ## auto-fix Python code # this is the best found for the purpose docformatter -r --in-place $(PROJECT) -release: update lint test ## update version, publish to PyPI - python -m build - twine check dist/* - # twine upload --skip-existing dist/* +# release: update lint test ## update version, publish to PyPI +# python -m build +# twine check dist/* +# twine upload --skip-existing dist/* # Thanks to Francoise at marmelab.com for this .DEFAULT_GOAL := help diff --git a/project_euromir/__init__.py b/project_euromir/__init__.py index 734eba4..725498f 100644 --- a/project_euromir/__init__.py +++ b/project_euromir/__init__.py @@ -30,18 +30,10 @@ __version__ = '0.0.1' import pathlib -import platform from ctypes import cdll -if platform.system() == 'Linux': - _ext = 'so' -elif platform.system() == 'Windows': - _ext = 'dll' -elif platform.system() == 'Darwin': - _ext = 'dylib' +for fname in pathlib.Path(__file__).parent.iterdir(): + if fname.suffix in ['.so', '.dll', '.dylib']: + LIBRARY = cdll.LoadLibrary(fname) -_libname = str(pathlib.Path(__file__).with_name('liblinear_algebra.' + _ext)) - -linear_algebra = cdll.LoadLibrary(_libname) - -assert hasattr(linear_algebra, 'csc_matvec') +assert hasattr(LIBRARY, 'csc_matvec') diff --git a/project_euromir/libproject_euromir.so b/project_euromir/libproject_euromir.so new file mode 100755 index 0000000..b39211c Binary files /dev/null and b/project_euromir/libproject_euromir.so differ