From 8b0f4ff94db9a9f1a1334cd20a406a6700243036 Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Tue, 12 May 2026 16:56:24 +0200 Subject: [PATCH 1/2] Fix __main__ --- CHANGELOG.md | 1 + src/compas/__main__.py | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ca0c63f48c4..8366fdae9366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Changed `Tolerance` class to no longer use singleton pattern. `Tolerance()` now creates independent instances instead of returning the global `TOL`. * Renamed `Tolerance.units` to `Tolerance.unit` to better reflect the documented properties. Left `units` with deprecation warning. * Fixed `NotImplementedErorr` when calling `BrepLoop.vertices`. +* Fixed `python -m compas` to work in Python 3.13+. ### Removed diff --git a/src/compas/__main__.py b/src/compas/__main__.py index e38c73f7080f..4a2aca4ae692 100644 --- a/src/compas/__main__.py +++ b/src/compas/__main__.py @@ -2,9 +2,9 @@ import platform try: - import pkg_resources + from importlib.metadata import distributions except ImportError: - pkg_resources = None + distributions = None import compas @@ -22,10 +22,9 @@ print("COMPAS: {}".format(compas.__version__)) print("Python: {} ({})".format(platform.python_version(), platform.python_implementation())) - if pkg_resources: - working_set = pkg_resources.working_set - packages = set([p.project_name for p in working_set]) - set(["COMPAS"]) - compas_pkgs = [p for p in packages if p.lower().startswith("compas")] + if distributions: + names = {dist.metadata.get("Name") for dist in distributions()} + compas_pkgs = [p for p in names if p and p.lower().startswith("compas") and p != "COMPAS"] if compas_pkgs: - print("Extensions: {}".format([p for p in compas_pkgs])) + print("Extensions: {}".format(compas_pkgs)) From de783701b909b43214e911135cc713f8c097a701 Mon Sep 17 00:00:00 2001 From: Gonzalo Casas Date: Fri, 15 May 2026 14:07:22 +0200 Subject: [PATCH 2/2] Fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8366fdae9366..48f846510721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Changed `Tolerance` class to no longer use singleton pattern. `Tolerance()` now creates independent instances instead of returning the global `TOL`. * Renamed `Tolerance.units` to `Tolerance.unit` to better reflect the documented properties. Left `units` with deprecation warning. * Fixed `NotImplementedErorr` when calling `BrepLoop.vertices`. -* Fixed `python -m compas` to work in Python 3.13+. +* Fixed `python -m compas` to detect extensions based on `importlib` rather than `pkg_resources`. ### Removed