pkg_resources deprecation warning appears on every action-server command
Description
Every action-server command displays a deprecation warning from setuptools, affecting user experience across all versions:
PyInstaller/loader/pyimod02_importers.py:450: UserWarning: pkg_resources is deprecated as an API.
See https://setuptools.pypa.io/en/latest/pkg_resources.html
Deprecation slated for removal as early as 2025-11-30
warnings.warn(
While this is cosmetic and doesn't affect functionality, it clutters output and may concern users about software quality.
Root Causes
After investigating your codebase, I found two issues contributing to this:
1. Direct import in action-server.spec
File: action_server/action-server.spec
Line 7: import pkg_resources
This causes the warning at build time and gets baked into the binary.
2. Outdated PyInstaller version
File: action_server/pyproject.toml
Current: pyinstaller = "6.12.0"
Fix available in: PyInstaller 6.14.0+
PyInstaller fixed runtime pkg_resources warnings in version 6.14.0 via:
- Issue: https://github.com/pyinstaller/pyinstaller/issues/9149
- Fix PR: https://github.com/pyinstaller/pyinstaller/pull/9151 (merged May 28, 2025)
- Discussion: https://github.com/orgs/pyinstaller/discussions/9148
The underlying cause: altgraph (PyInstaller dependency) imports pkg_resources, and setuptools 80.9.0+ changed DeprecationWarning to UserWarning, making it visible to end users.
Recommended Solutions
Option 1: Upgrade PyInstaller (Preferred)
# pyproject.toml
pyinstaller = "^6.14.0" # Includes runtime warning suppression
Known blocker: Your existing comment indicates macOS build issues with 6.13.0. This may need investigation to determine if 6.14.0+ resolves those issues.
Option 2: Modernize the spec file import
# action-server.spec line 7
# Replace:
import pkg_resources
# With:
from importlib import metadata as importlib_metadata
This aligns with setuptools migration guidance and eliminates the deprecated API usage.
Option 3: Temporary suppression (Quick fix)
# action-server.spec (add after imports)
import warnings
warnings.filterwarnings("ignore", message="pkg_resources is deprecated")
This doesn't fix the root cause but hides the warning from users immediately.
Impact
- Severity: Low (cosmetic only, no functional impact)
- Scope: All versions (confirmed in v2.14.0 and v2.16.1)
- User Experience: Warning appears on every command:
version,start,import, etc.
Steps to Reproduce
action-server version
# Warning appears immediately before version output
Environment
- OS: Linux (Docker debian:bookworm-slim), likely affects all platforms
- Python: 3.12+
- Current PyInstaller: 6.12.0
- setuptools: 80.9.0+ (introduces visible UserWarning)
Additional Context
This issue is separate from #282 (micromamba bug). While #282 blocks v2.16.1 entirely, this warning affects even the stable v2.14.0 release. Both can be addressed independently.
Happy to provide a PR if guidance is provided on which approach you'd prefer (especially regarding the macOS PyInstaller upgrade blocker).
Testing Limitations
I should note that I cannot test the proposed fixes myself:
-
macOS Testing: I don't have access to a macOS device to validate whether PyInstaller 6.14.0+ resolves the macOS build issues mentioned in your
pyproject.tomlcomment. -
Local Build Testing: The build process for
action-servercannot be reproduced locally as the full build toolchain and dependencies are not vendored in the repository. I can only test against the pre-built binaries from your CDN.
This means I can only observe and report the warning behavior in the distributed binaries, but cannot validate potential fixes through local builds. Any testing of the proposed solutions would need to be done by the maintainers with access to the complete build environment.
The good news is that Option 3 (temporary warning suppression) would be the safest immediate fix that doesn't require validating the PyInstaller upgrade on multiple platforms.
Fixed in commit fbb95f6
I've implemented a fix for this issue using a hybrid approach:
Changes Made
File: action_server/action-server.spec
- ✅ Removed the unused
import pkg_resourcesstatement (line 7) - ✅ Added
warnings.filterwarnings("ignore", message="pkg_resources is deprecated")to suppress warnings from dependencies
Why This Approach?
- Safe: Doesn't require upgrading PyInstaller, avoiding the known macOS build issues with 6.13.0+
- Complete: Addresses both the direct import and any transitive warnings from dependencies (like
altgraph) - Verified: The
pkg_resourcesimport wasn't actually being used anywhere in the spec file
Testing
The spec file compiles successfully with Python's syntax checker, and this should eliminate the warning that users see on every action-server command.
Future Consideration
When the PyInstaller macOS build issues are resolved, upgrading to 6.14.0+ would provide an additional layer of protection by suppressing these warnings at the PyInstaller runtime level. But for now, this fix should fully resolve the user-facing warning without introducing any new issues.
The fix is ready in the 003-open-core-build branch and can be cherry-picked or merged as needed.