Skip to content

Commit 9ad01f1

Browse files
authored
Disallow implicit re-exports (#1908)
* No implict reexports * Clean up v2 mypy ignores
1 parent 14e2ed3 commit 9ad01f1

File tree

7 files changed

+39
-26
lines changed

7 files changed

+39
-26
lines changed

pyproject.toml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -201,48 +201,43 @@ disallow_incomplete_defs = true
201201
disallow_untyped_calls = true
202202

203203
disallow_untyped_defs = true
204+
no_implicit_reexport = true
205+
204206

205207
[[tool.mypy.overrides]]
206208
module = [
207209
"zarr.v2.*",
208-
"zarr.group",
209-
"tests.*",
210210
]
211-
check_untyped_defs = false
211+
ignore_errors = true
212212

213213
[[tool.mypy.overrides]]
214214
module = [
215-
"zarr.v2.*",
216-
"zarr.array_v2",
215+
"zarr.group",
216+
"tests.*",
217217
]
218-
disallow_any_generics = false
218+
check_untyped_defs = false
219219

220220
[[tool.mypy.overrides]]
221221
module = [
222-
"zarr.v2.*",
223-
"zarr.array_v2",
224222
"zarr.group"
225223
]
226224
disallow_incomplete_defs = false
227225

228226
[[tool.mypy.overrides]]
229227
module = [
230-
"zarr.v2.*",
231-
"zarr.array_v2",
232228
"zarr.array",
233229
"zarr.buffer"
234230
]
235231
disallow_untyped_calls = false
236232

237233
[[tool.mypy.overrides]]
238234
module = [
239-
"zarr.v2.*",
240-
"zarr.array_v2",
241235
"zarr.array",
242236
"zarr.group",
243237
]
244238
disallow_untyped_defs = false
245239

240+
246241
[tool.pytest.ini_options]
247242
minversion = "7"
248243
testpaths = ["tests"]

src/zarr/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
ZarrFormat,
3535
concurrent_map,
3636
)
37-
from zarr.config import config
37+
from zarr.config import config, parse_indexing_order
3838
from zarr.indexing import BasicIndexer
39-
from zarr.metadata import ArrayMetadata, ArrayV2Metadata, ArrayV3Metadata, parse_indexing_order
39+
from zarr.metadata import ArrayMetadata, ArrayV2Metadata, ArrayV3Metadata
4040
from zarr.store import StoreLike, StorePath, make_store_path
4141
from zarr.sync import sync
4242

src/zarr/codecs/__init__.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
from __future__ import annotations
22

3-
from zarr.codecs.blosc import BloscCname, BloscCodec, BloscShuffle # noqa: F401
4-
from zarr.codecs.bytes import BytesCodec, Endian # noqa: F401
5-
from zarr.codecs.crc32c_ import Crc32cCodec # noqa: F401
6-
from zarr.codecs.gzip import GzipCodec # noqa: F401
7-
from zarr.codecs.pipeline import BatchedCodecPipeline # noqa: F401
8-
from zarr.codecs.sharding import ShardingCodec, ShardingCodecIndexLocation # noqa: F401
9-
from zarr.codecs.transpose import TransposeCodec # noqa: F401
10-
from zarr.codecs.zstd import ZstdCodec # noqa: F401
3+
from zarr.codecs.blosc import BloscCname, BloscCodec, BloscShuffle
4+
from zarr.codecs.bytes import BytesCodec, Endian
5+
from zarr.codecs.crc32c_ import Crc32cCodec
6+
from zarr.codecs.gzip import GzipCodec
7+
from zarr.codecs.pipeline import BatchedCodecPipeline
8+
from zarr.codecs.sharding import ShardingCodec, ShardingCodecIndexLocation
9+
from zarr.codecs.transpose import TransposeCodec
10+
from zarr.codecs.zstd import ZstdCodec
11+
12+
__all__ = [
13+
"BatchedCodecPipeline",
14+
"BloscCodec",
15+
"BloscCname",
16+
"BloscShuffle",
17+
"BytesCodec",
18+
"Endian",
19+
"Crc32cCodec",
20+
"GzipCodec",
21+
"ShardingCodec",
22+
"ShardingCodecIndexLocation",
23+
"TransposeCodec",
24+
"ZstdCodec",
25+
]

src/zarr/codecs/pipeline.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
ArrayBytesCodec,
1212
ArrayBytesCodecPartialDecodeMixin,
1313
ArrayBytesCodecPartialEncodeMixin,
14-
ByteGetter,
1514
BytesBytesCodec,
16-
ByteSetter,
1715
Codec,
1816
CodecPipeline,
1917
)
18+
from zarr.abc.store import ByteGetter, ByteSetter
2019
from zarr.buffer import Buffer, NDBuffer
2120
from zarr.codecs.registry import get_codec_class
2221
from zarr.common import JSON, concurrent_map, parse_named_configuration

src/zarr/codecs/sharding.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
ArrayBytesCodec,
1515
ArrayBytesCodecPartialDecodeMixin,
1616
ArrayBytesCodecPartialEncodeMixin,
17-
ByteGetter,
18-
ByteSetter,
1917
Codec,
2018
CodecPipeline,
2119
)
20+
from zarr.abc.store import ByteGetter, ByteSetter
2221
from zarr.buffer import Buffer, NDBuffer
2322
from zarr.chunk_grids import RegularChunkGrid
2423
from zarr.codecs.bytes import BytesCodec

src/zarr/metadata.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
_bool = bool
4242

4343

44+
__all__ = ["ArrayMetadata"]
45+
46+
4447
class DataType(Enum):
4548
bool = "bool"
4649
int8 = "int8"

src/zarr/store/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
from zarr.store.remote import RemoteStore
44
from zarr.store.local import LocalStore
55
from zarr.store.memory import MemoryStore
6+
7+
__all__ = ["StorePath", "StoreLike", "make_store_path", "RemoteStore", "LocalStore", "MemoryStore"]

0 commit comments

Comments
 (0)