From e231201cfc9638c38dbf50b02973b764070e4521 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Wed, 6 Dec 2023 10:45:00 -0500 Subject: [PATCH] Revert "Add Windows support for the Python API (#1811)" (#1959) This reverts commit ff491abf1f00238ea775c6076a8a12e94f005fd0. --- .github/workflows/python-ci-full.yml | 5 +- .github/workflows/python-ci-minimal.yml | 15 ++--- .github/workflows/python-ci-single.yml | 15 +++-- .gitignore | 1 - apis/python/setup.py | 32 ++++----- apis/python/src/tiledbsoma/_dataframe.py | 7 +- .../src/tiledbsoma/_general_utilities.py | 6 +- apis/python/src/tiledbsoma/_read_iters.py | 10 +-- apis/python/src/tiledbsoma/_tiledb_array.py | 4 +- apis/python/src/tiledbsoma/io/ingest.py | 2 +- apis/python/tests/test_factory.py | 5 -- apis/python/tests/test_metadata.py | 22 +++---- .../cmake/Modules/FindSpdlog_EP.cmake | 2 +- .../cmake/Modules/FindTileDB_EP.cmake | 2 +- libtiledbsoma/cmake/Superbuild.cmake | 6 +- libtiledbsoma/src/CMakeLists.txt | 8 +-- libtiledbsoma/src/soma/column_buffer.h | 2 +- libtiledbsoma/src/soma/logger_public.h | 19 ++---- libtiledbsoma/src/soma/soma_array.cc | 5 +- libtiledbsoma/src/soma/soma_dataframe.cc | 2 +- libtiledbsoma/src/soma/soma_dense_ndarray.cc | 2 +- libtiledbsoma/src/soma/soma_group.cc | 5 +- libtiledbsoma/src/soma/soma_sparse_ndarray.cc | 2 +- libtiledbsoma/src/tiledbsoma/tiledbsoma | 11 +++- libtiledbsoma/src/utils/arrow_adapter.cc | 2 +- libtiledbsoma/src/utils/common.h | 2 +- libtiledbsoma/test/CMakeLists.txt | 16 +---- scripts/bld.ps1 | 65 ------------------- 28 files changed, 81 insertions(+), 194 deletions(-) delete mode 100644 scripts/bld.ps1 diff --git a/.github/workflows/python-ci-full.yml b/.github/workflows/python-ci-full.yml index 63ab5eda7e..0c70175f07 100644 --- a/.github/workflows/python-ci-full.yml +++ b/.github/workflows/python-ci-full.yml @@ -20,7 +20,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-22.04, macos-12, windows-2019] + # TODO: restore Windows build once we have C++/libtiledbsoma integration supported there + os: [ubuntu-22.04, macos-12] + # os: [ubuntu-22.04, macos-12, windows-2019] python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] include: - runs-on: ubuntu-22.04 @@ -35,6 +37,7 @@ jobs: python_version: ${{ matrix.python-version }} cc: ${{ matrix.cc }} cxx: ${{ matrix.cxx }} + is_mac: ${{ contains(matrix.os, 'macos') }} report_codecov: ${{ matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9' }} run_lint: ${{ matrix.os == 'ubuntu-22.04' && matrix.python-version == '3.9' }} secrets: inherit diff --git a/.github/workflows/python-ci-minimal.yml b/.github/workflows/python-ci-minimal.yml index 55f02278c4..04b0b9890e 100644 --- a/.github/workflows/python-ci-minimal.yml +++ b/.github/workflows/python-ci-minimal.yml @@ -8,14 +8,10 @@ name: TileDB-SOMA Python CI (Minimal) # To test the full matrix on a working branch, invoke ./python-ci-full.yml from # https://github.com/single-cell-data/TileDB-SOMA/actions/workflows/python-ci-full.yml on: - pull_request: - branches: - - main - - 'release-*' + push: paths-ignore: - 'apis/r/**' - workflow_dispatch: - + jobs: build: strategy: @@ -24,20 +20,19 @@ jobs: os: [ubuntu-22.04, macos-12] python-version: ['3.10', '3.7'] include: - - os: ubuntu-22.04 + - runs-on: ubuntu-22.04 cc: gcc-11 cxx: g++-11 - - os: macos-12 + - runs-on: macos-12 cc: clang cxx: clang++ - - os: windows-2019 - python-version: '3.10' uses: ./.github/workflows/python-ci-single.yml with: os: ${{ matrix.os }} python_version: ${{ matrix.python-version }} cc: ${{ matrix.cc }} cxx: ${{ matrix.cxx }} + is_mac: ${{ contains(matrix.os, 'macos') }} report_codecov: ${{ matrix.python-version == '3.10' }} run_lint: ${{ matrix.python-version == '3.10' }} secrets: inherit diff --git a/.github/workflows/python-ci-single.yml b/.github/workflows/python-ci-single.yml index af7e3a9e22..e612fdf5bc 100644 --- a/.github/workflows/python-ci-single.yml +++ b/.github/workflows/python-ci-single.yml @@ -14,14 +14,18 @@ on: required: true type: string cc: - required: false + required: true type: string cxx: - required: false + required: true type: string report_codecov: required: true type: boolean + is_mac: + required: false + type: boolean + default: false run_lint: required: false type: boolean @@ -29,7 +33,7 @@ on: jobs: lint: - if: inputs.run_lint + if: ${{ inputs.run_lint }} runs-on: ${{ inputs.os }} steps: - name: Checkout TileDB-SOMA @@ -52,7 +56,6 @@ jobs: run: python -m pip -v install pre-commit && pre-commit run -a -v - name: Check C++ Format - shell: bash run: ./scripts/run-clang-format.sh . clang-format 0 $(find libtiledbsoma -name "*.cc" -or -name "*.h") build: @@ -69,7 +72,7 @@ jobs: if: ${{ inputs.os == 'macos-12' }} run: sysctl -a | grep cpu - name: Select XCode version - if: startsWith(inputs.os, 'macos') + if: inputs.is_mac uses: maxim-lobanov/setup-xcode@v1 with: # Pending https://github.com/actions/runner-images/issues/6350 @@ -123,14 +126,12 @@ jobs: run: ctest --output-on-failure --test-dir build/libtiledbsoma -C Release --verbose - name: Run pytests for C++ - shell: bash # Setting PYTHONPATH ensures the tests load the in-tree source code unde apis/python/src # instead of copy we `pip install`ed to site-packages above. That's needed for the code # coverage analysis to work. run: PYTHONPATH=$(pwd)/apis/python/src python -m pytest --cov=apis/python/src --cov-report=xml libtiledbsoma/test -v --durations=20 - name: Run pytests for Python - shell: bash # Setting PYTHONPATH ensures the tests load the in-tree source code unde apis/python/src # instead of copy we `pip install`ed to site-packages above. That's needed for the code # coverage analysis to work. diff --git a/.gitignore b/.gitignore index 84cd269753..19499fafd8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .vscode* -.vs *.swp dist/* **/venv diff --git a/apis/python/setup.py b/apis/python/setup.py index a7aedccfad..6413e608ee 100644 --- a/apis/python/setup.py +++ b/apis/python/setup.py @@ -61,9 +61,13 @@ if libtiledbsoma_dir is None: scripts_dir = this_dir / "dist_links" / "scripts" - scripts_dir = scripts_dir.resolve() - libtiledbsoma_dir = scripts_dir.parent / "dist" + if scripts_dir.is_symlink(): + # in git source tree + libtiledbsoma_dir = this_dir.parent.parent / "dist" + else: + # in extracted sdist, with libtiledbsoma copied into dist_links/ + libtiledbsoma_dir = this_dir / "dist_links" / "dist" else: libtiledbsoma_dir = pathlib.Path(libtiledbsoma_dir) @@ -147,10 +151,7 @@ def find_or_build_package_data(setuptools_cmd): # cause that cache to fall out of sync. # # See `.github/workflows/python-ci-single.yml` for configuration. - if os.name == "nt": - subprocess.run(["pwsh.exe", "./bld.ps1"], cwd=scripts_dir, check=True) - else: - subprocess.run(["./bld"], cwd=scripts_dir, check=True) + subprocess.run(["./bld"], cwd=scripts_dir) lib_dir = libtiledbsoma_exists() assert lib_dir, "error when building libtiledbsoma from source" @@ -197,13 +198,10 @@ def run(self): str(libtiledbsoma_dir / "lib"), str(tiledb_dir / "lib"), ] - -CXX_FLAGS = [] - -if os.name != "nt": - CXX_FLAGS.append(f'-Wl,-rpath,{str(libtiledbsoma_dir / "lib")}') - CXX_FLAGS.append(f'-Wl,-rpath,{str(tiledb_dir / "lib")}') - +CXX_FLAGS = [ + f'-Wl,-rpath,{str(libtiledbsoma_dir / "lib")}', + f'-Wl,-rpath,{str(tiledb_dir / "lib")}', +] if sys.platform == "darwin": CXX_FLAGS.append("-mmacosx-version-min=10.14") @@ -227,7 +225,7 @@ def run(self): setuptools.setup( name="tiledbsoma", description="Python API for efficient storage and retrieval of single-cell data using TileDB", - long_description=open("README.md", encoding="utf-8").read(), + long_description=open("README.md").read(), long_description_content_type="text/markdown", author="TileDB, Inc.", author_email="help@tiledb.io", @@ -244,7 +242,6 @@ def run(self): "Operating System :: Unix", "Operating System :: POSIX :: Linux", "Operating System :: MacOS :: MacOS X", - "Operating System :: Microsoft :: Windows", "Programming Language :: Python", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", @@ -261,10 +258,9 @@ def run(self): ["src/tiledbsoma/pytiledbsoma.cc"], include_dirs=INC_DIRS, library_dirs=LIB_DIRS, - libraries=["tiledbsoma"] + (["tiledb"] if os.name == "nt" else []), + libraries=["tiledbsoma"], extra_link_args=CXX_FLAGS, - extra_compile_args=["-std=c++17" if os.name != "nt" else "/std:c++17"] - + CXX_FLAGS, + extra_compile_args=["-std=c++17"] + CXX_FLAGS, language="c++", ) ], diff --git a/apis/python/src/tiledbsoma/_dataframe.py b/apis/python/src/tiledbsoma/_dataframe.py index d99d59de82..127edf2794 100644 --- a/apis/python/src/tiledbsoma/_dataframe.py +++ b/apis/python/src/tiledbsoma/_dataframe.py @@ -691,11 +691,8 @@ def _canonicalize_schema( raise ValueError("DataFrame requires one or more index columns") if SOMA_JOINID in schema.names: - joinid_type = schema.field(SOMA_JOINID).type - if joinid_type != pa.int64(): - raise ValueError( - f"{SOMA_JOINID} field must be of type Arrow int64 but is {joinid_type}" - ) + if schema.field(SOMA_JOINID).type != pa.int64(): + raise ValueError(f"{SOMA_JOINID} field must be of type Arrow int64") else: # add SOMA_JOINID schema = schema.append(pa.field(SOMA_JOINID, pa.int64())) diff --git a/apis/python/src/tiledbsoma/_general_utilities.py b/apis/python/src/tiledbsoma/_general_utilities.py index 5ed168acab..5a61cb32fe 100644 --- a/apis/python/src/tiledbsoma/_general_utilities.py +++ b/apis/python/src/tiledbsoma/_general_utilities.py @@ -6,7 +6,7 @@ """General utility functions. """ -import platform +import os import sys import tiledb @@ -64,5 +64,5 @@ def show_package_versions() -> None: ) print("libtiledbsoma version() ", libtiledbsoma_version()) print("python version ", ".".join(str(v) for v in sys.version_info)) - u = platform.uname() - print("OS version ", u.system, u.release) + u = os.uname() + print("OS version ", u.sysname, u.release) diff --git a/apis/python/src/tiledbsoma/_read_iters.py b/apis/python/src/tiledbsoma/_read_iters.py index 52b785e76e..999a96fc67 100644 --- a/apis/python/src/tiledbsoma/_read_iters.py +++ b/apis/python/src/tiledbsoma/_read_iters.py @@ -478,14 +478,10 @@ def _coords_strider( elif isinstance(coords, int): coords = np.array([coords], dtype=np.int64) elif isinstance(coords, Sequence): - coords = np.array(coords, dtype=np.int64) + coords = np.array(coords).astype(np.int64) elif isinstance(coords, (pa.Array, pa.ChunkedArray)): - coords = coords.to_numpy().astype(np.int64, copy=False) - elif isinstance(coords, np.ndarray): - coords = coords.astype(np.int64) - elif isinstance(coords, slice): - pass - else: + coords = coords.to_numpy() + elif not isinstance(coords, (np.ndarray, slice)): raise TypeError("Unsupported slice coordinate type") if isinstance(coords, slice): diff --git a/apis/python/src/tiledbsoma/_tiledb_array.py b/apis/python/src/tiledbsoma/_tiledb_array.py index 15c589b05a..80ba8147b4 100644 --- a/apis/python/src/tiledbsoma/_tiledb_array.py +++ b/apis/python/src/tiledbsoma/_tiledb_array.py @@ -21,9 +21,7 @@ def _load_libs() -> None: """Loads the required TileDB-SOMA native library.""" - if os.name == "nt": - lib_name = "tiledbsoma.dll" - elif sys.platform == "darwin": + if sys.platform == "darwin": lib_name = "libtiledbsoma.dylib" else: lib_name = "libtiledbsoma.so" diff --git a/apis/python/src/tiledbsoma/io/ingest.py b/apis/python/src/tiledbsoma/io/ingest.py index 46df9faa8c..f1256f6170 100644 --- a/apis/python/src/tiledbsoma/io/ingest.py +++ b/apis/python/src/tiledbsoma/io/ingest.py @@ -1163,7 +1163,7 @@ def _write_dataframe( else: df.rename(columns={"index": id_column_name}, inplace=True) - df[SOMA_JOINID] = np.asarray(axis_mapping.data, dtype=np.int64) + df[SOMA_JOINID] = np.asarray(axis_mapping.data) df.set_index(SOMA_JOINID, inplace=True) diff --git a/apis/python/tests/test_factory.py b/apis/python/tests/test_factory.py index 1b9395d6ef..56704c4276 100644 --- a/apis/python/tests/test_factory.py +++ b/apis/python/tests/test_factory.py @@ -1,4 +1,3 @@ -from time import sleep from typing import Type import numpy as np @@ -73,8 +72,6 @@ def tiledb_object_uri(tmp_path, object_type, metadata_typename, encoding_version ) def test_open(tiledb_object_uri, expected_soma_type: Type): """Happy path tests""" - # TODO: Fix Windows test failures without the following. - sleep(0.01) soma_obj = soma.open(tiledb_object_uri) assert isinstance(soma_obj, expected_soma_type) typed_soma_obj = soma.open(tiledb_object_uri, soma_type=expected_soma_type) @@ -135,8 +132,6 @@ def test_open_wrong_type(tiledb_object_uri, wrong_type): ) def test_factory_unsupported_version(tiledb_object_uri): """All of these should raise, as they are encoding formats from the future""" - # TODO: Fix Windows test failures without the following. - sleep(0.01) with pytest.raises(ValueError): soma.open(tiledb_object_uri) diff --git a/apis/python/tests/test_metadata.py b/apis/python/tests/test_metadata.py index a627af499b..bbdc45832a 100644 --- a/apis/python/tests/test_metadata.py +++ b/apis/python/tests/test_metadata.py @@ -56,7 +56,6 @@ def test_metadata(soma_object): # Verify the metadata is empty to start. "Empty" defined as no keys # other than soma_ keys. uri = soma_object.uri - timestamp = soma_object.tiledb_timestamp_ms with soma_object: assert non_soma_metadata(soma_object) == {} non_soma_keys = [k for k in soma_object.metadata if not k.startswith("soma_")] @@ -71,7 +70,7 @@ def test_metadata(soma_object): with pytest.raises(soma.SOMAError): soma_object.metadata["x"] = "y" - with _factory.open(uri, "r", tiledb_timestamp=timestamp) as read_obj: + with _factory.open(uri, "r") as read_obj: assert non_soma_metadata(read_obj) == {"foobar": True} assert "foobar" in read_obj.metadata # Double-check the various getter methods @@ -83,7 +82,7 @@ def test_metadata(soma_object): with pytest.raises(soma.SOMAError): read_obj.metadata["x"] = "y" - with _factory.open(uri, "w", tiledb_timestamp=timestamp + 1) as second_write: + with _factory.open(uri, "w") as second_write: second_write.metadata.update(stay="frosty", my="friends") assert non_soma_metadata(second_write) == { "foobar": True, @@ -91,7 +90,7 @@ def test_metadata(soma_object): "my": "friends", } - with _factory.open(uri, "w", tiledb_timestamp=timestamp + 2) as third_write: + with _factory.open(uri, "w") as third_write: del third_write.metadata["stay"] third_write.metadata["my"] = "enemies" assert non_soma_metadata(third_write) == {"foobar": True, "my": "enemies"} @@ -125,49 +124,46 @@ def test_add_delete_metadata(soma_object): def test_delete_add_metadata(soma_object): uri = soma_object.uri - timestamp = soma_object.tiledb_timestamp_ms with soma_object: soma_object.metadata["hdyfn"] = "destruction" assert non_soma_metadata(soma_object) == {"hdyfn": "destruction"} - with _factory.open(uri, "w", tiledb_timestamp=timestamp + 1) as second_write: + with _factory.open(uri, "w") as second_write: assert non_soma_metadata(second_write) == {"hdyfn": "destruction"} del second_write.metadata["hdyfn"] assert non_soma_metadata(second_write) == {} second_write.metadata["hdyfn"] = "somebody new" assert non_soma_metadata(second_write) == {"hdyfn": "somebody new"} - with _factory.open(uri, "r", tiledb_timestamp=timestamp + 1) as reader: + with _factory.open(uri, "r") as reader: assert non_soma_metadata(reader) == {"hdyfn": "somebody new"} def test_set_set_metadata(soma_object): uri = soma_object.uri - timestamp = soma_object.tiledb_timestamp_ms with soma_object: soma_object.metadata["content"] = "content" - with _factory.open(uri, "w", tiledb_timestamp=timestamp + 1) as second_write: + with _factory.open(uri, "w") as second_write: second_write.metadata["content"] = "confidence" second_write.metadata["content"] = "doubt" - with _factory.open(uri, "r", tiledb_timestamp=timestamp + 1) as reader: + with _factory.open(uri, "r") as reader: assert non_soma_metadata(reader) == {"content": "doubt"} def test_set_delete_metadata(soma_object): uri = soma_object.uri - timestamp = soma_object.tiledb_timestamp_ms with soma_object: soma_object.metadata["possession"] = "obsession" - with _factory.open(uri, "w", tiledb_timestamp=timestamp + 1) as second_write: + with _factory.open(uri, "w") as second_write: second_write.metadata["possession"] = "funny thing about opinions" del second_write.metadata["possession"] - with _factory.open(uri, "r", tiledb_timestamp=timestamp + 1) as reader: + with _factory.open(uri, "r") as reader: assert non_soma_metadata(reader) == {} diff --git a/libtiledbsoma/cmake/Modules/FindSpdlog_EP.cmake b/libtiledbsoma/cmake/Modules/FindSpdlog_EP.cmake index 7ed802b2c4..fc14828f3d 100644 --- a/libtiledbsoma/cmake/Modules/FindSpdlog_EP.cmake +++ b/libtiledbsoma/cmake/Modules/FindSpdlog_EP.cmake @@ -87,7 +87,7 @@ if (NOT SPDLOG_FOUND) -DCMAKE_PREFIX_PATH=${EP_INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_BUILD_TYPE=$ + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} diff --git a/libtiledbsoma/cmake/Modules/FindTileDB_EP.cmake b/libtiledbsoma/cmake/Modules/FindTileDB_EP.cmake index 85076405d5..846ecd74ff 100644 --- a/libtiledbsoma/cmake/Modules/FindTileDB_EP.cmake +++ b/libtiledbsoma/cmake/Modules/FindTileDB_EP.cmake @@ -127,7 +127,7 @@ else() -DTILEDB_WERROR=${TILEDB_WERROR} -DTILEDB_VERBOSE=${TILEDB_VERBOSE} -DTILEDB_TESTS=OFF - -DCMAKE_BUILD_TYPE=$ + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} diff --git a/libtiledbsoma/cmake/Superbuild.cmake b/libtiledbsoma/cmake/Superbuild.cmake index 9760f012e6..7e9f53cdbc 100644 --- a/libtiledbsoma/cmake/Superbuild.cmake +++ b/libtiledbsoma/cmake/Superbuild.cmake @@ -48,7 +48,7 @@ set(EXTERNAL_PROJECTS) set(INHERITED_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DCMAKE_BUILD_TYPE=$ + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} @@ -118,13 +118,13 @@ ExternalProject_Add(libtiledbsoma # make install-libtiledbsoma add_custom_target(install-libtiledbsoma - COMMAND ${CMAKE_COMMAND} --build . --target install --config $ + COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libtiledbsoma ) # make check add_custom_target(check - COMMAND ${CMAKE_COMMAND} --build . --target check --config $ + COMMAND ${CMAKE_COMMAND} --build . --target check --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libtiledbsoma ) diff --git a/libtiledbsoma/src/CMakeLists.txt b/libtiledbsoma/src/CMakeLists.txt index 8ad30b6d1a..3521070473 100644 --- a/libtiledbsoma/src/CMakeLists.txt +++ b/libtiledbsoma/src/CMakeLists.txt @@ -234,7 +234,7 @@ set(TILEDB_SOMA_EXPORT_HEADER "${TILEDB_SOMA_EXPORT_HEADER}" PARENT_SCOPE) # Set related compiler settings target_compile_definitions(TILEDB_SOMA_OBJECTS PRIVATE -DTILEDB_SOMA_OBJECTS_EXPORTS) -target_include_directories(TILEDB_SOMA_OBJECTS PRIVATE ${TILEDB_SOMA_EXPORT_HEADER_DIR}) +target_include_directories(TILEDB_SOMA_OBJECTS PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) # Add the generated header to the public headers list list(APPEND TILEDB_SOMA_PUBLIC_HEADERS @@ -267,6 +267,7 @@ if(TILEDBSOMA_BUILD_CLI) # CLI11::CLI11 # spdlog::spdlog + tiledbsoma TileDB::tiledb_shared ) @@ -334,11 +335,6 @@ if(NOT WIN32 AND NOT TILEDBSOMA_BUILD_STATIC) ) endif() -install( - FILES $ - DESTINATION ${CMAKE_INSTALL_BINDIR} -) - if(TILEDBSOMA_BUILD_CLI) set_target_properties(tiledbsoma-cli PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) endif() diff --git a/libtiledbsoma/src/soma/column_buffer.h b/libtiledbsoma/src/soma/column_buffer.h index 4a727f5c37..418cac89c0 100644 --- a/libtiledbsoma/src/soma/column_buffer.h +++ b/libtiledbsoma/src/soma/column_buffer.h @@ -298,7 +298,7 @@ class ColumnBuffer { std::string s(enums_[i]); enum_str_ += s; enum_offsets_[i] = cumlen; - cumlen += static_cast(s.length()); + cumlen += s.length(); } enum_offsets_[n_vec] = cumlen; } diff --git a/libtiledbsoma/src/soma/logger_public.h b/libtiledbsoma/src/soma/logger_public.h index ad7281fba8..b2745a4d96 100644 --- a/libtiledbsoma/src/soma/logger_public.h +++ b/libtiledbsoma/src/soma/logger_public.h @@ -36,21 +36,12 @@ #ifndef TILEDB_LOGGER_PUBLIC_H #define TILEDB_LOGGER_PUBLIC_H -#ifndef TILEDBSOMA_EXPORT -// TILEDBSOMA_EXPORT is defined by the auto-generated tiledbsoma_export.h -// which is included from the top-level tiledbsoma header. We don't include -// it here to simplify the include paths (and avoid copying all headers to -// a single directory like TileDB does). In case the symbol is not defined, -// define it here as empty. -#define TILEDBSOMA_EXPORT -#endif - #include // for windows: error C2039: 'runtime_error': is not a member of 'std' namespace tiledbsoma { /** Set log level for global logger and optionally set a logfile. */ -TILEDBSOMA_EXPORT void LOG_CONFIG( +__attribute__((visibility("default"))) void LOG_CONFIG( const std::string& level, const std::string& logfile = ""); /** Set log level for global logger. */ @@ -63,16 +54,16 @@ void LOG_SET_FILE(const std::string& logfile); bool LOG_DEBUG_ENABLED(); /** Logs a trace message. */ -TILEDBSOMA_EXPORT void LOG_TRACE(const std::string& msg); +__attribute__((visibility("default"))) void LOG_TRACE(const std::string& msg); /** Logs a debug message. */ -TILEDBSOMA_EXPORT void LOG_DEBUG(const std::string& msg); +__attribute__((visibility("default"))) void LOG_DEBUG(const std::string& msg); /** Logs an info message. */ -TILEDBSOMA_EXPORT void LOG_INFO(const std::string& msg); +__attribute__((visibility("default"))) void LOG_INFO(const std::string& msg); /** Logs a warning. */ -TILEDBSOMA_EXPORT void LOG_WARN(const std::string& msg); +__attribute__((visibility("default"))) void LOG_WARN(const std::string& msg); /** Logs an error. */ void LOG_ERROR(const std::string& msg); diff --git a/libtiledbsoma/src/soma/soma_array.cc b/libtiledbsoma/src/soma/soma_array.cc index e3e8005b6a..d1be5164f2 100644 --- a/libtiledbsoma/src/soma/soma_array.cc +++ b/libtiledbsoma/src/soma/soma_array.cc @@ -49,10 +49,7 @@ void SOMAArray::create( Array::create(std::string(uri), schema); auto array = Array(*ctx, std::string(uri), TILEDB_WRITE); array.put_metadata( - "soma_object_type", - TILEDB_STRING_UTF8, - static_cast(soma_type.length()), - soma_type.c_str()); + "soma_object_type", TILEDB_STRING_UTF8, 1, soma_type.c_str()); array.close(); } diff --git a/libtiledbsoma/src/soma/soma_dataframe.cc b/libtiledbsoma/src/soma/soma_dataframe.cc index 00edd05b1a..d2fba02f6f 100644 --- a/libtiledbsoma/src/soma/soma_dataframe.cc +++ b/libtiledbsoma/src/soma/soma_dataframe.cc @@ -95,7 +95,7 @@ SOMADataFrame::SOMADataFrame( std::vector column_names, ResultOrder result_order, std::optional> timestamp) { - std::string array_name = std::filesystem::path(uri).filename().string(); + std::string array_name = std::filesystem::path(uri).filename(); array_ = std::make_shared( mode, uri, diff --git a/libtiledbsoma/src/soma/soma_dense_ndarray.cc b/libtiledbsoma/src/soma/soma_dense_ndarray.cc index 5f66ba8abb..4a11e3f368 100644 --- a/libtiledbsoma/src/soma/soma_dense_ndarray.cc +++ b/libtiledbsoma/src/soma/soma_dense_ndarray.cc @@ -96,7 +96,7 @@ SOMADenseNDArray::SOMADenseNDArray( std::vector column_names, ResultOrder result_order, std::optional> timestamp) { - std::string array_name = std::filesystem::path(uri).filename().string(); + std::string array_name = std::filesystem::path(uri).filename(); array_ = std::make_shared( mode, uri, diff --git a/libtiledbsoma/src/soma/soma_group.cc b/libtiledbsoma/src/soma/soma_group.cc index 36d4f15aaf..19e35dad71 100644 --- a/libtiledbsoma/src/soma/soma_group.cc +++ b/libtiledbsoma/src/soma/soma_group.cc @@ -46,10 +46,7 @@ void SOMAGroup::create( Group::create(*ctx, std::string(uri)); auto group = Group(*ctx, std::string(uri), TILEDB_WRITE); group.put_metadata( - "soma_object_type", - TILEDB_STRING_UTF8, - static_cast(soma_type.length()), - soma_type.c_str()); + "soma_object_type", TILEDB_STRING_UTF8, 1, soma_type.c_str()); group.close(); } diff --git a/libtiledbsoma/src/soma/soma_sparse_ndarray.cc b/libtiledbsoma/src/soma/soma_sparse_ndarray.cc index 29f4b16afe..6e923205cf 100644 --- a/libtiledbsoma/src/soma/soma_sparse_ndarray.cc +++ b/libtiledbsoma/src/soma/soma_sparse_ndarray.cc @@ -96,7 +96,7 @@ SOMASparseNDArray::SOMASparseNDArray( std::vector column_names, ResultOrder result_order, std::optional> timestamp) { - std::string array_name = std::filesystem::path(uri).filename().string(); + std::string array_name = std::filesystem::path(uri).filename(); array_ = std::make_shared( mode, uri, diff --git a/libtiledbsoma/src/tiledbsoma/tiledbsoma b/libtiledbsoma/src/tiledbsoma/tiledbsoma index 9c473686e3..7378155da8 100644 --- a/libtiledbsoma/src/tiledbsoma/tiledbsoma +++ b/libtiledbsoma/src/tiledbsoma/tiledbsoma @@ -33,9 +33,14 @@ #ifndef __TILEDBSOMA__ #define __TILEDBSOMA__ -// Auto-generated file by CMake, used to define the TILEDBSOMA_EXPORT macro -// that allows exporting symbols in a cross-platform fashion. -#include "tiledbsoma_export.h" +// TODO Uncomment after finishing Python and R bindings +// #include "soma_collection.h" +// #include "soma_dataframe.h" +// #include "soma_dense_ndarray.h" +// #include "soma_experiment.h" +// #include "soma_measurement.h" +// #include "soma_object.h" +// #include "soma_sparse_ndarray.h" #include "utils/arrow_adapter.h" #include "utils/common.h" diff --git a/libtiledbsoma/src/utils/arrow_adapter.cc b/libtiledbsoma/src/utils/arrow_adapter.cc index 93058428b8..68836ad3e1 100644 --- a/libtiledbsoma/src/utils/arrow_adapter.cc +++ b/libtiledbsoma/src/utils/arrow_adapter.cc @@ -286,7 +286,7 @@ ArrowAdapter::to_arrow(std::shared_ptr column) { // future refactor as ColumnBuffer::get_enumeration_info returns // std::optional where std::nullopt indicates the column does not // contain enumerated values. - if (enmr->type() == TILEDB_STRING_ASCII || + if (enmr->type() == TILEDB_STRING_ASCII or enmr->type() == TILEDB_STRING_UTF8) { auto dict_vec = enmr->as_vector(); column->convert_enumeration(); diff --git a/libtiledbsoma/src/utils/common.h b/libtiledbsoma/src/utils/common.h index 8ddc3b1bc5..802f985a2f 100644 --- a/libtiledbsoma/src/utils/common.h +++ b/libtiledbsoma/src/utils/common.h @@ -34,8 +34,8 @@ #define TILEDBSOMA_COMMON_H #include // for windows: error C2039: 'runtime_error': is not a member of 'std' + #include -#include namespace tiledbsoma { diff --git a/libtiledbsoma/test/CMakeLists.txt b/libtiledbsoma/test/CMakeLists.txt index e6698c28ef..d503041765 100644 --- a/libtiledbsoma/test/CMakeLists.txt +++ b/libtiledbsoma/test/CMakeLists.txt @@ -44,16 +44,13 @@ target_include_directories(unit_soma ${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_SOURCE_DIR}/../src/external/include ${pybind11_INCLUDE_DIRS} - ${TILEDB_SOMA_EXPORT_HEADER_DIR} $ ) target_compile_definitions(unit_soma PRIVATE CATCH_CONFIG_MAIN) -if (NOT MSVC) - # Allow deprecated function for writing to an array with a timestamp - target_compile_options(unit_soma PRIVATE -Wno-deprecated-declarations) -endif() +# Allow deprecated function for writing to an array with a timestamp +target_compile_options(unit_soma PRIVATE -Wno-deprecated-declarations) if (NOT APPLE AND NOT WIN32) target_link_libraries(unit_soma PRIVATE pthread) @@ -65,13 +62,6 @@ add_test( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) -if (WIN32) - add_custom_command(TARGET unit_soma POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $ - COMMAND_EXPAND_LISTS - ) -endif() - add_custom_target(build_tests) add_dependencies(build_tests unit_soma @@ -83,7 +73,7 @@ add_dependencies(build_tests # Add custom target 'check' in the root of the tree add_custom_target( - check COMMAND ${CMAKE_CTEST_COMMAND} -V -C $ + check COMMAND ${CMAKE_CTEST_COMMAND} -V -C ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../ DEPENDS build_tests diff --git a/scripts/bld.ps1 b/scripts/bld.ps1 deleted file mode 100644 index d856306eb2..0000000000 --- a/scripts/bld.ps1 +++ /dev/null @@ -1,65 +0,0 @@ -# A script to build and install the C++ library. - -<# -.SYNOPSIS -This is a Powershell script to build libtiledbsoma on Windows. - -.DESCRIPTION -This script will check dependencies, and run the CMake build generator -to generate a Visual Studio solution file for libtiledbsoma, and builds -it and installs it. - -.PARAMETER Prefix -Installs files in tree rooted at PREFIX (defaults to dist). - -.PARAMETER Configuration -Configuration to build libtiledbsoma (defaults to Release). - -.PARAMETER TileDBLocation -Location of TileDB installation (defaults to downloading it from GitHub Releases). - -.LINK -https://github.com/single-cell-data/TileDB-SOMA - -.EXAMPLE -bld.ps1 -Prefix "\path\to\install" -Configuration Release - -#> - -[CmdletBinding()] -Param( - [string]$Configuration = 'Release', - [string]$Prefix = '', - [string]$TileDBLocation = '', - [Alias('J')] - [int] - $BuildProcesses = $env:NUMBER_OF_PROCESSORS -) - -$ErrorActionPreference = 'Stop' - -$ExtraOpts = '' - -if ($Configuration -eq 'Debug' -and $TileDBLocation -ne '') { - $ExtraOpts += ' --debug' -} - -if ($Prefix -ne '') { - $ExtraOpts += " -DCMAKE_INSTALL_PREFIX=$Prefix -DOVERRIDE_INSTALL_PREFIX=OFF" -} - -if ($TileDBLocation -ne '') { - $ExtraOpts += " -DTileDB_DIR=$TileDBLocation -DFORCE_BUILD_TILEDB=OFF" -} - -Write-Host "Building $Configuration build" - -$BuildDir = (Get-Item -Path $PSScriptRoot).Parent.FullName + '\build' -$SourceDir = (Get-Item -Path $PSScriptRoot).Parent.FullName + '\libtiledbsoma' - -Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $BuildDir - -cmake -B $BuildDir -S $SourceDir -DCMAKE_BUILD_TYPE=$Configuration $ExtraOpts -cmake --build $BuildDir --config $Configuration -j $BuildProcesses -cmake --build $BuildDir --config $Configuration --target install-libtiledbsoma -cmake --build $BuildDir/libtiledbsoma --config $Configuration --target build_tests -j $BuildProcesses