diff --git a/.github/actions/python/action.yml b/.github/actions/python/action.yml index f008fe4e..1257f3c0 100644 --- a/.github/actions/python/action.yml +++ b/.github/actions/python/action.yml @@ -53,7 +53,7 @@ runs: uses: actions/upload-artifact@v7.0.1 with: name: python-wheel-${{ inputs.native-version }}-${{ inputs.platform }} - path: native-lib/python/dist/dataweave_native-0.0.1-py3-*.whl + path: native-lib/python/dist/dataweave_native-*-py3-*.whl archive: false if-no-files-found: error diff --git a/native-lib/README.md b/native-lib/README.md index 1c0c3442..95ceaba5 100644 --- a/native-lib/README.md +++ b/native-lib/README.md @@ -82,7 +82,7 @@ The wheel will be created in: After `:native-lib:buildPythonWheel`: ```bash -python3 -m pip install native-lib/python/dist/dataweave_native-0.0.1-*.whl +python3 -m pip install native-lib/python/dist/dataweave_native-*-py3-*.whl ``` This wheel includes the `dwlib.*` shared library inside the Python package. diff --git a/native-lib/build.gradle b/native-lib/build.gradle index 88bbf394..c70d6de0 100644 --- a/native-lib/build.gradle +++ b/native-lib/build.gradle @@ -135,6 +135,7 @@ tasks.register('buildPythonWheel', Exec) { inputs.file("${projectDir}/python/setup.py") inputs.file("${projectDir}/python/setup.cfg") inputs.file("${projectDir}/python/pyproject.toml") + inputs.property('nativeVersion', project.version.toString()) outputs.dir("${projectDir}/python/dist") doFirst { // Clean old wheels and build artifacts to ensure fresh build @@ -145,6 +146,7 @@ tasks.register('buildPythonWheel', Exec) { // Use setup.py bdist_wheel to generate platform-specific wheel tags // The custom setup.py overrides bdist_wheel to set correct platform tags // for the bundled native library (dwlib) + environment 'NATIVE_VERSION', project.version.toString() commandLine(pythonExe, 'setup.py', 'bdist_wheel', '-d', 'dist') } diff --git a/native-lib/python/README.md b/native-lib/python/README.md index 1b4294c7..51ec95ac 100644 --- a/native-lib/python/README.md +++ b/native-lib/python/README.md @@ -22,7 +22,7 @@ After building: ```bash ./gradlew :native-lib:buildPythonWheel -python3 -m pip install native-lib/python/dist/dataweave_native-0.0.1-*.whl +python3 -m pip install native-lib/python/dist/dataweave_native-*-py3-*.whl ``` ### Option B: Editable install for development diff --git a/native-lib/python/pyproject.toml b/native-lib/python/pyproject.toml index 03a366ae..642ab3ce 100644 --- a/native-lib/python/pyproject.toml +++ b/native-lib/python/pyproject.toml @@ -1,12 +1,3 @@ [build-system] requires = ["setuptools>=68", "wheel"] build-backend = "setuptools.build_meta" - -[project] -name = "dataweave-native" -version = "0.0.1" -description = "Python bindings for the DataWeave native library" -requires-python = ">=3.9" - -[project.optional-dependencies] -test = ["pytest", "pytest-cov"] diff --git a/native-lib/python/setup.cfg b/native-lib/python/setup.cfg index a1635ae1..1f1b6d02 100644 --- a/native-lib/python/setup.cfg +++ b/native-lib/python/setup.cfg @@ -13,6 +13,11 @@ python_requires = >=3.9 [options.packages.find] where = src +[options.extras_require] +test = + pytest + pytest-cov + [options.package_data] dataweave = native/* diff --git a/native-lib/python/setup.py b/native-lib/python/setup.py index 8c32d49e..8b390d07 100644 --- a/native-lib/python/setup.py +++ b/native-lib/python/setup.py @@ -9,6 +9,7 @@ tags based on the current build environment. """ +import os import platform import struct import sys @@ -106,4 +107,7 @@ def get_tag(self): if bdist_wheel is not None: cmdclass["bdist_wheel"] = bdist_wheel -setup(cmdclass=cmdclass) +setup( + version=os.environ.get("NATIVE_VERSION", "0.0.1"), + cmdclass=cmdclass, +)