Open marscher opened 1 year ago
I am on the fence for this one...
Right now validate-pyproject
validates the pyproject.toml
file itself, in a standalone matter... It does not matter if the user runs the validator from the project directory. If the file does not change, it will keep being valid or invalid, which is consistent and good.
Adding a feature like this means that we validate pyproject.toml
+ the environment in which it is contained. This is a change in behaviour and the same file can be considered valid and invalid in 2 moments of time, even if the file itself does not change, which is conceptually weird...
We could, potentially, achieve something with warnings and having a CLI flag to transform warnings in errors, but the warnings
module in Python is very limited...
warnings.catch_warnings()
is not really thread-safe, there is no way of removing warnings added by warnings.simplefilter
without doing a full warnings.resetwarnings
(these 2 functions are probably not very thread-safe)...
I agree, that this feels strange from the aspect of validating two different things out of the developer perspective. Out of the users perspective on the other hand it feels strange, that these things are separated.
Sorry, I do not understand why thread safety is a concern here. Is the validation process multi-threaded?
Sorry, I do not understand why thread safety is a concern here. Is the validation process multi-threaded?
@marscher, validate-pyproject
is a library, this means that it can be used in a code that uses multiple threads.
That's a valid point. Although I think it is unlikely that developers will fiddle around with the environment during execution the validation. But it can happen of course. Then it'd be super hard to detect or work around this circumstance.
If this causes too much of an headache, I'd be fine with closing my request.
Fields allowing for files are:
It would be very nice of
validate-pyproject
, if it could raise when one of these files are not accessible. It just happened to me during transitioning from RST to Markdown for the readme, that I forgot to adopt this. And I used validate-pyproject as a pre-commit hook.I'd also be happy to submit a PR for this.