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

Validate fields pointing to paths #89

Open
marscher opened this issue Feb 3, 2023 · 5 comments
Open

Validate fields pointing to paths #89

marscher opened this issue Feb 3, 2023 · 5 comments

Comments

@marscher
Copy link

marscher commented Feb 3, 2023

Fields allowing for files are:

  1. readme
  2. license

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.

@abravalheri
Copy link
Owner

abravalheri commented Feb 7, 2023

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...

@abravalheri
Copy link
Owner

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)...

@marscher
Copy link
Author

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?

@abravalheri
Copy link
Owner

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.

@marscher
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants