Skip to content

Use relative imports to fix elasticsearch9 package imports#3232

Merged
miguelgrinberg merged 1 commit intoelastic:mainfrom
miguelgrinberg:use-relative-imports
Dec 19, 2025
Merged

Use relative imports to fix elasticsearch9 package imports#3232
miguelgrinberg merged 1 commit intoelastic:mainfrom
miguelgrinberg:use-relative-imports

Conversation

@miguelgrinberg
Copy link
Copy Markdown
Contributor

@miguelgrinberg miguelgrinberg commented Dec 18, 2025

Fixes #3224

There were many absolute imports, which break when using the elasticsearch8 or elasticsearch9 packages. This PR switches all the absolute imports I found to relative.

Copy link
Copy Markdown
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM.

This could be an useful custom flake8 rule.

@miguelgrinberg miguelgrinberg merged commit 6bc9788 into elastic:main Dec 19, 2025
19 checks passed
@miguelgrinberg miguelgrinberg deleted the use-relative-imports branch December 19, 2025 10:10
@github-actions
Copy link
Copy Markdown

The backport to 8.19 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.19 8.19
# Navigate to the new working tree
cd .worktrees/backport-8.19
# Create a new branch
git switch --create backport-3232-to-8.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 6bc97883e050d681bb9ba11bc7307a38e84c324f
# Push it to GitHub
git push --set-upstream origin backport-3232-to-8.19
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.19

Then, create a pull request where the base branch is 8.19 and the compare/head branch is backport-3232-to-8.19.

@github-actions
Copy link
Copy Markdown

The backport to 9.1 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-9.1 9.1
# Navigate to the new working tree
cd .worktrees/backport-9.1
# Create a new branch
git switch --create backport-3232-to-9.1
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 6bc97883e050d681bb9ba11bc7307a38e84c324f
# Push it to GitHub
git push --set-upstream origin backport-3232-to-9.1
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-9.1

Then, create a pull request where the base branch is 9.1 and the compare/head branch is backport-3232-to-9.1.

github-actions bot pushed a commit that referenced this pull request Dec 19, 2025
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-py that referenced this pull request Dec 19, 2025
miguelgrinberg added a commit to miguelgrinberg/elasticsearch-py that referenced this pull request Dec 19, 2025
miguelgrinberg added a commit that referenced this pull request Dec 19, 2025
…3234)

Fixes #3224

(cherry picked from commit 6bc9788)

Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

elasticsearch9 cross-version imports incompatibility

2 participants