From 853457de785fbc28739cd3305bed4bdc073475ba Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 10 Feb 2024 16:32:58 +0100 Subject: [PATCH] Updated CI and package import system Refactored the CI workflows to include package installation and import testing. Ensured package is importable after installation by creating a new '__main__.py' module to check imports. This adds an extra validation step to the CI process, catching potential import issues early. Import statements in '__init__.py' have also been updated to use 'as' for clarity and namespace control. --- .github/workflows/python-package-ubuntu.yml | 8 ++++++-- .github/workflows/python-package.yml | 10 +++++++++- src/limedriver/__init__.py | 4 ++-- src/limedriver/__main__.py | 1 + 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 src/limedriver/__main__.py diff --git a/.github/workflows/python-package-ubuntu.yml b/.github/workflows/python-package-ubuntu.yml index 16a249c..180823d 100644 --- a/.github/workflows/python-package-ubuntu.yml +++ b/.github/workflows/python-package-ubuntu.yml @@ -33,6 +33,10 @@ jobs: run: | sudo apt-get install -y libhdf5-dev limesuite liblimesuite-dev automake gcc pkg-config build-essential python-is-python3 - - name: Build the package + - name: Install the package run: | - python -m build + pip install . + + - name: Test if the package can be imported + run: | + python -m limedriver \ No newline at end of file diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 8c0b5c1..c551344 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -24,6 +24,14 @@ jobs: run: | yes | pacman -S python python-pip hdf5 limesuite python-build automake gcc pkgconf base-devel + - name: Install the package + run: | + pip install . + + - name: Test if the package can be imported + run: | + python -m limedriver + - name: Build the package run: | python -m build @@ -32,4 +40,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: built-package - path: dist/ + path: dist/ \ No newline at end of file diff --git a/src/limedriver/__init__.py b/src/limedriver/__init__.py index 17485d8..94a2221 100644 --- a/src/limedriver/__init__.py +++ b/src/limedriver/__init__.py @@ -1,2 +1,2 @@ -import limedriver.binding -import limedriver.hdf_reader \ No newline at end of file +import limedriver.binding as binding +import limedriver.hdf_reader as hdf_reader \ No newline at end of file diff --git a/src/limedriver/__main__.py b/src/limedriver/__main__.py new file mode 100644 index 0000000..e6b902e --- /dev/null +++ b/src/limedriver/__main__.py @@ -0,0 +1 @@ +from limedriver import binding, hdf_reader \ No newline at end of file