-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add variant schema #10
Open
swarnimarun
wants to merge
5
commits into
prefix-dev:main
Choose a base branch
from
swarnimarun:feat/variantschema
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# yaml-language-server: $schema=../../variant_schema.json | ||
|
||
python: | ||
- "3.11.* *cpython" | ||
# - "3.12.* *cpython" | ||
# - "3.9.* *cpython" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# yaml-language-server: $schema=../variant_schema.json | ||
|
||
zip_keys: | ||
- if: not win | ||
then: | ||
- c_compiler_version | ||
- cxx_compiler_version | ||
- fortran_compiler_version | ||
- docker_image | ||
- | ||
- cudnn | ||
- cuda_compiler_version | ||
- | ||
- python | ||
- numpy | ||
- python_impl | ||
- | ||
- arrow_cpp | ||
- libarrow | ||
|
||
pin_run_as_build: | ||
# boost is special, see https://github.com/conda-forge/boost-cpp-feedstock/pull/82 | ||
boost: | ||
max_pin: x.x.x | ||
boost-cpp: | ||
max_pin: x.x.x | ||
# TODO: add run_exports to the following feedstocks | ||
flann: | ||
max_pin: x.x.x | ||
graphviz: | ||
max_pin: x | ||
libsvm: | ||
max_pin: x | ||
netcdf-cxx4: | ||
max_pin: x.x | ||
occt: | ||
max_pin: x.x | ||
poppler: | ||
max_pin: x.x | ||
r-base: | ||
max_pin: x.x | ||
min_pin: x.x | ||
vlfeat: | ||
max_pin: x.x.x | ||
|
||
# Pinning packages | ||
|
||
# blas | ||
libblas: | ||
- 3.9 *netlib | ||
libcblas: | ||
- 3.9 *netlib | ||
liblapack: | ||
- 3.9 *netlib | ||
liblapacke: | ||
- 3.9 *netlib | ||
blas_impl: | ||
- openblas | ||
- mkl # [x86 or x86_64] | ||
- blis # [x86 or x86_64] | ||
|
||
# this output was dropped as of libabseil 20230125 | ||
abseil_cpp: | ||
- '20220623.0' | ||
alsa_lib: | ||
- 1.2.8 | ||
arb: | ||
- '2.23' | ||
arpack: | ||
- '3.7' | ||
# keep in sync with libarrow | ||
arrow_cpp: | ||
- 11.0.0 | ||
- 10.0.1 | ||
- 9.0.0 | ||
- 8.0.1 | ||
assimp: | ||
- 5.2.5 | ||
aws-sdk-cpp: "4.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import json | ||
from typing import Generic, TypeVar, Union | ||
|
||
from pydantic import BaseModel, Field, TypeAdapter | ||
|
||
T = TypeVar("T") | ||
ConditionalList = Union[T, "IfStatement[T]", list[Union[T, "IfStatement[T]"]]] | ||
|
||
|
||
class IfStatement(BaseModel, Generic[T]): | ||
expr: str = Field(..., alias="if") | ||
then: T | list[T] | ||
otherwise: T | list[T] | None = Field(None, alias="else") | ||
|
||
|
||
class MinPin(BaseModel): | ||
min_pin: str | None = Field( | ||
default=None, description="Defaults to x.x.x.x.x for pin, change to make less specific" | ||
) | ||
|
||
|
||
class MaxPin(BaseModel): | ||
max_pin: str | None = Field( | ||
default=None, description="Defaults to x for pin, change to make more specific" | ||
) | ||
|
||
|
||
class BothPin(BaseModel): | ||
min_pin: str | None = Field( | ||
default=None, description="Defaults to x.x.x.x.x for pin, change to make less specific" | ||
) | ||
max_pin: str | None = Field( | ||
default=None, description="Defaults to x for pin, change to make more specific" | ||
) | ||
|
||
|
||
class VariantConfig(BaseModel, extra="allow"): | ||
"""Usage docs: https://prefix-dev.github.io/rattler-build/variants | ||
|
||
Schema for variant configuration file for specifying recipe variants | ||
for automating builds. | ||
""" | ||
|
||
zip_keys: ConditionalList[ConditionalList[str]] = Field( | ||
default=None, | ||
description="Zip keys have variant key that has multiple entries which is expanded to a build matrix for variants.", | ||
) | ||
pin_run_as_build: dict[str, MaxPin | MinPin | BothPin] = Field( | ||
default=None, description="Pinning package versions for variant" | ||
) | ||
model_config = { | ||
"json_schema_extra": { | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{"type": "string"}, | ||
{"items": {"type": "string"}, "type": "array"}, | ||
] | ||
}, | ||
}, | ||
} | ||
|
||
|
||
if __name__ == "__main__": | ||
print(json.dumps(TypeAdapter(VariantConfig).json_schema(), indent=2)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how you guys feel about this, how about changing this to some link at
prefix.dev
that is a 300 to this URL? This would allow you to use better versioning and not be bound by this specific location in the repo if you ever decide on moving/renaming these files.