Skip to content

Replace emport with an in-tree import_file - #4

Merged
ps-groscoe merged 5 commits into
mainfrom
replace-emport
Oct 8, 2026
Merged

ps-groscoe merged 5 commits into
mainfrom
replace-emport

Conversation

@nakulj

@nakulj nakulj commented Oct 7, 2026

Copy link
Copy Markdown

Background

CI fails on Python 3.14 in test_local_conf_with_slashconf_dir. emport's import_file registers a file's parent package with SourceFileLoader.load_module(), which 3.14 deprecates (it's removed in 3.15), and pytest turns DeprecationWarning into an error. emport's latest release (1.4.1) still makes that call, and emport is the only thing slash uses it for.

Description

Port emport's import_file into slash/utils/import_utils.py, registering the parent package with exec_module() instead of load_module(), and drop the emport dependency. The loader, local config and plugin manager use the new helper. emport is BSD-licensed and by the same author as slash; the module docstring credits it.

Verification

  • Ported emport's own tests to tests/test_import_utils.py, including its no-warnings test, and added a test that a failed package import doesn't stay in sys.modules.
  • Full suite passes locally on 3.14 without emport installed (1935 passed, 6 skipped).

🤖 Generated with Claude Code

emport's import_file registers a file's parent package with
SourceFileLoader.load_module(), which Python 3.14 deprecates (removal in
3.15). With DeprecationWarning promoted to an error, importing a
slashconf directory fails on 3.14. emport's latest release still has
the call, so port its import_file into slash.utils.import_utils using
exec_module() and drop the dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nakulj
nakulj added this pull request to stack #5 October 7, 2026 23:19
@ps-groscoe

Copy link
Copy Markdown

@nakulj My Claude says that 1.4.1 is fine and the problem is slash pinning 1.3.1

Comment thread slash/utils/import_utils.py Outdated
Comment thread slash/utils/import_utils.py Outdated
nakulj and others added 2 commits October 8, 2026 10:33
Co-authored-by: Geordie Roscoe <137822494+ps-groscoe@users.noreply.github.com>
@nakulj
nakulj requested a review from ps-groscoe October 8, 2026 17:46
Comment thread slash/utils/import_utils.py Outdated
Comment thread slash/utils/import_utils.py Outdated
nakulj and others added 2 commits October 8, 2026 11:11
Co-authored-by: Geordie Roscoe <137822494+ps-groscoe@users.noreply.github.com>
Co-authored-by: Geordie Roscoe <137822494+ps-groscoe@users.noreply.github.com>

@ps-groscoe ps-groscoe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ps-groscoe
ps-groscoe merged commit 7bdc276 into main Oct 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants