Skip to content
Open
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
12 changes: 5 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ keywords = [
"offline augmentation",
"mri",
]
# smauglab has no __init__.py anywhere, so it is a PEP 420 namespace package.
# poetry-core still walks the tree correctly; the CI build job and
# unit_tests/test_packaging.py assert the wheel really contains every module.
# smauglab is a regular package: every directory has an __init__.py. It used to be a
# PEP 420 namespace package, which was dropped because the augmentation registry needs
# a deterministic import-time population point, and because a namespace package lets a
# stray smauglab/ elsewhere on sys.path silently merge into this one.
# The CI build job and unit_tests/test_packaging.py assert the wheel contains every module.
packages = [{ include = "smauglab" }]
# The config JSONs are package data, not code, so they need listing explicitly.
# A wheel without them is broken: smauglab resolves its default config through
Expand Down Expand Up @@ -258,10 +260,6 @@ python_version = "3.10"
# incrementally rather than in one pass.
ignore_missing_imports = true
warn_redundant_casts = true
# smauglab/, smauglab/transforms/ and smauglab/utils/ have no __init__.py (PEP 420,
# see the `packages` note above), so mypy cannot derive module names without these.
namespace_packages = true
explicit_package_bases = true
# Only the shipped package is gated. Tests and standalone scripts are not installed
# and assert against literals, which reads badly to a type checker.
exclude = ["unit_tests/", "scripts/"]
Expand Down
18 changes: 18 additions & 0 deletions smauglab/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""SmaugLab -- data augmentation strategies for MRI segmentation training.

Deliberately kept free of imports from `smauglab.transforms`. Pulling the
transforms in here would make a bare `import smauglab` drag in torch, kornia and
batchgeneratorsv2 (several seconds), which every console-script invocation would
then pay for. Import the subpackage you actually need:

from smauglab.transforms.gpu.transforms import AugTransformsGPU
"""

from importlib.metadata import PackageNotFoundError, version

try:
__version__ = version("smauglab")
except PackageNotFoundError: # running from a source tree that was never installed
__version__ = "0.0.0"

__all__ = ["__version__"]
Loading
Loading