-
Notifications
You must be signed in to change notification settings - Fork 2
support pixi environments #42
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
Open
keewis
wants to merge
56
commits into
xarray-contrib:main
Choose a base branch
from
keewis:pixi
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
56 commits
Select commit
Hold shift + click to select a range
f2959bf
refactor `spec` into a separate submodule
keewis cf5c4c0
dispatch by kind
keewis 9e1e9ec
default the kind to `conda`
keewis 5a6b670
adapt the tests
keewis 7eef3e5
configure project metadata
keewis a20e075
add `manifest_path` to the cli options
keewis 8f37fef
formatting
keewis 9f9990e
write the environment parsing for pixi envs
keewis 1c0c0ee
raise a more descriptive error if no suitable releases were found
keewis fd07057
filter out excluded packages before fetching releases
keewis f1e6de1
consider unpinned specs as not matching
keewis 5883e35
gracefully handle unpinned but not ignored dependencies
keewis 0bb207d
install the module instead of modifying `sys.path`
keewis 6795a27
allow passing `manifest-path` to the action
keewis 851d0a6
misformatted input definition
keewis 0144607
stop testing on the unsupported python 3.10
keewis 741a436
install the package itself
keewis f56c537
use the warning style for unpinned versions
keewis afd85b4
warn about ignored PyPI dependencies
keewis 51da18a
tests for most of the functions in `minimum_versions.release`
keewis c53cf33
tests for the environment functions
keewis 36019e3
tests for parsing conda specs
keewis a1c08cf
also check parsing the entire conda env
keewis 8f0fa55
rename
keewis b979674
check parsing pixi specs
keewis 878aa35
fix a bug in the lower pin regex
keewis 9cfadc7
additional spec parsing checks
keewis 7f9863b
check invalid versions raise
keewis c7c1179
checks for parse_pixi_environment
keewis c2351bf
include the default feature in the features
keewis abf286f
rename the `environment-paths` input to `environments`
keewis 8473575
describe how to analyze `pixi` environments
keewis 2ed4375
rename `env-paths` to `envs`
keewis 81c9530
e2e tests for pixi and mixed envs
keewis cc8ee84
typo
keewis 3f55bc2
add policy files for the pixi tests
keewis a5ac008
another typo
keewis 9d266d9
quotes and expected failure settings
keewis 0d5add7
add a failing pixi env
keewis 35ac1e9
also check the default pypi-dependencies
keewis b584476
back to `python=3.9`
keewis 2d1976e
support the `no-default-feature` option
keewis 3017270
support analyzing missing features
keewis 285aee0
change the error text for unknown version specs
keewis fdfa6b6
add a note containing the package name
keewis f0fd56d
add more information
keewis c95acf7
support dict pins
keewis 56aab76
configure coverage
keewis 113d767
check the format detection
keewis 4dcc7dc
raise on unknown features
keewis 8171549
support no features
keewis 2555235
check that `<=` is also detected
keewis 99672dd
check pypi dependencies
keewis 7bad70d
support local packages
keewis 798e579
skip the local package, if any
keewis 5e76d15
properly check that local packages are skipped
keewis 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,17 @@ | ||
| [dependencies] | ||
| pandas = "2.1" | ||
| packaging = "23.1" | ||
|
|
||
| [feature.py39.dependencies] | ||
| python = "3.9" | ||
|
|
||
| [feature.py310.dependencies] | ||
| python = "3.10" | ||
|
|
||
| [feature.failing.dependencies] | ||
| numpy = "2.1" | ||
|
|
||
| [environments] | ||
| env1 = { features = ["py310"] } | ||
| env2 = ["py39"] | ||
| failing-env = { features = ["failing"] } |
This file contains hidden or 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,25 @@ | ||
| import pathlib | ||
|
|
||
| from minimum_versions.environments.conda import parse_conda_environment | ||
| from minimum_versions.environments.pixi import parse_pixi_environment | ||
| from minimum_versions.environments.spec import Spec, compare_versions # noqa: F401 | ||
|
|
||
| kinds = { | ||
| "conda": parse_conda_environment, | ||
| "pixi": parse_pixi_environment, | ||
| } | ||
|
|
||
|
|
||
| def parse_environment(specifier: str, manifest_path: pathlib.Path | None) -> list[Spec]: | ||
| split = specifier.split(":", maxsplit=1) | ||
| if len(split) == 1: | ||
| kind = "conda" | ||
| path = specifier | ||
| else: | ||
| kind, path = split | ||
|
|
||
| parser = kinds.get(kind) | ||
| if parser is None: | ||
| raise ValueError(f"Unknown kind {kind!r}, extracted from {specifier!r}.") | ||
|
|
||
| return parser(path, manifest_path) |
This file contains hidden or 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,46 @@ | ||
| import pathlib | ||
|
|
||
| import yaml | ||
| from rattler import Version | ||
|
|
||
| from minimum_versions.environments.spec import Spec | ||
|
|
||
|
|
||
| def parse_spec(spec_text): | ||
| warnings = [] | ||
| if ">" in spec_text or "<" in spec_text: | ||
| warnings.append( | ||
| f"package must be pinned with an exact version: {spec_text!r}." | ||
| " Using the version as an exact pin instead." | ||
| ) | ||
|
|
||
| spec_text = spec_text.replace(">", "").replace("<", "") | ||
|
|
||
| if "=" in spec_text: | ||
| name, version_text = spec_text.split("=", maxsplit=1) | ||
| version = Version(version_text) | ||
| segments = version.segments() | ||
|
|
||
| if (len(segments) == 3 and segments[2] != [0]) or len(segments) > 3: | ||
| warnings.append( | ||
| f"package should be pinned to a minor version (got {version})" | ||
| ) | ||
| else: | ||
| name = spec_text | ||
| version = None | ||
|
|
||
| return Spec(name, version), (name, warnings) | ||
|
|
||
|
|
||
| def parse_conda_environment(path: pathlib.Path, manifest_path: None): | ||
| env = yaml.safe_load(pathlib.Path(path).read_text()) | ||
|
|
||
| specs = [] | ||
| warnings = [] | ||
| for dep in env["dependencies"]: | ||
| spec, warnings_ = parse_spec(dep) | ||
|
|
||
| specs.append(spec) | ||
| warnings.append(warnings_) | ||
|
|
||
| return specs, warnings |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.