Sometimes you might want some settings to be set on a per-project basis. For instance, you might want your virtualenv to be created inside the project's directory only for the current project.
To make this possible, we could add a --local
option to the config
command.
The example use case above would then look like this:
poetry config settings.virtualenvs.in-project true --local
And alternative way would be to make namespace command: config:local
:
poetry config:local settings.virtualenvs.in-project true
Has any consideration been given to storing some of these local settings in pyproject.toml
? I would like every user of a given project to have a virtual environment at ./venv/
so that other tools/scripts/editors can depend on it.
Would be a very useful feature. Or should I say that it is a must-have?
To further expand on my proposal, perhaps Poetry could build settings in the following order:
pyproject.toml
(possibly a new [tool.poetry.meta]
section)$ poetry config
That matches with how git config
does it, except for one more level: system
https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
Pip also does this in 3 levels:
https://pip.pypa.io/en/stable/user_guide/#config-file
The system wide setting is something I use quite often. It allows all users on a system to have the same settings, irrespective of who is setting up an environment. That might be useful when different users update an application on a server, for example.
@jobec There is a better place: #964 even if you are talking about git config --system
.
P.S I'm thinking about having a gitter channel for this at the same time.
Can I put in a request for passing config options on the command line, like git -c
? I am writing a tool that automatically runs Poetry. The tool needs to set these options for certain commands, but I don't want it to overwrite the user's configuration file. Updating and then automatically reverting the configuration file is super disgusting, but I can't think of any better way to do it with the current release of Poetry.
Just want to second @jacebrowning 's proposal -- project-specific settings would be most useful to devs if they lived in pyproject.toml
.
For me it seems that all project-specific settings should be in pyproject.toml
... This is the most natural place to store them. It would make them very easy to find, and guarantee they're shared by all project developers.
Sorry disturbing you, but could you confirm this issue is only about to set local properties through CLI?
Because I tried to put manually into pyproject.toml
the following:
[settings.virtualenvs]
in-project = "true"
But it has no effect, I have no ./.venv/
directory created... Is it normal?
Maybe your issue is targeting the fact no local settings are taken in account?
Thank you,
This is implemented in #1272 and will be available in the next 1.0.0
聽release
Is there any update as to whether config.toml could be incorporated into pyproject.toml as per
@jacebrowning 's comment?
Most helpful comment
Has any consideration been given to storing some of these local settings in
pyproject.toml
? I would like every user of a given project to have a virtual environment at./venv/
so that other tools/scripts/editors can depend on it.