Skip to content

Commit 5aefc57

Browse files
committed
dynamic version
1 parent 2283a67 commit 5aefc57

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ generate_docs.py
4949

5050
# Test scripts with credentials
5151
test_advanced_search_post.py
52+
update_version.py

darktrace/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Darktrace SDK - Pythonic, modular, and complete API wrapper
2+
from ._version import __version__
23
from .dt_antigena import Antigena
34
from .dt_analyst import Analyst
45
from .auth import DarktraceAuth
@@ -61,7 +62,4 @@
6162
'ModelBreaches',
6263
'AdvancedSearch',
6364
'debug_print'
64-
]
65-
66-
# Version
67-
__version__ = '0.8.1'
65+
]

darktrace/_version.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Version information for darktrace-sdk
2+
# This is the single source of truth for version information
3+
4+
__version__ = "0.8.3"

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "darktrace-sdk"
7-
version = "0.8.3"
7+
dynamic = ["version"]
88
description = "A modern, modular, and complete Python SDK for the Darktrace API"
99
readme = "README.md"
1010
license = "MIT"
@@ -30,6 +30,9 @@ dependencies = [
3030
"Bug Reports" = "https://github.com/LegendEvent/darktrace-sdk/issues"
3131
"Source" = "https://github.com/LegendEvent/darktrace-sdk"
3232

33+
[tool.setuptools.dynamic]
34+
version = {attr = "darktrace._version.__version__"}
35+
3336
[tool.setuptools.packages.find]
3437
where = ["."]
3538
include = ["darktrace*"]

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
from setuptools import setup, find_packages
2+
import os
3+
4+
# Read version from _version.py
5+
def get_version():
6+
version_file = os.path.join(os.path.dirname(__file__), 'darktrace', '_version.py')
7+
with open(version_file) as f:
8+
exec(f.read())
9+
return locals()['__version__']
210

311
with open("README.md", "r", encoding="utf-8") as fh:
412
long_description = fh.read()
513

614
setup(
715
name='darktrace-sdk',
8-
version='0.8.3',
16+
version=get_version(),
917
description='A modern, modular, and complete Python SDK for the Darktrace API',
1018
long_description=long_description,
1119
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)