Skip to content

Commit

Permalink
isort: tiledbsoma before tiledb (#2381)
Browse files Browse the repository at this point in the history
(hopefully temporary) workaround for #2293
  • Loading branch information
ryan-williams authored Apr 4, 2024
1 parent 29294e1 commit b1677be
Show file tree
Hide file tree
Showing 35 changed files with 58 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.291
rev: v0.3.5
hooks:
- id: ruff
args: ["--config=apis/python/pyproject.toml"]
Expand Down
1 change: 1 addition & 0 deletions apis/python/devtools/desc-array-fragments
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import argparse

import pandas as pd

import tiledb


Expand Down
2 changes: 1 addition & 1 deletion apis/python/devtools/ingestor
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import os
import sys
from typing import Optional

import tiledb
from somacore import options

import tiledbsoma
Expand All @@ -26,6 +25,7 @@ import tiledbsoma._util
import tiledbsoma.io
import tiledbsoma.logging
from tiledbsoma.options import SOMATileDBContext
import tiledb


# ================================================================
Expand Down
3 changes: 1 addition & 2 deletions apis/python/devtools/outgestor
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import logging
import os
import sys

import tiledb

import tiledbsoma
import tiledbsoma._util
import tiledbsoma.io
import tiledb

logger = logging.getLogger("tiledbsoma")

Expand Down
2 changes: 1 addition & 1 deletion apis/python/devtools/peek-exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import numpy
import pandas
import scipy # noqa: F401
import tiledb # noqa: F401

import tiledbsoma
import tiledbsoma.io
import tiledb # noqa: F401

# module aliases
ad = anndata
Expand Down
10 changes: 8 additions & 2 deletions apis/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@ extend-select = ["I001"]
fix = true
exclude = ["*.cc"]

[tool.ruff.isort]
known-first-party = ["tiledbsoma"]
[tool.ruff.lint.isort]
# HACK: tiledb needs to come after tiledbsoma: https://github.com/single-cell-data/TileDB-SOMA/issues/2293
section-order = ["future", "standard-library", "third-party", "tiledbsoma", "tiledb", "first-party", "local-folder"]
no-lines-before = ["tiledb"]

[tool.ruff.lint.isort.sections]
"tiledbsoma" = ["tiledbsoma"]
"tiledb" = ["tiledb"]
1 change: 1 addition & 0 deletions apis/python/src/tiledbsoma/_arrow_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import numpy.typing as npt
import pandas as pd
import pyarrow as pa

import tiledb

_ARROW_TO_TDB_ATTR: Dict[Any, Union[str, TypeError]] = {
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
import attrs
import somacore
import somacore.collection
import tiledb
from somacore import options
from typing_extensions import Self

import tiledb

from . import _funcs, _tdb_handles
from ._common_nd_array import NDArray
from ._dataframe import DataFrame
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/_common_nd_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
import numpy as np
import pyarrow as pa
import somacore
import tiledb
from somacore import options
from typing_extensions import Self

import tiledb

from . import _arrow_types, _util
from ._tiledb_array import TileDBArray
from ._types import OpenTimestamp
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
import pandas as pd
import pyarrow as pa
import somacore
import tiledb
from somacore import options
from typing_extensions import Self

import tiledb

from . import _arrow_types, _util
from . import pytiledbsoma as clib
from ._constants import SOMA_JOINID
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/_sparse_nd_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
import pyarrow as pa
import pyarrow.compute as pacomp
import somacore
import tiledb
from somacore import options
from somacore.options import PlatformConfig
from typing_extensions import Self

import tiledb

from . import _util

# This package's pybind11 code
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/_tdb_handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
import attrs
import numpy as np
import pyarrow as pa
import tiledb
from numpy.typing import DTypeLike
from somacore import options
from typing_extensions import Literal, Self

import tiledb

from . import pytiledbsoma as clib
from ._exception import DoesNotExistError, SOMAError, is_does_not_exist_error
from ._types import METADATA_TYPES, Metadatum, OpenTimestamp
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/_tiledb_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union

import pyarrow as pa
import tiledb
from somacore import options
from typing_extensions import Self

import tiledb

from . import _tdb_handles, _util

# This package's pybind11 code
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/_tiledb_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from typing import Any, Generic, MutableMapping, Optional, Type, TypeVar, Union

import somacore
import tiledb
from somacore import options
from typing_extensions import Self

import tiledb

from . import _constants, _tdb_handles
from ._exception import SOMAError
from ._types import OpenTimestamp
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/io/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
from unittest import mock

import anndata as ad
import tiledb
from anndata._core import file_backing

import tiledb

from .._types import Path


Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/io/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
import pandas as pd
import pyarrow as pa
import scipy.sparse as sp
import tiledb
from anndata._core.sparse_dataset import SparseDataset
from somacore.options import PlatformConfig
from typing_extensions import get_args

import tiledb

from .. import (
Collection,
DataFrame,
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/options/_soma_tiledb_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
from concurrent.futures import ThreadPoolExecutor
from typing import Any, Dict, Literal, Mapping, Optional, Union

import tiledb
from somacore import ContextBase
from typing_extensions import Self

import tiledb

from .. import pytiledbsoma as clib
from .._types import OpenTimestamp
from .._util import ms_to_datetime, to_timestamp_ms
Expand Down
3 changes: 2 additions & 1 deletion apis/python/src/tiledbsoma/options/_tiledb_create_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

import attrs as attrs_ # We use the name `attrs` later.
import attrs.validators as vld # Short name because we use this a bunch.
import tiledb
from somacore import options
from typing_extensions import Self

import tiledb

# Most defaults are configured directly as default attribute values
# within TileDBCreateOptions.
DEFAULT_TILE_EXTENT = 2048
Expand Down
2 changes: 1 addition & 1 deletion apis/python/tests/test_basic_anndata_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import pytest
import scipy
import somacore
import tiledb

import tiledbsoma
import tiledbsoma.io
from tiledbsoma import Experiment, _constants, _factory
from tiledbsoma._tiledb_object import TileDBObject
from tiledbsoma._util import verify_obs_var
import tiledb

from ._util import TESTDATA

Expand Down
3 changes: 2 additions & 1 deletion apis/python/tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
from typing_extensions import Literal

import tiledbsoma as soma
from tests._util import raises_no_typeguard
from tiledbsoma import _collection, _factory, _tiledb_object
from tiledbsoma._exception import DoesNotExistError
from tiledbsoma.options import SOMATileDBContext

from tests._util import raises_no_typeguard


# ----------------------------------------------------------------
def create_and_populate_dataframe(path: str) -> soma.DataFrame:
Expand Down
2 changes: 1 addition & 1 deletion apis/python/tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from unittest import mock

import pytest
import tiledb

import tiledbsoma.options._soma_tiledb_context as stc
import tiledb


@pytest.fixture(autouse=True)
Expand Down
3 changes: 2 additions & 1 deletion apis/python/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
import pyarrow as pa
import pytest
import somacore
import tiledb
from pandas.api.types import union_categoricals

import tiledbsoma as soma
import tiledb

from tests._util import raises_no_typeguard


Expand Down
2 changes: 1 addition & 1 deletion apis/python/tests/test_dataframe_index_columns.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
import pyarrow as pa
import pytest
import tiledb

import tiledbsoma as soma
import tiledb


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion apis/python/tests/test_dense_nd_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import numpy as np
import pyarrow as pa
import pytest
import tiledb

import tiledbsoma as soma
from tiledbsoma.options import SOMATileDBContext
import tiledb

from . import NDARRAY_ARROW_TYPES_NOT_SUPPORTED, NDARRAY_ARROW_TYPES_SUPPORTED
from ._util import raises_no_typeguard
Expand Down
5 changes: 3 additions & 2 deletions apis/python/tests/test_experiment_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
import pandas as pd
import pyarrow as pa
import pytest
import tiledb
from pyarrow import ArrowInvalid
from scipy import sparse
from somacore import AxisQuery, options

import tiledbsoma as soma
from tests._util import raises_no_typeguard
from tiledbsoma import SOMATileDBContext, _factory
from tiledbsoma._collection import CollectionBase
from tiledbsoma.experiment_query import X_as_series
import tiledb

from tests._util import raises_no_typeguard

# Number of features for the embeddings layer
N_FEATURES = 50
Expand Down
2 changes: 1 addition & 1 deletion apis/python/tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import numpy as np
import pytest
import tiledb

import tiledbsoma as soma
from tiledbsoma import _constants
import tiledb

UNKNOWN_ENCODING_VERSION = "3141596"

Expand Down
3 changes: 2 additions & 1 deletion apis/python/tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
from typeguard import suppress_type_checks

import tiledbsoma as soma
from tests._util import raises_no_typeguard
from tiledbsoma import _factory

from tests._util import raises_no_typeguard

""""
Metadata handling tests for all SOMA foundational datatypes.
"""
Expand Down
1 change: 1 addition & 0 deletions apis/python/tests/test_notebook_sparse_dense.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import tiledbsoma
import tiledbsoma.io

from tests._util import PY_ROOT


Expand Down
2 changes: 1 addition & 1 deletion apis/python/tests/test_platform_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import tempfile

import pytest
import tiledb

import tiledbsoma
import tiledbsoma.io
import tiledbsoma.options._tiledb_create_options as tco
from tiledbsoma._util import verify_obs_var
import tiledb


@pytest.mark.skip(reason="No longer return ArraySchema - see note in test")
Expand Down
2 changes: 1 addition & 1 deletion apis/python/tests/test_query_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import os

import pytest
import tiledb

import tiledbsoma.pytiledbsoma as clib
from tiledbsoma._arrow_types import tiledb_schema_to_arrow
from tiledbsoma._exception import SOMAError
from tiledbsoma._query_condition import QueryCondition
import tiledb

VERBOSE = False

Expand Down
2 changes: 1 addition & 1 deletion apis/python/tests/test_sparse_nd_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import pyarrow as pa
import pytest
import scipy.sparse as sparse
import tiledb

import tiledbsoma as soma
from tiledbsoma import _factory
from tiledbsoma.options import SOMATileDBContext
import tiledb

from . import NDARRAY_ARROW_TYPES_NOT_SUPPORTED, NDARRAY_ARROW_TYPES_SUPPORTED
from ._util import raises_no_typeguard
Expand Down
Loading

0 comments on commit b1677be

Please sign in to comment.