Skip to content

Instantly share code, notes, and snippets.

@syrinka
Created September 30, 2023 10:11
Show Gist options
  • Save syrinka/2ee4a681d2d82ccde64d4ed3458598be to your computer and use it in GitHub Desktop.
Save syrinka/2ee4a681d2d82ccde64d4ed3458598be to your computer and use it in GitHub Desktop.
{
"$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": 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 &lt;miss-islington@python.org&gt;'.",
"type": "string",
"pattern": "^(?:[- .,\\w\\d'’\"():&]+)(?: <(?:.+?)>)?"
},
"poetry-authors": {
"type": "array",
"description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
"items": {
"$ref": "#/definitions/poetry-author-pattern"
}
},
"poetry-maintainers": {
"type": "array",
"description": "List of maintainers, other than the original author(s), that upkeep the package.",
"items": {
"$ref": "#/definitions/poetry-author-pattern"
}
},
"poetry-include-path": {
"type": "string",
"description": "Path to file or directory to include."
},
"poetry-package-format": {
"type": "string",
"enum": [
"sdist",
"wheel"
],
"description": "A Python packaging format."
},
"poetry-package-formats": {
"oneOf": [
{
"$ref": "#/definitions/poetry-package-format"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/poetry-package-format"
}
}
],
"description": "The format(s) for which the package must be included."
},
"poetry-dependency-any": {
"oneOf": [
{
"$ref": "#/definitions/poetry-dependency"
},
{
"$ref": "#/definitions/poetry-long-dependency"
},
{
"$ref": "#/definitions/poetry-git-dependency"
},
{
"$ref": "#/definitions/poetry-file-dependency"
},
{
"$ref": "#/definitions/poetry-path-dependency"
},
{
"$ref": "#/definitions/poetry-url-dependency"
},
{
"$ref": "#/definitions/poetry-multiple-constraints-dependency"
}
]
},
"poetry-pep440-version": {
"type": "string",
"description": "A version constraint. Validates against the PEP 440's version pattern."
},
"poetry-dependency": {
"$ref": "#/definitions/poetry-pep440-version"
},
"poetry-long-dependency": {
"type": "object",
"required": [
"version"
],
"additionalProperties": false,
"properties": {
"version": {
"$ref": "#/definitions/poetry-pep440-version"
},
"python": {
"type": "string",
"description": "The python versions for which the dependency should be installed."
},
"platform": {
"type": "string",
"description": "The platform(s) for which the dependency should be installed."
},
"markers": {
"type": "string",
"description": "The PEP 508 compliant environment markers for which the dependency should be installed."
},
"allow-prereleases": {
"type": "boolean",
"description": "Whether the dependency allows prereleases or not."
},
"allows-prereleases": {
"type": "boolean",
"description": "Whether the dependency allows prereleases or not."
},
"optional": {
"type": "boolean",
"description": "Whether the dependency is optional or not."
},
"extras": {
"type": "array",
"description": "The required extras for this dependency.",
"items": {
"type": "string"
}
},
"source": {
"type": "string",
"description": "The exclusive source used to search for this dependency."
}
}
},
"poetry-git-dependency": {
"type": "object",
"required": [
"git"
],
"additionalProperties": false,
"properties": {
"git": {
"type": "string",
"description": "The url of the git repository.",
"format": "uri"
},
"branch": {
"type": "string",
"description": "The branch to checkout."
},
"tag": {
"type": "string",
"description": "The tag to checkout."
},
"rev": {
"type": "string",
"description": "The revision to checkout."
},
"subdirectory": {
"type": "string",
"description": "The relative path to the directory where the package is located."
},
"python": {
"type": "string",
"description": "The python versions for which the dependency should be installed."
},
"platform": {
"type": "string",
"description": "The platform(s) for which the dependency should be installed."
},
"markers": {
"type": "string",
"description": "The PEP 508 compliant environment markers for which the dependency should be installed."
},
"allow-prereleases": {
"type": "boolean",
"description": "Whether the dependency allows prereleases or not."
},
"allows-prereleases": {
"type": "boolean",
"description": "Whether the dependency allows prereleases or not."
},
"optional": {
"type": "boolean",
"description": "Whether the dependency is optional or not."
},
"extras": {
"type": "array",
"description": "The required extras for this dependency.",
"items": {
"type": "string"
}
},
"develop": {
"type": "boolean",
"description": "Whether to install the dependency in development mode."
}
}
},
"poetry-file-dependency": {
"type": "object",
"required": [
"file"
],
"additionalProperties": false,
"properties": {
"file": {
"type": "string",
"description": "The path to the file."
},
"python": {
"type": "string",
"description": "The python versions for which the dependency should be installed."
},
"platform": {
"type": "string",
"description": "The platform(s) for which the dependency should be installed."
},
"markers": {
"type": "string",
"description": "The PEP 508 compliant environment markers for which the dependency should be installed."
},
"optional": {
"type": "boolean",
"description": "Whether the dependency is optional or not."
},
"extras": {
"type": "array",
"description": "The required extras for this dependency.",
"items": {
"type": "string"
}
}
}
},
"poetry-path-dependency": {
"type": "object",
"required": [
"path"
],
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "The path to the dependency."
},
"python": {
"type": "string",
"description": "The python versions for which the dependency should be installed."
},
"platform": {
"type": "string",
"description": "The platform(s) for which the dependency should be installed."
},
"markers": {
"type": "string",
"description": "The PEP 508 compliant environment markers for which the dependency should be installed."
},
"optional": {
"type": "boolean",
"description": "Whether the dependency is optional or not."
},
"extras": {
"type": "array",
"description": "The required extras for this dependency.",
"items": {
"type": "string"
}
},
"develop": {
"type": "boolean",
"description": "Whether to install the dependency in development mode."
}
}
},
"poetry-url-dependency": {
"type": "object",
"required": [
"url"
],
"additionalProperties": false,
"properties": {
"url": {
"type": "string",
"description": "The url to the file."
},
"python": {
"type": "string",
"description": "The python versions for which the dependency should be installed."
},
"platform": {
"type": "string",
"description": "The platform(s) for which the dependency should be installed."
},
"markers": {
"type": "string",
"description": "The PEP 508 compliant environment markers for which the dependency should be installed."
},
"optional": {
"type": "boolean",
"description": "Whether the dependency is optional or not."
},
"extras": {
"type": "array",
"description": "The required extras for this dependency.",
"items": {
"type": "string"
}
}
}
},
"poetry-multiple-constraints-dependency": {
"type": "array",
"minItems": 1,
"items": {
"oneOf": [
{
"$ref": "#/definitions/poetry-dependency"
},
{
"$ref": "#/definitions/poetry-long-dependency"
},
{
"$ref": "#/definitions/poetry-git-dependency"
},
{
"$ref": "#/definitions/poetry-file-dependency"
},
{
"$ref": "#/definitions/poetry-path-dependency"
},
{
"$ref": "#/definitions/poetry-url-dependency"
}
]
}
},
"poetry-script-table": {
"type": "object",
"oneOf": [
{
"$ref": "#/definitions/poetry-extra-script-legacy"
},
{
"$ref": "#/definitions/poetry-extra-scripts"
}
]
},
"poetry-script-legacy": {
"type": "string",
"description": "A simple script pointing to a callable object."
},
"poetry-extra-scripts": {
"type": "object",
"description": "Either a console entry point or a script file that'll be included in the distribution package.",
"additionalProperties": false,
"properties": {
"reference": {
"type": "string",
"description": "If type is file this is the relative path of the script file, if console it is the module name."
},
"type": {
"description": "Value can be either file or console.",
"type": "string",
"enum": [
"file",
"console"
]
},
"extras": {
"type": "array",
"description": "The required extras for this script. Only applicable if type is console.",
"items": {
"type": "string"
}
}
},
"required": [
"reference",
"type"
]
},
"poetry-extra-script-legacy": {
"type": "object",
"description": "A script that should be installed only if extras are activated.",
"additionalProperties": false,
"properties": {
"callable": {
"$ref": "#/definitions/poetry-script-legacy",
"description": "The entry point of the script. Deprecated in favour of reference."
},
"extras": {
"type": "array",
"description": "The required extras for this script.",
"items": {
"type": "string"
}
}
}
},
"poetry-build-script": {
"type": "string",
"description": "The python script file used to build extensions."
},
"poetry-build-config": {
"type": "object",
"description": "Build specific configurations.",
"additionalProperties": false,
"properties": {
"generate-setup-file": {
"type": "boolean",
"description": "Generate and include a setup.py file in sdist.",
"default": true
},
"script": {
"$ref": "#/definitions/poetry-build-script"
}
}
},
"poetry-build-section": {
"oneOf": [
{
"$ref": "#/definitions/poetry-build-script"
},
{
"$ref": "#/definitions/poetry-build-config"
}
]
},
"BuildSystem": {
"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": {
"key": "https://www.python.org/dev/peps/pep-0518/#build-system-table"
}
},
"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": {
"type": "string"
},
"x-taplo": {
"links": {
"key": "https://www.python.org/dev/peps/pep-0518/#build-system-table"
}
},
"examples": [
"setuptools >= 64.0"
]
},
"build-backend": {
"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"
}
}
}
}
},
"properties": {
"build-system": {
"$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": {
"type": "object"
},
"x-taplo": {
"links": {
"key": "https://www.python.org/dev/peps/pep-0518/#id28"
}
},
"properties": {
"ruff": {
"$ref": "https://json.schemastore.org/ruff.json"
},
"pyright": {
"$ref": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json"
},
"poetry": {
"type": "object",
"additionalProperties": true,
"required": [
"name",
"version",
"description",
"authors"
],
"properties": {
"name": {
"type": "string",
"description": "Package name."
},
"version": {
"type": "string",
"description": "Version of the package. It should follow semantic versioning, but it is not enforced."
},
"description": {
"type": "string",
"description": "Short package description.",
"pattern": "^[^\n]*$"
},
"keywords": {
"type": "array",
"items": {
"type": "string",
"description": "A tag/keyword that this package relates to."
}
},
"homepage": {
"type": "string",
"description": "Homepage URL for the project.",
"format": "uri"
},
"repository": {
"type": "string",
"description": "Repository URL for the project.",
"format": "uri"
},
"documentation": {
"type": "string",
"description": "Documentation URL for the project.",
"format": "uri"
},
"license": {
"type": "string",
"description": "License name."
},
"authors": {
"$ref": "#/definitions/poetry-authors"
},
"maintainers": {
"$ref": "#/definitions/poetry-maintainers"
},
"readme": {
"anyOf": [
{
"type": "string",
"description": "The path to the README file."
},
{
"type": "array",
"description": "A list of paths to the readme files.",
"items": {
"type": "string"
}
}
]
},
"classifiers": {
"type": "array",
"description": "A list of trove classifers."
},
"packages": {
"type": "array",
"description": "A list of packages to include in the final distribution.",
"items": {
"type": "object",
"description": "Information about where the package resides.",
"additionalProperties": false,
"required": [
"include"
],
"properties": {
"include": {
"$ref": "#/definitions/poetry-include-path"
},
"from": {
"type": "string",
"description": "Where the source directory of the package resides."
},
"format": {
"$ref": "#/definitions/poetry-package-formats"
}
}
}
},
"include": {
"type": "array",
"description": "A list of files and folders to include.",
"items": {
"anyOf": [
{
"$ref": "#/definitions/poetry-include-path"
},
{
"type": "object",
"additionalProperties": false,
"required": [
"path"
],
"properties": {
"path": {
"$ref": "#/definitions/poetry-include-path"
},
"format": {
"$ref": "#/definitions/poetry-package-formats"
}
}
}
]
}
},
"exclude": {
"type": "array",
"description": "A list of files and folders to exclude."
},
"dependencies": {
"type": "object",
"description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
"required": [
"python"
],
"properties": {
"python": {
"type": "string",
"description": "The Python versions the package is compatible with.",
"$ref": "#/definitions/poetry-dependency"
}
},
"patternProperties": {
"^(?!python$)[a-zA-Z-_.0-9]+$": {
"$ref": "#/definitions/poetry-dependency-any"
}
}
},
"dev-dependencies": {
"type": "object",
"description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
"patternProperties": {
"^[a-zA-Z-_.0-9]+$": {
"$ref": "#/definitions/poetry-dependency-any"
}
}
},
"extras": {
"type": "object",
"patternProperties": {
"^[a-zA-Z-_.0-9]+$": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"group": {
"type": "object",
"description": "This represents groups of dependencies",
"patternProperties": {
"^[a-zA-Z-_.0-9]+$": {
"type": "object",
"description": "This represents a single dependency group",
"required": [
"dependencies"
],
"properties": {
"optional": {
"type": "boolean",
"description": "Whether the dependency group is optional or not"
},
"dependencies": {
"type": "object",
"description": "The dependencies of this dependency group",
"patternProperties": {
"^[a-zA-Z-_.0-9]+$": {
"$ref": "#/definitions/poetry-dependency-any"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
}
},
"build": {
"$ref": "#/definitions/poetry-build-section"
},
"scripts": {
"type": "object",
"description": "A hash of scripts to be installed.",
"patternProperties": {
"^[a-zA-Z-_.0-9]+$": {
"oneOf": [
{
"$ref": "#/definitions/poetry-script-legacy"
},
{
"$ref": "#/definitions/poetry-script-table"
}
]
}
}
},
"plugins": {
"type": "object",
"description": "A hash of hashes representing plugins",
"patternProperties": {
"^[a-zA-Z-_.0-9]+$": {
"type": "object",
"patternProperties": {
"^[a-zA-Z-_.0-9]+$": {
"type": "string"
}
}
}
}
},
"urls": {
"type": "object",
"patternProperties": {
"^.+$": {
"type": "string",
"description": "The full url of the custom url."
}
}
}
}
}
},
"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": "^v?((([0-9]+)!)?([0-9]+(\\.[0-9]+)*)([-_\\.]?(alpha|a|beta|b|preview|pre|c|rc)[-_\\.]?([0-9]+)?)?((-([0-9]+))|([-_\\.]?(post|rev|r)[-_\\.]?([0-9]+)?))?([-_\\.]?(dev)[-_\\.]?([0-9]+)?)?)(\\+([a-z0-9]+([-_\\.][a-z0-9]+)*))?$",
"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",
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"required": [
"file"
],
"properties": {
"file": {
"title": "License file path",
"type": "string"
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": [
"text"
],
"properties": {
"text": {
"title": "License text",
"type": "string"
}
}
},
{
"type": "string",
"description": "A SPDX license identifier"
}
],
"examples": [
{
"text": "MIT"
},
{
"file": "LICENSE"
},
"MIT",
"LicenseRef-Proprietary"
]
},
"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",
"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"
}
}
}
}
}
}
}
},
"title": "JSON schema for Python project metadata and configuration",
"type": "object",
"x-taplo-info": {
"authors": [
"zevisert (https://github.com/zevisert)"
],
"pattern": [
"^(.*(/|\\\\)pyproject\\.toml|pyproject\\.toml)$"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment