Skip to content

Commit c55a4e8

Browse files
committed
build: single version source (also fix wrong version in __init__)
1 parent 0fa88d5 commit c55a4e8

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

detectree/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@
44
from .lidar import LidarToCanopy, rasterize_lidar
55
from .train_test_split import TrainingSelector
66
from .utils import split_into_tiles
7-
8-
__version__ = "0.4.2"

detectree/cli/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""detectree CLI."""
22

33
import logging
4+
from importlib import metadata
45
from os import path
56

67
import click
@@ -98,7 +99,7 @@ def _dump_clf(clf, output_filepath, logger):
9899

99100
# CLI
100101
@click.group()
101-
@click.version_option(version=dtr.__version__, message="%(version)s")
102+
@click.version_option(version=metadata.version("detectree"), message="%(version)s")
102103
@click.pass_context
103104
def cli(ctx):
104105
"""Detectree CLI."""

docs/conf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
#
2222
import os
2323
import sys
24-
25-
import detectree
24+
from importlib import metadata
2625

2726
sys.path.insert(0, os.path.abspath(".."))
2827

@@ -67,9 +66,9 @@
6766
# the built documents.
6867
#
6968
# The short X.Y version.
70-
version = detectree.__version__
69+
release = metadata.version("detectree")
7170
# The full version, including alpha/beta/rc tags.
72-
release = detectree.__version__
71+
version = ".".join(release.split(".")[:2])
7372

7473
# The language for content autogenerated by Sphinx. Refer to documentation
7574
# for a list of supported languages.

0 commit comments

Comments
 (0)