-
Notifications
You must be signed in to change notification settings - Fork 31
Description
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: altgraph triggers a UserWarning from setuptools during bundled script execution pyinstaller/pyinstaller#9149
- Fix PR: Mitigate issues with pkg_resources deprecation warning pyinstaller/pyinstaller#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 suppressionKnown 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_metadataThis 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 outputEnvironment
- 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).