Skip to content

Comments

Document that poetry lock --check validates pyproject.toml#6704

Closed
johnthagen wants to merge 1 commit intopython-poetry:masterfrom
johnthagen:patch-1
Closed

Document that poetry lock --check validates pyproject.toml#6704
johnthagen wants to merge 1 commit intopython-poetry:masterfrom
johnthagen:patch-1

Conversation

@johnthagen
Copy link
Contributor

Document that the behavior of poetry lock --check also essentially runs poetry check:

$ poetry lock --check

The Poetry configuration is invalid:
  - 'name' is a required property
  - Additional properties are not allowed ('nam' was unexpected)

@neersighted
Copy link
Member

This is more a consequence of the fact that loading the config (basically Poetry()/the old Factory.create_poetry()) runs the validation as it creates a full application instance.

I'm saying that most commands will validate pyproject.toml since we don't read it lazily to populate the internal representation, but I'm not sure there's a good way to communicate that. This is correct, just not exhaustive.

@johnthagen
Copy link
Contributor Author

My motivation is to be able to point co-workers at a canonical, single command to validate Poetry config and lockfile freshness. I think ideally I agree with Sebastian's comment from last year that this would have been implemented as poetry check --lock:

In terms of the status quo, should developers not rely on the side effect that poetry lock --check also invokes the internals of poetry check? Would the recommendation in CI be running both:

poetry check
poetry lock --check

I'd like be sure I'm not recommending relying on some internal behavior of Poetry.

@neersighted
Copy link
Member

I wouldn't mind deprecating lock --check in favor of check --lock and moving all the code there/making the deprecated usage simply an alias. I think that would be the most obvious and clean solution for Poetry going forward.

@johnthagen
Copy link
Contributor Author

johnthagen commented Oct 9, 2022

@johnthagen johnthagen closed this Oct 9, 2022
@johnthagen johnthagen deleted the patch-1 branch October 9, 2022 18:52
@johnthagen
Copy link
Contributor Author

johnthagen commented Dec 20, 2022

In case anyone comes across this, I learned today that poetry lock --check does not in fact validate everything that poetry check does (i.e. it is not a superset of validation). For example, Trove classifiers are validated in poetry check but not poetry lock --check.

So, to get the full amount of checking, a user currently needs to run two steps in CI:

poetry check
poetry lock --check

As mentioned above, this UX would be improved with:

@github-actions
Copy link

This pull request 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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants