mise icon indicating copy to clipboard operation
mise copied to clipboard

With Python, could it be able to configure the virtual environments & version by reading the pyproject.toml file?

Open mesa123123 opened this issue 1 year ago • 1 comments

This is a feature for python and since its built into the main tool I was thinking itd be cool to see the tool get its cues from the pyproject.toml file as I believe this information can already be stored in there?

I'm not sure about the feasibility of this option but it could be really cool!

For instance: mise.toml uses tool.python to read the python version, perhaps we could have a check that goes:

if theres a pyproject there, look at

[project]
requires-python = ">= 3.8"

project.reqiures-python and take that value?

poetry also has a standard for creating virtual envs too so we could transfer that syntax too?

[virtualenvs]
create = true
in-project = true

is the poetry way so maybe?

[tool.mise.venv]
_.python.venv = "{{env.HOME}}/.cache/venv/myproj"

Just a thought so we don't need to make more than one file in a python project

mesa123123 avatar Mar 22 '24 23:03 mesa123123

When using Poetry, the source of truth should remain pyproject.toml. Having Mise or Poetry potentially override one another is a recipe for confusion.

So, I'd suggest that mise picks up parameters from the pyproject file when present, and includes comment lines in .mise.toml about which params have been picked up.

eg .mise.toml

[tools]
poetry = {version='latest', pyproject='pyproject.toml'}
# python = specified in pyproject file. Specifying the version here will not override pyproject.toml.

gittycat avatar Jun 08 '24 13:06 gittycat