Skip to content

Commit f54d315

Browse files
committed
Specify the version on the Python side and on the Conda side
TODO: Add CI/CD on the conda side to test whether the versions match: - once the Conda package is built, extract version from meta-data - compare it with khiops.__version__
1 parent 576f3e9 commit f54d315

3 files changed

Lines changed: 6 additions & 27 deletions

File tree

khiops/__init__.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,9 @@
2222
(extension ".khcj")
2323
- sklearn: Scikit-Learn estimator classes to learn and use Khiops models
2424
"""
25-
import importlib.metadata
26-
import os
27-
import sys
28-
import warnings
29-
from copy import copy
30-
from importlib.metadata import PackageNotFoundError
31-
from pathlib import Path
32-
3325
from khiops.core.internals.version import KhiopsVersion
3426

35-
try:
36-
# Package is installed
37-
__version__ = importlib.metadata.version(__name__)
38-
except PackageNotFoundError:
39-
# Package is not installed, hence parse the pyproject.toml file
40-
try:
41-
# Python >= 3.11: use the standard-library tomllib module
42-
import tomllib as tomli
43-
except ModuleNotFoundError:
44-
# Python < 3.11: use the Pip-vendored tomli module
45-
from pip._vendor import tomli
46-
with open("pyproject.toml", "rb") as metadata_file:
47-
metadata = tomli.load(metadata_file)
48-
49-
# Strip "-" from pre-release versions to match installed package metadata
50-
__version__ = metadata.get("project").get("version").replace("-", "")
27+
__version__ = "11.0.0.0b.0"
5128

5229

5330
def get_compatible_khiops_version():

packaging/conda/meta.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{% set name = load_file_data('../../pyproject.toml', from_recipe_dir=True).get('project').get('name') %}
2-
{% set version = load_file_data('../../pyproject.toml', from_recipe_dir=True).get('project').get('version') %}
32
package:
43
name: {{ name }}
54
# The Conda version cannot contain the '-' character, so we eliminate it
6-
version: {{ version | replace('-', '') }}
5+
version: "11.0.0.0b.0"
76

87
source:
98
path: ../../

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ ignore_errors = true
145145

146146
[project]
147147
name = "khiops"
148-
version = "11.0.0.0-b.0"
148+
dynamic = ["version"]
149149
description = "Python library for the Khiops AutoML suite"
150150
readme = "README.md"
151151
license = "BSD-3-Clause-Clear"
@@ -191,6 +191,9 @@ gcs = [
191191
include = ["khiops", "khiops.*"]
192192
namespaces = false
193193

194+
[tool.setuptools.dynamic]
195+
version = {attr = "khiops.__version__"}
196+
194197
[project.scripts]
195198
kh-status = "khiops.tools:kh_status_entry_point"
196199
kh-samples = "khiops.tools:kh_samples_entry_point"

0 commit comments

Comments
 (0)