From b535502104ef74170c201f56313dc787924742d2 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Wed, 11 Nov 2026 15:11:10 -0600 Subject: [PATCH 1/5] nitypes: Make nitypes.__version__ compatible with PyInstaller Signed-off-by: Brad Keryan --- src/nitypes/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/nitypes/__init__.py b/src/nitypes/__init__.py index f36b14be..71797ee9 100644 --- a/src/nitypes/__init__.py +++ b/src/nitypes/__init__.py @@ -1,7 +1,11 @@ """Data types for NI Python APIs.""" -from importlib.metadata import version +import importlib.metadata -__version__ = version(__name__) -"""nitypes version string.""" +try: + # Use a literal package name so PyInstaller automatically copies package metadata. + __version__ = importlib.metadata.version("nitypes") + """nitypes version string.""" +except importlib.metadata.PackageNotFoundError: + __version__ = "unknown" \ No newline at end of file From 3302debf23d74ff8b5b03c9fb2efb9d4024b8b72 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Wed, 11 Nov 2026 15:15:04 -0600 Subject: [PATCH 2/5] tests: Readd test_version.py Signed-off-by: Brad Keryan --- tests/unit/test_version.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/unit/test_version.py diff --git a/tests/unit/test_version.py b/tests/unit/test_version.py new file mode 100644 index 00000000..41441f75 --- /dev/null +++ b/tests/unit/test_version.py @@ -0,0 +1,7 @@ +import importlib.metadata + +import nitypes + + +def test___version_attribute___matches_importlib_metadata() -> None: + assert nitypes.__version__ == importlib.metadata.version("nitypes") From 7033824ab5789c29479e59a9aeac73426ce732b1 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Wed, 11 Nov 2026 15:16:06 -0600 Subject: [PATCH 3/5] tests: Delete test_placeholder.py Signed-off-by: Brad Keryan --- tests/unit/test_placeholder.py | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 tests/unit/test_placeholder.py diff --git a/tests/unit/test_placeholder.py b/tests/unit/test_placeholder.py deleted file mode 100644 index 60d5ce31..00000000 --- a/tests/unit/test_placeholder.py +++ /dev/null @@ -1,2 +0,0 @@ -def test___placeholder() -> None: - pass From 74a8a7074c33642f9dc336b93a1c3b7c68242b86 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Wed, 11 Nov 2026 15:20:57 -0600 Subject: [PATCH 4/5] github: Revert workaround for broken pip Signed-off-by: Brad Keryan --- .github/workflows/run_unit_tests_oldest_deps.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/run_unit_tests_oldest_deps.yml b/.github/workflows/run_unit_tests_oldest_deps.yml index 2cbd1dd1..9b916a2e 100644 --- a/.github/workflows/run_unit_tests_oldest_deps.yml +++ b/.github/workflows/run_unit_tests_oldest_deps.yml @@ -47,12 +47,7 @@ jobs: if: steps.cache-virtualenv.outputs.cache-hit != 'true' run: poetry install -v - name: Display installed dependency versions - run: | - # Use importlib instead of assuming that the project venv contains an up-to-date pip. - import importlib.metadata - for dist in sorted(importlib.metadata.Distribution.discover(), key=lambda d: d.name): - print(f"{dist.name}: {dist.version}") - shell: poetry run python {0} + run: poetry run pip list - name: Run unit tests and code coverage # Skip test___pickled_value___unpickle___is_compatible because this test's pickle data was saved with NumPy 2.x and cannot be loaded in NumPy 1.x. run: poetry run pytest ./tests/unit -v --cov=nitypes --junitxml=test_results/nitypes-oldest-deps-${{ matrix.os }}-py${{ matrix.python-version }}.xml -k "not test___pickled_value___unpickle___is_compatible" From 9f3d358b4a95cc0eaadb67d366937ef1a8928987 Mon Sep 17 00:00:00 2001 From: Brad Keryan Date: Wed, 11 Nov 2026 15:23:50 -0600 Subject: [PATCH 5/5] chore: Fix formatting Signed-off-by: Brad Keryan --- src/nitypes/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nitypes/__init__.py b/src/nitypes/__init__.py index 71797ee9..e99c2892 100644 --- a/src/nitypes/__init__.py +++ b/src/nitypes/__init__.py @@ -2,10 +2,9 @@ import importlib.metadata - try: # Use a literal package name so PyInstaller automatically copies package metadata. __version__ = importlib.metadata.version("nitypes") """nitypes version string.""" except importlib.metadata.PackageNotFoundError: - __version__ = "unknown" \ No newline at end of file + __version__ = "unknown"