Skip to content

fix(completion): Fix os.path.commonprefix deprecation warning in python3.15#6102

Merged
anki-code merged 3 commits into
xonsh:mainfrom
lambda-abstraction:main
Feb 19, 2026
Merged

fix(completion): Fix os.path.commonprefix deprecation warning in python3.15#6102
anki-code merged 3 commits into
xonsh:mainfrom
lambda-abstraction:main

Conversation

@lambda-abstraction

Copy link
Copy Markdown
Contributor

python/cpython#144436 deprecates os.path.commonprefix in 3.15, causing a DeprecationWarning each time when using completion

i copied the implementation of commonprefix (https://github.com/python/cpython/blob/957f9fe162398fceeaa9ddba8b40046b8a03176d/Lib/genericpath.py#L115-L129) and removed the unused fspath, as xonsh only uses commonprefix with str | RichCompletion, not PathLike

i first thought about putting the function into the xonsh.tools module, but one of the places where commonprefix is used in xonsh/completers/bash_completion.py, which is intended to be usable as a standalone script, and adding an import xonsh.tools increased the startup time by a significant amount, so i decided to create a new helper module

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@lambda-abstraction lambda-abstraction changed the title Fix os.path.commonprefix deprecation warning in python3.15 fix(completion): Fix os.path.commonprefix deprecation warning in python3.15 Feb 17, 2026
@anki-code anki-code self-requested a review February 18, 2026 08:32
@anki-code

Copy link
Copy Markdown
Member

LGTM, please add a test

@anki-code anki-code merged commit 2b5b2bb into xonsh:main Feb 19, 2026
15 checks passed
@anki-code

Copy link
Copy Markdown
Member

Thanks @lambda-abstraction !

anki-code pushed a commit that referenced this pull request Mar 5, 2026
🤖 I have created a release *beep* *boop*
---


## [0.22.5](0.22.4...0.22.5)
(2026-03-05)


### Features

* Added useful command decorators: `[@lines](https://github.com/lines)`,
`[@JSON](https://github.com/json)`,
`[@jsonl](https://github.com/jsonl)`, `[@yaml](https://github.com/yaml)`
([#6114](#6114))
([0f7124e](0f7124e))


### Bug Fixes

* **completion:** Fix os.path.commonprefix deprecation warning in
python3.15 ([#6102](#6102))
([2b5b2bb](2b5b2bb))
* Increase `@$()` stability and now it is also working in case of
`$THREAD_SUBPROCS=False`
([#6112](#6112))
([a3ac036](a3ac036))
* **predictor:** Fix predict_threadable to properly handle symlinks,
especially on NixOS
([#6115](#6115))
([bc01b04](bc01b04))
* **prompt:** Keep original key_bindings in prompt-toolkit shell to easy
add new key bindings during session
([#6093](#6093))
([e9b0aea](e9b0aea))
* replace 12 bare except clauses with except Exception
([#6110](#6110))
([54b311c](54b311c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: xonsh-credentials-bot[bot] <97968350+xonsh-credentials-bot[bot]@users.noreply.github.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.

2 participants