GEOPY-2769: optional environment parameter for pixi envs#163
GEOPY-2769: optional environment parameter for pixi envs#163RomFloreani wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional Pixi environment override to the reusable Python workflows to unblock downstream testing (GEOPY-QA) by allowing callers to select a specific Pixi environment name instead of always deriving it from the Python version.
Changes:
- Added a new
pixi-environmentworkflow input to the reusable static analysis and pytest workflows. - Updated Pixi setup usage to pass the optional environment name through to the Pixi setup action (and bumped the referenced action version).
- Extended the composite Pixi setup action to prefer an explicit environment name when provided.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/reusable-python-static_analysis.yml | Adds pixi-environment input and forwards it into Pixi environment setup. |
| .github/workflows/reusable-python-pytest.yml | Adds pixi-environment input and forwards it into Pixi environment setup for matrix runs. |
| .github/actions/reusable-python-setup_pixi/action.yml | Adds environment input and updates env-name selection logic to prefer it over derived name. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| description: > | ||
| Pixi environment name to install. When provided, takes precedence over | ||
| the name derived from python-version (py<version-without-dots>). | ||
| required: false |
There was a problem hiding this comment.
New environment input is missing a type: field, while the other inputs in this action define types. For consistency across composite actions in this repo (and within this file), add type: string to inputs.environment.
| required: false | |
| required: false | |
| type: string |
| else | ||
| pixi_env="py${PYTHON_VERSION//./}" |
There was a problem hiding this comment.
If both inputs.environment and inputs.python-version are empty, this logic will produce pixi_env="py", which is very likely an invalid environment name and will fail later in a harder-to-diagnose way. Consider adding an explicit guard that exits with a clear error when neither value is provided.
| else | |
| pixi_env="py${PYTHON_VERSION//./}" | |
| elif [ -n "$PYTHON_VERSION" ]; then | |
| pixi_env="py${PYTHON_VERSION//./}" | |
| else | |
| echo "::error::Either 'environment' or 'python-version' must be provided." | |
| exit 1 |
There was a problem hiding this comment.
suggestion: guard against values being both empty
(problem was existing before you changes, but Copilot has a point)
sebhmg
left a comment
There was a problem hiding this comment.
Please see some suggestions on safety checks and naming
| description: Python version to decide on the pixi environment to install | ||
| required: false | ||
| type: string | ||
| environment: |
There was a problem hiding this comment.
suggestions: rename not to confuse with builtin field name by github
environment creates some confusion with builtin environment: See https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/deploy-to-environment
Suggestion: environment-name, as in setup-micromamba (see https://github.com/mamba-org/setup-micromamba?tab=readme-ov-file#create-environment-from-environment-specs)
| description: > | ||
| Pixi environment name to install. When provided, takes precedence over | ||
| the name derived from python-version (py<version-without-dots>). | ||
| required: false |
| else | ||
| pixi_env="py${PYTHON_VERSION//./}" |
There was a problem hiding this comment.
suggestion: guard against values being both empty
(problem was existing before you changes, but Copilot has a point)
GEOPY-2769: add an environment optional parameter for pixi envs
see it in action, fixing GEOPY-QA worklfows at https://github.com/MiraGeoscience/geopy-qa/pull/21