diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..99e9007 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,31 @@ +### Running pytest + +name: BrahMap testing +on: + push: + branches: + - main +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install BrahMap + run: | + python -m pip install --upgrade pip + python -m pip install . + - name: Test BrahMap with pytest + run: | + pytest diff --git a/MANIFEST.in b/MANIFEST.in index eff8add..27bba1b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,5 @@ recursive-include extern * +recursive-include tests * +global-exclude */__pycache__/* +global-exclude *.pyc +global-exclude */.pytest_cache/* diff --git a/README.md b/README.md index 698a5ec..93ce25f 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ for a completer reference to `BrahMap` API. ```shell # Clone the repository -git clone https://github.com/anand-avinash/BrahMap.git +git clone --recursive https://github.com/anand-avinash/BrahMap.git cd BrahMap diff --git a/brahmap/src/__init__.py b/brahmap/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/brahmap/utilities/__init__.py b/brahmap/utilities/__init__.py index e81c9a6..16e64d8 100644 --- a/brahmap/utilities/__init__.py +++ b/brahmap/utilities/__init__.py @@ -19,8 +19,14 @@ ) from .process_ces import ProcessTimeSamples -from .lbsim_interface import lbs_process_timesamples +from importlib.util import find_spec + +# suggestion taken from: +if find_spec("litebird_sim") is not None: + import_str = "lbs_process_timesamples" +else: + import_str = None __all__ = [ "is_sorted", @@ -36,5 +42,5 @@ "subscan_resize", "system_setup", "ProcessTimeSamples", - "lbs_process_timesamples", + import_str, ] diff --git a/docs/index.md b/docs/index.md index c355c23..8e4eedb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -23,7 +23,7 @@ for a completer reference to `BrahMap` API. ```shell # Clone the repository -git clone https://github.com/anand-avinash/BrahMap.git +git clone --recursive https://github.com/anand-avinash/BrahMap.git cd BrahMap diff --git a/pyproject.toml b/pyproject.toml index cb506e5..e06f6eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ requires-python = ">=3.9,<3.13" dependencies = [ "numpy", "scipy", + "healpy", "krypy", "ruff", "pre-commit", @@ -32,8 +33,10 @@ Documentation = "https://anand-avinash.github.io/BrahMap/" Issues = "https://github.com/anand-avinash/BrahMap/issues" # Changelog = -[tool.setuptools] -packages = ["brahmap"] +[tool.setuptools.packages.find] +where = ["."] +include = ["brahmap*"] +namespaces = false [tool.pytest.ini_options] norecursedirs = ["extern"] diff --git a/brahmap/tests/helper_BlkDiagPrecondLO.py b/tests/helper_BlkDiagPrecondLO.py similarity index 100% rename from brahmap/tests/helper_BlkDiagPrecondLO.py rename to tests/helper_BlkDiagPrecondLO.py diff --git a/brahmap/tests/helper_SparseLO.py b/tests/helper_SparseLO.py similarity index 100% rename from brahmap/tests/helper_SparseLO.py rename to tests/helper_SparseLO.py diff --git a/brahmap/tests/helper_initweigths.py b/tests/helper_initweigths.py similarity index 100% rename from brahmap/tests/helper_initweigths.py rename to tests/helper_initweigths.py diff --git a/brahmap/tests/helper_repixelize.py b/tests/helper_repixelize.py similarity index 100% rename from brahmap/tests/helper_repixelize.py rename to tests/helper_repixelize.py diff --git a/brahmap/tests/test_BlkDiagPrecondLO_tools_cpp.py b/tests/test_BlkDiagPrecondLO_tools_cpp.py similarity index 100% rename from brahmap/tests/test_BlkDiagPrecondLO_tools_cpp.py rename to tests/test_BlkDiagPrecondLO_tools_cpp.py diff --git a/brahmap/tests/test_SparseLO_tools_cpp.py b/tests/test_SparseLO_tools_cpp.py similarity index 100% rename from brahmap/tests/test_SparseLO_tools_cpp.py rename to tests/test_SparseLO_tools_cpp.py diff --git a/brahmap/tests/test_process_samples_cpp.py b/tests/test_process_samples_cpp.py similarity index 100% rename from brahmap/tests/test_process_samples_cpp.py rename to tests/test_process_samples_cpp.py diff --git a/brahmap/tests/test_repixelize_cpp.py b/tests/test_repixelize_cpp.py similarity index 100% rename from brahmap/tests/test_repixelize_cpp.py rename to tests/test_repixelize_cpp.py