Skip to content

Commit

Permalink
feat: modify schema and fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Nov 29, 2024
1 parent 2c600e3 commit 5b52a98
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::{
};

const DEFAULT_BUILD_TOOL: &str = "pixi-build-rattler-build";
const DEFAULT_CHANNEL: &str = "https://prefix.dev/pixi-build-backends";

#[derive(Debug, Error, Diagnostic)]
pub enum FinishError {
Expand Down
5 changes: 2 additions & 3 deletions examples/boltons/pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ version = "0.1.0"


[build-system]
build-backend = "pixi-build-rattler-build"
build-backend = { name = "pixi-build-rattler-build", version = "*"}
channels = [
"https://repo.prefix.dev/pixi-build-backends",
"https://fast.prefix.dev/conda-forge",
]
dependencies = ["pixi-build-rattler-build"]
]
8 changes: 4 additions & 4 deletions examples/cpp-sdl/pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions examples/cpp-sdl/pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ name = "sdl_example"
version = "0.1.0"

[build-system]
build-backend = "pixi-build-cmake"
build-backend = { name = "pixi-build-cmake", version = "*" }
channels = [
"https://prefix.dev/pixi-build-backends",
"https://prefix.dev/conda-forge",
]
dependencies = ["pixi-build-cmake"]

[tasks.start]
cmd = "sdl_example"
Expand Down
3 changes: 1 addition & 2 deletions examples/flask-hello-world/pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ name = "flask-hello-world"
version = "0.1.0"

[build-system]
build-backend = "pixi-build-python"
build-backend = { name = "pixi-build-python", version = "*" }
channels = [
"https://fast.prefix.dev/pixi-build-backends",
"https://fast.prefix.dev/conda-forge",
]
dependencies = ["pixi-build-python"]
15 changes: 7 additions & 8 deletions schema/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,15 @@ class MatchspecTable(StrictBaseModel):
# The Build section #
#####################
class BuildSystem(StrictBaseModel):
channels: list[Channel] = Field(
None,
description="The `conda` channels that will be used to get build dependencies",
)
dependencies: list[MatchSpec] = Field(
None, description="The dependencies for the build backend"
)
build_backend: NonEmptyStr = Field(None, description="The build executable to call")
build_backend: BuildBackend = Field(..., description="The build backend to instantiate")
channels: list[Channel] = Field(
None, description="The `conda` channels that are used to fetch the build backend from"
)
additional_dependencies: Dependencies = Field(None, description="Additional dependencies to install alongside the build backend")


class BuildBackend(MatchspecTable):
name: NonEmptyStr = Field(None, description="The name of the build backend package")


class _PyPIRequirement(StrictBaseModel):
Expand Down Expand Up @@ -610,6 +608,7 @@ class Config:
dependencies: Dependencies = DependenciesField
host_dependencies: Dependencies = HostDependenciesField
build_dependencies: Dependencies = BuildDependenciesField
run_dependencies: Dependencies = Field(None,description="The run-dependencies for the [package]")
pypi_dependencies: dict[PyPIPackageName, PyPIRequirement] | None = Field(
None, description="The PyPI dependencies"
)
Expand Down
159 changes: 139 additions & 20 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,22 @@
"$ref": "#/$defs/PyPIOptions",
"description": "Options related to PyPI indexes, on the default feature"
},
"run-dependencies": {
"title": "Run-Dependencies",
"description": "The run-dependencies for the [package]",
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "string",
"minLength": 1
},
{
"$ref": "#/$defs/MatchspecTable"
}
]
}
},
"system-requirements": {
"$ref": "#/$defs/SystemRequirements",
"description": "The system requirements of the project"
Expand Down Expand Up @@ -246,41 +262,139 @@
}
}
},
"BuildSystem": {
"title": "BuildSystem",
"BuildBackend": {
"title": "BuildBackend",
"type": "object",
"additionalProperties": false,
"properties": {
"build-backend": {
"title": "Build-Backend",
"description": "The build executable to call",
"branch": {
"title": "Branch",
"description": "A git branch to use",
"type": "string",
"minLength": 1
},
"channels": {
"title": "Channels",
"description": "The `conda` channels that are used to fetch the build backend from",
"type": "array",
"items": {
"build": {
"title": "Build",
"description": "The build string of the package",
"type": "string",
"minLength": 1
},
"build-number": {
"title": "Build-Number",
"description": "The build number of the package, can be a spec like `>=1` or `<=10` or `1`",
"type": "string",
"minLength": 1
},
"channel": {
"title": "Channel",
"description": "The channel the packages needs to be fetched from",
"type": "string",
"minLength": 1,
"examples": [
"conda-forge",
"pytorch",
"https://repo.prefix.dev/conda-forge"
]
},
"file-name": {
"title": "File-Name",
"description": "The file name of the package",
"type": "string",
"minLength": 1
},
"git": {
"title": "Git",
"description": "The git URL to the repo",
"type": "string",
"minLength": 1
},
"md5": {
"title": "Md5",
"description": "The md5 hash of the package",
"type": "string",
"pattern": "^[a-fA-F0-9]{32}$"
},
"name": {
"title": "Name",
"description": "The name of the build backend package",
"type": "string",
"minLength": 1
},
"path": {
"title": "Path",
"description": "The path to the package",
"type": "string",
"minLength": 1
},
"rev": {
"title": "Rev",
"description": "A git SHA revision to use",
"type": "string",
"minLength": 1
},
"sha256": {
"title": "Sha256",
"description": "The sha256 hash of the package",
"type": "string",
"pattern": "^[a-fA-F0-9]{64}$"
},
"subdir": {
"title": "Subdir",
"description": "The subdir of the package, also known as platform",
"type": "string",
"minLength": 1
},
"tag": {
"title": "Tag",
"description": "A git tag to use",
"type": "string",
"minLength": 1
},
"url": {
"title": "Url",
"description": "The URL to the package",
"type": "string",
"minLength": 1
},
"version": {
"title": "Version",
"description": "The version of the package in [MatchSpec](https://github.com/conda/conda/blob/078e7ee79381060217e1ec7f9b0e9cf80ecc8f3f/conda/models/match_spec.py) format",
"type": "string",
"minLength": 1
}
}
},
"BuildSystem": {
"title": "BuildSystem",
"type": "object",
"required": [
"build-backend"
],
"additionalProperties": false,
"properties": {
"additional-dependencies": {
"title": "Additional-Dependencies",
"description": "Additional dependencies to install alongside the build backend",
"type": "object",
"additionalProperties": {
"anyOf": [
{
"type": "string",
"minLength": 1
},
{
"type": "string",
"format": "uri",
"minLength": 1
},
{
"$ref": "#/$defs/ChannelInlineTable"
"$ref": "#/$defs/MatchspecTable"
}
]
}
},
"dependencies": {
"title": "Dependencies",
"description": "The dependencies for the build backend",
"build-backend": {
"$ref": "#/$defs/BuildBackend",
"description": "The build backend to instantiate"
},
"channels": {
"title": "Channels",
"description": "The `conda` channels that are used to fetch the build backend from",
"type": "array",
"items": {
"anyOf": [
Expand All @@ -289,7 +403,12 @@
"minLength": 1
},
{
"$ref": "#/$defs/MatchspecTable"
"type": "string",
"format": "uri",
"minLength": 1
},
{
"$ref": "#/$defs/ChannelInlineTable"
}
]
}
Expand Down

0 comments on commit 5b52a98

Please sign in to comment.