mirror of
https://github.com/chenasraf/schemastore.git
synced 2026-05-17 17:58:02 +00:00
Add PEP 621 to pyproject.toml schema (#2379)
* Add pyproject.toml schema * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Convert PyProject tests to TOML * Add pyproject.toml negative tests * Disable 'PyProject' use on pyproject.toml * Merge with Taplo pyproject.toml schema Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
13
src/negative_test/pyproject/dynamic-version-specified.toml
Normal file
13
src/negative_test/pyproject/dynamic-version-specified.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[build-system]
|
||||
build-backend = "setuptools.build_meta"
|
||||
requires = [
|
||||
"setuptools >= 64.0",
|
||||
"setuptools-scm[toml] >= 6.2",
|
||||
"wheel",
|
||||
]
|
||||
|
||||
[project]
|
||||
name = "dynamic-package"
|
||||
version = "v42.0.1"
|
||||
description = "An example dynamic package"
|
||||
dynamic = ["version"]
|
||||
14
src/negative_test/pyproject/extra-top-level.toml
Normal file
14
src/negative_test/pyproject/extra-top-level.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
[build-system]
|
||||
build-backend = "setuptools.build_meta"
|
||||
requires = [
|
||||
"setuptools >= 64.0",
|
||||
"wheel",
|
||||
]
|
||||
|
||||
[project]
|
||||
name = "dynamic-package"
|
||||
version = "v42.0.1"
|
||||
description = "An example dynamic package"
|
||||
|
||||
[custom-data]
|
||||
comment = "This table is not allowed"
|
||||
10
src/negative_test/pyproject/version-unspecified.toml
Normal file
10
src/negative_test/pyproject/version-unspecified.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[build-system]
|
||||
build-backend = "setuptools.build_meta"
|
||||
requires = [
|
||||
"setuptools >= 64.0",
|
||||
"wheel",
|
||||
]
|
||||
|
||||
[project]
|
||||
name = "dynamic-package"
|
||||
description = "An example dynamic package"
|
||||
@@ -1,7 +1,38 @@
|
||||
{
|
||||
"$comment": "there are multiple resources describing pyproject.toml. The canonical reference is at https://packaging.python.org/en/latest/specifications/declaring-project-metadata/, which refers to multiple proposals such as PEP 517, PEP 518 and PEP 621",
|
||||
"$id": "https://json.schemastore.org/pyproject.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"additionalProperties": true,
|
||||
"additionalProperties": false,
|
||||
"definitions": {
|
||||
"projectAuthor": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"anyOf": [
|
||||
{
|
||||
"required": ["name"],
|
||||
"properties": {
|
||||
"name": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"required": ["email"],
|
||||
"properties": {
|
||||
"email": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"title": "Author name",
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"title": "Author email",
|
||||
"type": "string",
|
||||
"format": "email"
|
||||
}
|
||||
}
|
||||
},
|
||||
"poetry-author-pattern": {
|
||||
"description": "Pattern that matches `Name <email>` like 'King Arthur' or 'Miss Islington <miss-islington@python.org>'.",
|
||||
"type": "string",
|
||||
@@ -345,7 +376,8 @@
|
||||
}
|
||||
},
|
||||
"BuildSystem": {
|
||||
"title": "Build System",
|
||||
"title": "Project build system configuration",
|
||||
"$comment": "see PEP 517 (https://peps.python.org/pep-0517/) and PEP 518 (https://peps.python.org/pep-0518/)",
|
||||
"type": "object",
|
||||
"x-taplo": {
|
||||
"links": {
|
||||
@@ -353,9 +385,11 @@
|
||||
}
|
||||
},
|
||||
"description": "Build-related data.\n",
|
||||
"additionalProperties": false,
|
||||
"required": ["requires"],
|
||||
"properties": {
|
||||
"requires": {
|
||||
"title": "Build system dependencies",
|
||||
"description": "A list of strings representing [PEP 508](https://www.python.org/dev/peps/pep-0508) dependencies required to execute the build system.\n",
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -365,15 +399,26 @@
|
||||
"links": {
|
||||
"key": "https://www.python.org/dev/peps/pep-0518/#build-system-table"
|
||||
}
|
||||
}
|
||||
},
|
||||
"examples": ["setuptools >= 64.0"]
|
||||
},
|
||||
"build-backend": {
|
||||
"description": "The build backend for the package.\n",
|
||||
"title": "Build backend",
|
||||
"description": "Python path to project's build backend",
|
||||
"type": "string",
|
||||
"x-taplo": {
|
||||
"links": {
|
||||
"key": "https://www.python.org/dev/peps/pep-0517/"
|
||||
}
|
||||
},
|
||||
"examples": ["setuptools.build_meta", "my_build_backend:backend"]
|
||||
},
|
||||
"backend-path": {
|
||||
"title": "Build backend directories",
|
||||
"description": "paths to prepend to 'sys.path' when loading the build backend, relative to project root",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -384,9 +429,12 @@
|
||||
"$ref": "#/definitions/BuildSystem"
|
||||
},
|
||||
"tool": {
|
||||
"title": "Tool-specific configuration",
|
||||
"type": "object",
|
||||
"description": "A table for tool configurations.\n\nEvery tool that is used by the project can have its own sub-table for its configuration.\n",
|
||||
"additionalProperties": true,
|
||||
"additionalProperties": {
|
||||
"type": "object"
|
||||
},
|
||||
"x-taplo": {
|
||||
"links": {
|
||||
"key": "https://www.python.org/dev/peps/pep-0518/#id28"
|
||||
@@ -572,6 +620,499 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"tool": {
|
||||
"isort": {
|
||||
"profile": "black"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"project": {
|
||||
"title": "Project metadata",
|
||||
"$comment": "see PEP 621 (https://peps.python.org/pep-0621/)",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["name"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"title": "Project name",
|
||||
"type": "string",
|
||||
"pattern": "^([a-zA-Z\\d]|[a-zA-Z\\d][\\w.-]*[a-zA-Z\\d])$"
|
||||
},
|
||||
"version": {
|
||||
"title": "Project version",
|
||||
"type": "string",
|
||||
"pattern": "^([1-9]\\d*!)?(0|[1-9]\\d*)(\\.(0|[1-9]\\d*))*((a|b|rc)(0|[1-9]\\d*))?(\\.post(0|[1-9]\\d*))?(\\.dev(0|[1-9]\\d*))?$",
|
||||
"examples": ["42.0.1", "0.3.9rc7.post0.dev5"]
|
||||
},
|
||||
"description": {
|
||||
"title": "Project summary description",
|
||||
"type": "string"
|
||||
},
|
||||
"readme": {
|
||||
"title": "Project full description",
|
||||
"description": "AKA the README",
|
||||
"oneOf": [
|
||||
{
|
||||
"title": "README file path",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["content-type"],
|
||||
"properties": {
|
||||
"content-type": {
|
||||
"title": "README text content-type",
|
||||
"description": "RFC 1341 compliant content-type (with optional charset, defaulting to UTF-8)",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"required": ["file"],
|
||||
"properties": {
|
||||
"content-type": true,
|
||||
"file": {
|
||||
"title": "README file path",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"required": ["text"],
|
||||
"properties": {
|
||||
"content-type": true,
|
||||
"text": {
|
||||
"title": "README text",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"examples": [
|
||||
"README.md",
|
||||
{
|
||||
"file": "README.txt",
|
||||
"content-type": "text/plain"
|
||||
},
|
||||
{
|
||||
"text": "# Example project\n\nAn example project",
|
||||
"content-type": "text/markdown"
|
||||
}
|
||||
]
|
||||
},
|
||||
"requires-python": {
|
||||
"title": "Python version compatibility",
|
||||
"type": "string",
|
||||
"examples": [">= 3.7"]
|
||||
},
|
||||
"license": {
|
||||
"title": "Project license",
|
||||
"type": "object",
|
||||
"oneOf": [
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"required": ["file"],
|
||||
"properties": {
|
||||
"file": {
|
||||
"title": "License file path",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"required": ["text"],
|
||||
"properties": {
|
||||
"text": {
|
||||
"title": "License text",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"examples": [
|
||||
{
|
||||
"text": "MIT"
|
||||
},
|
||||
{
|
||||
"file": "LICENSE"
|
||||
}
|
||||
]
|
||||
},
|
||||
"authors": {
|
||||
"title": "Project authors",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/projectAuthor"
|
||||
}
|
||||
},
|
||||
"maintainers": {
|
||||
"title": "Project maintainers",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/projectAuthor"
|
||||
}
|
||||
},
|
||||
"keywords": {
|
||||
"title": "Project keywords",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"classifiers": {
|
||||
"title": "Applicable Trove classifiers",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"urls": {
|
||||
"title": "Project URLs",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"homepage": "https://example.com/example-project"
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"title": "Console scripts",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"mycmd": "package.module:object.function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"gui-scripts": {
|
||||
"title": "GUI scripts",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"mycmd": "package.module:object.function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"entry-points": {
|
||||
"title": "Other entry-point groups",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^\\w+(\\.\\w+)*$": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"propertyNames": {
|
||||
"not": {
|
||||
"anyOf": [
|
||||
{
|
||||
"const": "console_scripts"
|
||||
},
|
||||
{
|
||||
"const": "gui_scripts"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"pygments.styles": {
|
||||
"monokai": "package.module:object.attribute"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"title": "Project dependency requirements",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": [["attrs", "requests ~= 2.28"]]
|
||||
},
|
||||
"optional-dependencies": {
|
||||
"title": "Project extra dependency requirements",
|
||||
"description": "keys are extra names",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"patternProperties": {
|
||||
"^([a-z\\d]|[a-z\\d]([a-z\\d-](?!--))*[a-z\\d])$": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"typing": ["boto3-stubs", "typing-extensions ~= 4.1"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"dynamic": {
|
||||
"title": "Dynamic metadata values",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"version",
|
||||
"description",
|
||||
"readme",
|
||||
"requires-python",
|
||||
"license",
|
||||
"authors",
|
||||
"maintainers",
|
||||
"keywords",
|
||||
"classifiers",
|
||||
"urls",
|
||||
"scripts",
|
||||
"gui-scripts",
|
||||
"entry-points",
|
||||
"dependencies",
|
||||
"optional-dependencies"
|
||||
]
|
||||
},
|
||||
"examples": [["version"]]
|
||||
}
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "version"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"required": ["version"],
|
||||
"properties": {
|
||||
"version": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"version": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "version"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "description"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"readme": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "readme"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"requires-python": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "requires-python"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"license": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "license"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"authors": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "authors"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"maintainers": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "maintainers"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"keywords": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "keywords"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"classifiers": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "classifiers"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"urls": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "urls"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "scripts"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gui-scripts": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "gui-scripts"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entry-points": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "entry-points"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "dependencies"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional-dependencies": {
|
||||
"not": {
|
||||
"required": ["dynamic"],
|
||||
"properties": {
|
||||
"dynamic": {
|
||||
"type": "array",
|
||||
"contains": {
|
||||
"const": "optional-dependencies"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"build-system": {
|
||||
"build-backend": "setuptools.build_meta",
|
||||
"requires": ["setuptools >= 64.0", "setuptools-scm[toml] >= 6.2", "wheel"]
|
||||
},
|
||||
"project": {
|
||||
"name": "dynamic-package",
|
||||
"description": "An example dynamic package",
|
||||
"dynamic": ["version"]
|
||||
}
|
||||
}
|
||||
12
src/test/pyproject/dynamic.toml
Normal file
12
src/test/pyproject/dynamic.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[build-system]
|
||||
build-backend = "setuptools.build_meta"
|
||||
requires = [
|
||||
"setuptools >= 64.0",
|
||||
"setuptools-scm[toml] >= 6.2",
|
||||
"wheel",
|
||||
]
|
||||
|
||||
[project]
|
||||
name = "dynamic-package"
|
||||
description = "An example dynamic package"
|
||||
dynamic = ["version"]
|
||||
@@ -1,50 +0,0 @@
|
||||
{
|
||||
"build-system": {
|
||||
"build-backend": "setuptools.build_meta",
|
||||
"requires": ["setuptools >= 64.0", "wheel"]
|
||||
},
|
||||
"project": {
|
||||
"name": "typical-project",
|
||||
"version": "42.0.1",
|
||||
"description": "An example typical project",
|
||||
"readme": "README.md",
|
||||
"keywords": ["example", "models"],
|
||||
"urls": {
|
||||
"homepage": "https://example.com/typical-project"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "John Smith",
|
||||
"email": "john@example.com"
|
||||
}
|
||||
],
|
||||
"license": {
|
||||
"text": "MIT"
|
||||
},
|
||||
"classifiers": [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Operating System :: OS Independent"
|
||||
],
|
||||
"requires-python": ">= 3.7",
|
||||
"dependencies": ["attrs", "requests ~= 2.28", "typing-extensions ~= 4.1"]
|
||||
},
|
||||
"tool": {
|
||||
"setuptools": {
|
||||
"package-dir": {
|
||||
"": "src"
|
||||
},
|
||||
"packages": {
|
||||
"find": {
|
||||
"namespaces": false,
|
||||
"where": "src"
|
||||
}
|
||||
}
|
||||
},
|
||||
"isort": {
|
||||
"profile": "black"
|
||||
}
|
||||
}
|
||||
}
|
||||
33
src/test/pyproject/simple.toml
Normal file
33
src/test/pyproject/simple.toml
Normal file
@@ -0,0 +1,33 @@
|
||||
["build-system"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
requires = ["setuptools >= 64.0", "wheel"]
|
||||
|
||||
["project"]
|
||||
name = "typical-project"
|
||||
version = "42.0.1"
|
||||
description = "An example typical project"
|
||||
readme = "README.md"
|
||||
keywords = ["example", "models"]
|
||||
urls.homepage = "https://example.com/typical-project"
|
||||
authors = [{ name = "John Smith", email = "john@example.com" }]
|
||||
license = { "text" = "MIT" }
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
|
||||
requires-python = ">= 3.7"
|
||||
dependencies = ["attrs", "requests ~= 2.28", "typing-extensions ~= 4.1"]
|
||||
|
||||
[tool.setuptools]
|
||||
package-dir = { "" = "src" }
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
namespaces = false
|
||||
where = "src"
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
Reference in New Issue
Block a user