Skip to content

Commit 52e8d6b

Browse files
committed
Use setuptools scm to dynamically decide sdk version
Signed-off-by: trafalgarzzz <trafalgarz@outlook.com>
1 parent 2d3932d commit 52e8d6b

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

fluid/api/fluid_client.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def __init__(self, config: ClientConfig):
5050
self.k8s_client = FluidK8sClient(config.namespace, config.runtime_kind, config.kube_config_file,
5151
config.kube_context, config.kube_client_configuration)
5252

53-
def create_dataset(self, dataset_name: str, mount_name: str, mount_point: str, mount_path="", mode="ReadOnly",
53+
def create_dataset(self, dataset_name: str, mount_name: str = None, mount_point: str = None, mount_path="",
54+
mode="ReadOnly",
5455
options=None,
5556
cred_secret_name=None,
5657
cred_secret_options=None, namespace=None,
@@ -71,7 +72,22 @@ def create_dataset(self, dataset_name: str, mount_name: str, mount_point: str, m
7172
models.EncryptOption(opt_key, models.EncryptOptionSource(
7273
models.SecretKeySelector(secret_key, cred_secret_name))))
7374

75+
if (mount_name is None) != (mount_point is None):
76+
raise ValueError("mount_name and mount_point must be set together")
77+
78+
if mount_name is None:
79+
mount_items = None
80+
else:
81+
mount_items = [models.Mount(
82+
mount_point=mount_point,
83+
path=mount_path,
84+
name=mount_name,
85+
options=options,
86+
encrypt_options=encrypt_options
87+
)]
88+
7489
access_mode = "ReadOnlyMany" if mode == "ReadOnly" else "ReadWriteMany"
90+
7591
ds = models.Dataset(
7692
api_version=constants.API_VERSION,
7793
kind=constants.DATASET_KIND,
@@ -80,13 +96,7 @@ def create_dataset(self, dataset_name: str, mount_name: str, mount_point: str, m
8096
namespace=namespace or self.config.namespace,
8197
),
8298
spec=models.DatasetSpec(
83-
mounts=[models.Mount(
84-
mount_point=mount_point,
85-
path=mount_path,
86-
name=mount_name,
87-
options=options,
88-
encrypt_options=encrypt_options
89-
)],
99+
mounts=mount_items,
90100
access_modes=[access_mode],
91101
**kwargs
92102
)

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.0"]
2+
requires = ["setuptools>=64", "setuptools_scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -36,7 +36,9 @@ Homepage = "https://github.com/fluid-cloudnative/fluid-client-python"
3636
Issues = "https://github.com/fluid-cloudnative/fluid-client-python/issues"
3737

3838
[tool.setuptools.dynamic]
39-
version = { attr = "fluid.__version__" }
39+
#version = { attr = "fluid.__version__" }
4040
dependencies = { file = "requirements.txt" }
4141

42+
[tool.setuptools_scm]
43+
4244

0 commit comments

Comments
 (0)