Sam Estep
Sam Estep

Reputation: 13354

Can I use uv to replace Pyenv for my JavaScript project that depends on node-gyp?

I have a Node.js project that depends on node-canvas, which in turn depends on node-gyp. If I start with a fresh clone of my project and try to install my project dependencies from npm using the yarn command, this works as long as my Python version is 3.10; if the Python version is newer, it fails with a node-gyp error. Previously I dealt with this by using Pyenv and creating a .python-version file in my repository with these contents:

3.10

However, recently I have switched to using uv, which claims to be able to replace Pyenv. I have found uv to work great for all my projects that are actually Python-focused, include a pyproject.toml, etc: I just prepend all my commands with uv run. But in this JavaScript project, I don't have a pyproject.toml, and it would be weird to have to do uv run yarn all the time instead of just yarn; all I want is for my Python version to just obey my .python-version file like I was able to do before with Pyenv.

Is it possible to achieve this with uv? Or do I still need Pyenv for this use case?

Upvotes: 0

Views: 28

Answers (0)

Related Questions