Skip to content

Commit 4aaa0c4

Browse files
authored
chore: add validate-pyproject-schema-store (#364)
* chore: add validate-pyproject-schema-store Signed-off-by: Henry Schreiner <[email protected]> * fix: use quotes Signed-off-by: Henry Schreiner <[email protected]> * fix: fix hatch def error from validate-pyproject-schema-store Signed-off-by: Henry Schreiner <[email protected]> --------- Signed-off-by: Henry Schreiner <[email protected]>
1 parent 0f33f77 commit 4aaa0c4

File tree

5 files changed

+21
-26
lines changed

5 files changed

+21
-26
lines changed

docs/_includes/interactive_repo_review.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020
<App
2121
header={false}
2222
deps={[
23-
"sp-repo-review==2023.12.21",
2423
"repo-review~=0.10.0",
25-
"validate-pyproject~=0.15.0",
26-
"scikit-build-core~=0.7.0",
27-
"cibuildwheel~=2.16.0",
24+
"sp-repo-review==2023.12.21",
25+
"validate-pyproject-schema-store==2024.1.23",
26+
"validate-pyproject[all]~=0.16.0",
2827
]}
2928
/>,
3029
);

docs/pages/guides/style.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -804,25 +804,27 @@ There are two tools, both based on JSON Schema, that you can use to validate
804804
various configuration files. The first, [validate-pyproject][], validates your
805805
`pyproject.toml` file. By default, it checks the standards-defined sections
806806
(`build-system` and `project`), along with `tool.setuptools`. There are also
807-
plugins for some other tools, like `scikit-build-core` and `cibuildwheel`. Using
808-
it looks like this:
807+
plugins for some other tools, like `scikit-build-core` and `cibuildwheel`. You
808+
can even get all [SchemaStore][]'s plugins with the
809+
[validate-pyproject-schema-store][] plugin. Using it looks like this:
809810

810811
```yaml
811812
- repo: https://github.com/abravalheri/validate-pyproject
812-
rev: v0.15
813+
rev: "v0.16"
813814
hooks:
814815
- id: validate-pyproject
816+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
815817
```
816818

817-
You can also validate various other types of files with [check-jsonschema]. It
819+
You can also validate various other types of files with [check-jsonschema][]. It
818820
supports a variety of common files built-in ([see the docs][cjs-common]) like
819821
various CI configuration files. You can also write/provide your own schemas and
820822
validate using those - [SchemaStore][] provides a few hundred different common
821823
schemas, and you can load them via URL. It work on JSON, YAML, and TOML.
822824

823825
```yaml
824826
- repo: https://github.com/python-jsonschema/check-jsonschema
825-
rev: 0.27.0
827+
rev: "0.27.3"
826828
hooks:
827829
- id: check-dependabot
828830
- id: check-github-workflows

noxfile.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ def compare_cruft(session):
362362
re.MULTILINE,
363363
)
364364

365-
PC_REPL_LINE = '''\
365+
PC_REPL_LINE = """\
366366
{2}- repo: {0}
367-
{2} rev: "{1}"'''
367+
{2} rev: {3}{1}{3}"""
368368

369369

370370
GHA_VERS = re.compile(r"[\s\-]+uses: (.*?)@([^\s]+)")
@@ -375,7 +375,7 @@ def pc_bump(session: nox.Session) -> None:
375375
"""
376376
Bump the pre-commit versions.
377377
"""
378-
session.install("lastversion")
378+
session.install("lastversion>=3.4")
379379
versions = {}
380380
pages = [
381381
Path("docs/pages/guides/style.md"),
@@ -399,11 +399,11 @@ def pc_bump(session: nox.Session) -> None:
399399
).strip()
400400
new_version = versions[proj]
401401

402-
before = PC_REPL_LINE.format(proj, old_version, space)
403-
after = PC_REPL_LINE.format(proj, new_version, space)
402+
after = PC_REPL_LINE.format(proj, new_version, space, '"')
404403

405-
session.log(f"Bump: {old_version} -> {new_version} ({page})")
406-
txt = txt.replace(before, after)
404+
session.log(f"Bump {proj}: {old_version} -> {new_version} ({page})")
405+
txt = txt.replace(PC_REPL_LINE.format(proj, old_version, space, '"'), after)
406+
txt = txt.replace(PC_REPL_LINE.format(proj, old_version, space, ""), after)
407407

408408
page.write_text(txt)
409409

{{cookiecutter.project_name}}/.pre-commit-config.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,13 @@ repos:
112112
{%- endif %}
113113

114114
- repo: https://github.com/abravalheri/validate-pyproject
115-
rev: v0.15
115+
rev: "v0.16"
116116
hooks:
117117
- id: validate-pyproject
118-
{%- if cookiecutter.backend == "skbuild" %}
119-
additional_dependencies:
120-
[scikit-build-core, cibuildwheel, tomli, packaging, trove-classifiers]
121-
{%- elif cookiecutter.__type == "compiled" %}
122-
additional_dependencies:
123-
[cibuildwheel, tomli, packaging, trove-classifiers]
124-
{%- endif %}
118+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
125119

126120
- repo: https://github.com/python-jsonschema/check-jsonschema
127-
rev: 0.27.0
121+
rev: "0.27.3"
128122
hooks:
129123
{%- if cookiecutter.__ci == "github" %}
130124
- id: check-dependabot

{{cookiecutter.project_name}}/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ version.source = "vcs"
255255
build.hooks.vcs.version-file = "src/{{ cookiecutter.__project_slug }}/_version.py"
256256
{%- endif %}
257257

258-
[tool.hatch.env.default]
258+
[tool.hatch.envs.default]
259259
features = ["test"]
260260
scripts.test = "pytest {args}"
261261

0 commit comments

Comments
 (0)