Skip to content

Commit ad3ea87

Browse files
committed
Remove setuptools_scm workarounds
These look like things that are masking issues with packaging. Coincidentally, this also seems to reduce the "every file imports everything else" that you notice when type checking a single file.
1 parent 01d163f commit ad3ea87

6 files changed

Lines changed: 13 additions & 29 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ lint-docker: ## Run linting inside inside Docker
122122

123123
test-docker: ## Run tests inside Docker
124124
docker compose run --rm explorer \
125-
bash --login -c "cd /code && pytest --cov=cubedash --cov-report=xml -r sx --durations=5"
125+
bash --login -c "cd /code && pytest --import-mode=append --cov=cubedash --cov-report=xml -r sx --durations=5 integration_tests"

cubedash/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
try:
2-
from ._version import version as __version__
3-
except ImportError:
4-
__version__ = "Unknown/Not Installed"
5-
61
from ._model import create_app
2+
from ._version import version as __version__
73

84
__all__ = ("create_app", "__version__")

cubedash/_model.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828

2929
from . import _utils as utils
3030

31-
try:
32-
from ._version import version as __version__
33-
except ImportError:
34-
__version__ = "Unknown/Not Installed"
35-
3631
NAME = "cubedash"
3732
BASE_DIR = Path(__file__).parent.parent
3833

cubedash/_pages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
from sqlalchemy.exc import DataError
2222
from werkzeug.datastructures import MultiDict
2323

24-
import cubedash
2524
from cubedash._model import ProductWithSummary
2625
from cubedash._utils import default_utc
26+
from cubedash._version import __version__
2727
from cubedash.summary import TimePeriodOverview
2828
from cubedash.summary._stores import ProductSummary
2929

@@ -497,7 +497,7 @@ def inject_globals():
497497
datacube_metadata_types=list(_model.STORE.all_metadata_types()),
498498
current_time=datetime.now(timezone.utc),
499499
datacube_version=datacube.__version__,
500-
app_version=cubedash.__version__,
500+
app_version=__version__,
501501
grouping_timezone=tz.gettz(_model.DEFAULT_GROUPING_TIMEZONE),
502502
last_updated_time=last_updated,
503503
explorer_instance_title=current_app.config.get(

cubedash/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ def _print_version(ctx, param, value) -> None:
2222

2323
import datacube
2424

25-
import cubedash
25+
from cubedash._version import __version__
2626

2727
click.echo(
2828
f"Open Data Cube:\n"
29-
f" {style('Explorer', bold=True)} version: {cubedash.__version__}\n"
29+
f" {style('Explorer', bold=True)} version: {__version__}\n"
3030
f" {style('Core', bold=True)} version: {datacube.__version__}"
3131
)
3232
ctx.exit()

cubedash/summary/_stores.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@
2020
import pytz
2121
import structlog
2222
from cachetools.func import ttl_cache
23+
from datacube.drivers.postgres._fields import PgDocField
24+
from datacube.index import Index
25+
from datacube.model import Dataset, MetadataType, Product, Range
2326
from dateutil import tz
2427
from eodatasets3.stac import MAPPING_EO3_TO_STAC
2528
from geoalchemy2 import WKBElement
2629
from geoalchemy2 import shape as geo_shape
2730
from geoalchemy2.shape import from_shape, to_shape
31+
from odc.geo.geom import Geometry
2832
from pygeofilter.backends.sqlalchemy.evaluate import (
2933
SQLAlchemyFilterEvaluator as FilterEvaluator,
3034
)
@@ -43,15 +47,6 @@
4347
from sqlalchemy.dialects.postgresql import TSTZRANGE
4448
from sqlalchemy.sql import Select
4549

46-
try:
47-
from cubedash._version import version as explorer_version
48-
except ModuleNotFoundError:
49-
explorer_version = "ci-test-pipeline"
50-
from datacube.drivers.postgres._fields import PgDocField
51-
from datacube.index import Index
52-
from datacube.model import Dataset, MetadataType, Product, Range
53-
from odc.geo.geom import Geometry
54-
5550
from cubedash import _utils
5651
from cubedash.index import EmptyDbError, ExplorerIndex
5752
from cubedash.index.postgis import ExplorerPgisIndex
@@ -300,14 +295,12 @@ def is_schema_compatible(self, for_writing_operations_too: bool = False) -> bool
300295
"""
301296
Have all schema updates been applied?
302297
"""
298+
from cubedash._version import __version__
299+
303300
postgis_ver, is_compatible = self.e_index.schema_compatible_info(
304301
for_writing_operations_too
305302
)
306-
_LOG.debug(
307-
"software.version",
308-
postgis=postgis_ver,
309-
explorer=explorer_version,
310-
)
303+
_LOG.debug("software.version", postgis=postgis_ver, explorer=__version__)
311304
return is_compatible
312305

313306
def init(self, grouping_epsg_code: int | None = None) -> None:

0 commit comments

Comments
 (0)