Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Guard against python-casacore imports #73

Merged
merged 2 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
History
=======

0.2.1 (2023-10--24)
X.Y.Z (YYYY-MM-DD)
------------------
* Guard against python-casacore imports (:pr:`73`)

0.2.1 (2023-10-24)
------------------
* Table Query Language Support (:pr:`71`)
* Set skip-existing=true when uploading distributables to TestPyPI (:pr:`68`)
Expand Down
16 changes: 16 additions & 0 deletions src/arcae/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
# Needed to load in the arrow c++ shared libraries
import pyarrow as pa # noqa
import os
import sys
from typing import TYPE_CHECKING

__version__ = "0.2.1"

if TYPE_CHECKING:
from arcae.lib.arrow_tables import Table

PYTHON_CASACORE_FOUND = "casacore" in sys.modules
COEXIST_WITH_PYTHON_CASACORE = int(os.environ.get("ARCAE_WITH_CASACORE", 0)) != 0

if PYTHON_CASACORE_FOUND and not COEXIST_WITH_PYTHON_CASACORE:
raise RuntimeError(
"python-casacore has already been imported and "
"this may lead to extension module symbol conflicts "
"and segfaults."
"See https://github.com/ratt-ru/arcae/issues/72 "
"for further information. "
"Set ARCAE_WITH_CASACORE=1 if you wish to "
"continue regardless.")


def table(filename: str) -> "Table":
# Defer cython module import, to avoid conflicts between arcae casacore libraries
# and python-casacore casacore libraries
Expand Down