-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Thanks for providing this useful tool.
I looked into validating pyproject.toml
with a cibuildwheel
section. A schema for the cibuildwheel section is included in https://json.schemastore.org/pyproject.json
(as of pypa/cibuildwheel#1622), but not in the JSON schema shipped with validate-pyproject. So I went to use the new --store
command-line option in my pre-commit configuration like this:
- repo: https://github.com/abravalheri/validate-pyproject
rev: main
hooks:
- id: validate-pyproject
args:
# Load an up-to-date JSON schema for pyproject.toml which references
# the tool schemas used within pyproject.toml.
- "--store"
- "https://json.schemastore.org/pyproject.json"
This approach works beautifully on a technical level (i.e., the cibuildwheel tool section is validated correctly), but comes at a cost: running validate-pyproject
now takes multiple seconds.
$ time validate-pyproject --store https://json.schemastore.org/pyproject.json pyproject.toml
Valid file: pyproject.toml
________________________________________________________
Executed in 8.15 secs fish external
usr time 1.08 secs 931.00 micros 1.08 secs
sys time 0.11 secs 116.00 micros 0.11 secs
$ time validate-pyproject pyproject.toml
Valid file: pyproject.toml
________________________________________________________
Executed in 148.49 millis fish external
usr time 132.08 millis 1.26 millis 130.82 millis
sys time 16.51 millis 0.16 millis 16.35 millis
I haven't done any profiling, but I would assume downloading the individual schemas at least contributes to the cost.
@henryiii, is this something you're seeing as well, and is there already a plan to address this (caching?)