Open Kurt-von-Laven opened 3 years ago
So working backward from the request, the check command is here: https://github.com/python-poetry/poetry/blob/master/src/poetry/console/commands/check.py
This loads the PyProject.toml file using: https://github.com/python-poetry/poetry-core/blob/master/src/poetry/core/pyproject/toml.py
And then calls the validate strict method from the Factory
class. This is actually an inherited method though from BaseFactory
here:
https://github.com/python-poetry/poetry-core/blob/master/src/poetry/core/factory.py#L375
Now, if we look at how the config command works, it loads poetry.toml first here: https://github.com/python-poetry/poetry/blob/master/src/poetry/factory.py#L50-L55
This seems to be the case before based on the fact the configuration file output from above shows up in the command output https://github.com/python-poetry/poetry/blob/master/src/poetry/console/commands/config.py#L107
Output:
❯ poetry config --list -vvv
Loading configuration file /Users/REDACTED/Library/Application Support/pypoetry/config.toml
cache-dir = "/Users/REDACTED/Library/Caches/pypoetry"
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/REDACTED/Library/Caches/pypoetry/virtualenvs
So it looks easy enough to do, mostly just add new keys to validate and then extend the check command to merge the configurations, but I'd be curious what the team is thinking in terms of structuring this. E.g. do you want separate validation methods for different configuration types (pyproject, poetry, etc.) or extend the main one as the application uses the configurations as if they're one from an object perspective
My personal preference as a user would be that the existing check
command validate both pyproject.toml
and poetry.toml
by default.
Hey guys, quick question that I didn't see answered in the online docs; what is the poetry.toml file?
I ran poetry config --local virtualenvs.in-project true
to create virtualenv in my project, expecting pyproject.toml to get updated, and instead saw the new file in my Git working tree.
Thanks, sorry if it actually is in the docs and I missed it 🙂
what is the poetry.toml file?
poetry.toml
is for storing local poetry config settings. So you are able to have different poetry settings per project. Because application settings are usually specific to the user, we don't store this in the pyproject.toml
. Otherwise one cannot separate project specific data you usually want to share and application settings you don't want to share.
A section in the docs about this file seems to be missing. PR is welcome ;)
@finswimmer Cool sounds good 👍🏿
I haven't looked, but assuming docs built with Sphinx? I should be able to do PR tmrw after work or next Monday 🙏🏿
Feature Request
poetry check is great for validating
pyproject.toml
. It would be helpful to have some way to validatepoetry.toml
as well.poetry check
could validate both files by default, and a new optional option could be introduced to specify the path to the file to check.