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
Error out when poetry -C argument is not a pyproject directory #695
base: main
Are you sure you want to change the base?
Conversation
998d44b
to
77e73a3
Compare
Fixes tests that previously passed pyproject.toml paths as the 'cwd' argument to avoid failures and complexity.
@radoering would you be free to review this? |
I am currently busy preparing Poetry 1.8. I'll take a look after that's done. (The corresponding poetry-core has already been released at the beginning of February so you caught an unlucky timing.) |
No problem at all. Thx! |
We have to be careful not to accidentally introduce a breaking change and therefore evaluate all uses of
|
@radoering How can AI help with these concerns? I think the current state of the Looking forward to hear more about the project's needs on this front. |
Poetry's current handling of the --directory (or -C) argument does not protect against incorrectly specified paths (e.g. misspellings and simple mistakes). In mono repo projects, and other cases where a parent directory has a pyproject.toml this can lead to commands being run in an unexpected package environment, leading to error prone and difficult to catch behaviour in multi package repositories. This change retains the default behavior of poetry when no -C argument is specified (i.e. walking up the tree from the current directory) but ensures that the -C argument is valid when it is manually specified. This prevents incorrectly typed directories from breaking builds & CI scripts, while retaining the current default behaviour, minimising change. Some tests are also updated where they previously pass paths to pyproject.toml files to the cwd arg, (instead of project directories).
for more information, see https://pre-commit.ci
Quality Gate passedIssues Measures |
Don't think this is the correct spot for handling an input validation from the poetry cli. This should be handled at https://github.com/python-poetry/poetry/blob/d08c75afcc097b3b6a73c704f64f7cebbc2765c1/src/poetry/console/application.py#L123-L131 |
Poetry's current handling of the
--directory
(or-C
) argument does not protect against incorrectly specified paths (e.g. misspellings and simple mistakes).In mono repo projects, and other cases where a parent directory has a
pyproject.toml
this can lead to commands being run in an unexpected package environment, leading to error prone and difficult to catch behaviour in multi package repositories.This change retains the default behavior of
poetry
when no-C
argument is specified (i.e. walking up the tree from the current directory) but ensures that the-C
argument is valid when it is manually specified.This prevents incorrectly typed directories from breaking builds & CI scripts, while retaining the current default behaviour, minimising change.
Some tests are also updated where they previously pass paths to
pyproject.toml
files to thecwd
arg, (instead of project directories).