SyntaxWarning on Python 3.12
Checklist
- [X] I added a descriptive title
- [X] I searched open reports and couldn't find a duplicate
What happened?
After installing the latest version of conda-lock via pixi global install conda-lock, invoking conda-lock results in SyntaxWarning spam in the console output:
$ conda-lock --version
/pixi/envs/conda-lock/lib/python3.12/site-packages/clikit/utils/string.py:81: SyntaxWarning: invalid escape sequence '\s'
words = re.split("\s+", string)
/pixi/envs/conda-lock/lib/python3.12/site-packages/clikit/api/args/format/command_option.py:47: SyntaxWarning: invalid escape sequence '\-'
if not re.match("^[a-zA-Z0-9\-]+$", alias):
conda-lock, version 2.5.7
Additional Context
The offending code is in clikit, but it looks like that code has since been fixed (note it now uses a r"raw string literal" as it should have in the first place).
I looked through conda-lock's pyproject.toml to see if fixing this is just a matter of updating a >= constraint on clikit, but I didn't see clikit declared in dependencies. Perhaps it's getting pulled in transitively, but (ironically) I couldn't find a lockfile that mentioned it when I searched the code.
Note this reproduces with a fresh install of the latest version of conda-lock via pixi global install conda-lock, but does not reproduce when installing via other tools I've tested, e.g. uv tool install conda-lock.
In case it's relevant, this reproduces when using the latest version of pixi to install conda-lock, namely 0.29.0.
Thanks a lot @ctcjab for the report! We just removed the clikit dependency in #637. Unfortunately that broke some other stuff, so we can't release it yet.
BTW I am very curious why you use conda-lock in addition to pixi. (See also #615)
Thanks @maresb, good to know. Out of curiosity, any idea why this doesn't reproduce when installed with e.g. uv tool install?
I use conda-lock in addition to pixi because I work with a large number of codebases, most of which are not mine, and all of which have limited resources for migrations. I've been tracking #615 with interest, and am excited to understand the best path forward for existing conda-lock users, as well as for conda users who are not currently using lockfiles and may be interested to leapfrog straight to pixi.
Oh, the only reason this didn't reproduce with uv tool install is that it used an older Python version. I just tried uv tool install conda-lock --python 3.12 and then with that installation this issue reproduced.
Cool, thanks a lot @ctcjab for tracking that down!!!
Any way I could get you to test main? I'm really close to a new major release.
Just did a uv pip install -e . from the latest revision of main in a python 3.12 venv, and when I invoked the conda-lock that got installed there, this did not reproduce. Awesome!
This is fixed in v3.