Replace deprecated pkg_resources usage in mongo observer
Summary
Prefer stdlib importlib.resources to locate sacred/data/mime.types and fall back to pkg_resources only if necessary. This avoids UserWarning about pkg_resources deprecation when importing sacred.observers.mongo.
./.venv/lib/python3.13/site-packages/sacred/dependencies.py:11: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
This adds support for Python 3.13/14.
Rationale
pkg_resources is deprecated as an API; importlib.resources is the modern replacement in the stdlib and available in most supported Python versions.
This change is backwards-compatible and preserves previous behavior by falling back to pkg_resources when importlib.resources is not available.
Files Changed
sacred/observers/mongo.py
Testing
Smoke-tested import and mime detection locally.
Follow-up
Consider removing other uses of pkg_resources (e.g., sacred/dependencies.py).
Hi @pulkitgoyal56! Thanks for addressing this issue! It seems like your modification is not backward-compatible, can you fix it for Python <=3.9?
Also, we use black formatting, please run the pre-commit hook. It will fix the test_pre_commit test case.
Hey, thanks for your reply. I'll fix it and apply the formatting.
I'd like to finish this issue, but keeping support for Python <= 3.9 is just hacky. Given that they have reached EOL, maybe this is not really required?
But if you still want to keep support for it, I'll cancel this pull request.