Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for per-project settings #618

Closed
1 task done
sdispater opened this issue Nov 12, 2018 · 10 comments
Closed
1 task done

Add support for per-project settings #618

sdispater opened this issue Nov 12, 2018 · 10 comments
Labels
area/cli Related to the command line area/config Related to configuration management kind/feature Feature requests/implementations
Milestone

Comments

@sdispater
Copy link
Member

  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

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
@sdispater sdispater added area/cli Related to the command line area/config Related to configuration management kind/feature Feature requests/implementations labels Nov 12, 2018
@sdispater sdispater added this to the 1.0 milestone Nov 12, 2018
@jacebrowning
Copy link
Contributor

jacebrowning commented Nov 12, 2018

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.

@GuillaumeDesforges
Copy link

Would be a very useful feature. Or should I say that it is a must-have?

@jacebrowning
Copy link
Contributor

To further expand on my proposal, perhaps Poetry could build settings in the following order:

  1. Use the value from pyproject.toml (possibly a new [tool.poetry.meta] section)
  2. Use the globally set value from $ poetry config
  3. Use the default value

@jobec
Copy link

jobec commented Apr 13, 2019

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.

@raxod502
Copy link

raxod502 commented Jul 9, 2019

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.

@kylebebak
Copy link

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.

@sneko
Copy link

sneko commented Jul 24, 2019

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,

@sdispater
Copy link
Member Author

This is implemented in #1272 and will be available in the next 1.0.0 release

@TheButlah
Copy link
Contributor

Is there any update as to whether config.toml could be incorporated into pyproject.toml as per
@jacebrowning 's comment?

Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/cli Related to the command line area/config Related to configuration management kind/feature Feature requests/implementations
Projects
None yet
Development

No branches or pull requests

8 participants