Skip to content

Instantly share code, notes, and snippets.

@gwerbin
Last active May 16, 2021 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwerbin/6f6d6085e63bc4e4168b82c23d60439e to your computer and use it in GitHub Desktop.
Save gwerbin/6f6d6085e63bc4e4168b82c23d60439e to your computer and use it in GitHub Desktop.
JSON Schema for Pipx Metadata v0.2.0, draft 00; see https://github.com/pipxproject/pipx/pull/660. The regex for package version is [not trivial](https://regex101.com/r/BbPqar/1), and is copied verbatim from [Pep 440](https://www.python.org/dev/peps/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions).
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://pipxproject.github.io/pipx/schema/pipx-metadata_v0.2.0_draft00.json",
"$defs": {
"package_name": {
"type": "string",
"pattern": "^[A-Za-z][0-9A-Za-z_-]*$"
},
"python_version": {
"type": "string",
"pattern": "Python [23]\\.[0-9]+\\.[0-9]+"
},
"package_version": {
"type": "string",
"pattern": "^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\\.post(0|[1-9][0-9]*))?(\\.dev(0|[1-9][0-9]*))?$"
},
"app_name": {
"type": "string",
"pattern": "^[A-Za-z][0-9A-Za-z_-]*$"
},
"app_path": {
"type": "object",
"properties": {
"__Path__": {
"type": "string"
},
"__type__": {
"type": "string",
"enum": ["Path"]
}
}
},
"package": {
"type": "object",
"properties": {
"package": {
"$ref": "#/$defs/package_name"
},
"package_version": {
"type": "string"
},
"package_or_url": {
"type": "string"
},
"suffix": {
"type": "string"
},
"include_apps": {
"type": "boolean"
},
"include_dependencies": {
"type": "boolean"
},
"pip_args": {
"type": "array",
"items": {
"type": "string"
}
},
"apps": {
"type": "array",
"items": {
"type": "string"
}
},
"apps_of_dependencies": {
"type": "array",
"items": {
"type": "string"
}
},
"app_paths": {
"type": "array",
"items": {
"$ref": "#/$defs/app_path"
}
},
"app_paths_of_dependencies": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/app_path"
},
"propertyNames": {
"$ref": "#/$defs"
}
}
}
}
},
"type": "object",
"properties": {
"pipx_metadata_version": {
"type": "string"
},
"python_version": {
"$ref": "#/$defs/python_version"
},
"venv_args": {
"type": "array",
"items": {
"type": "string"
}
},
"main_package": {
"$ref": "#/$defs/package"
},
"injected_packages": {
"type": "object",
"additionalProperties": {
"type": "#/$defs/package"
},
"propertyNames": {
"$ref": "#/$defs/package_name"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment