fix: rely on conda >24.7.1 for conda env deployment and deprecate mamba support#3121
fix: rely on conda >24.7.1 for conda env deployment and deprecate mamba support#3121johanneskoester merged 5 commits intomainfrom
Conversation
WalkthroughThe pull request introduces significant updates to the CI workflow and the Snakemake codebase. Key changes include replacing the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (1)
.github/workflows/main.yml (1)
62-64: LGTM! Consider pinning the miniforge version.The change from
setup-micromambatosetup-minicondaaligns well with the PR objective of updating conda dependency and deprecating mamba support. This is a good move towards standardizing the environment setup.Consider pinning the
miniforge-versionto a specific version instead of usinglatest. This can help ensure reproducibility and prevent unexpected changes in the CI environment. For example:miniforge-version: 23.3.1-1You can update this version periodically as needed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
- .github/workflows/main.yml (2 hunks)
- snakemake/deployment/conda.py (7 hunks)
- snakemake/settings/types.py (2 hunks)
- test-environment.yml (0 hunks)
- tests/common.py (1 hunks)
💤 Files with no reviewable changes (1)
- test-environment.yml
🧰 Additional context used
📓 Path-based instructions (3)
snakemake/deployment/conda.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.snakemake/settings/types.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.tests/common.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
🪛 Ruff
snakemake/deployment/conda.py
710-710: Local variable
eis assigned to but never usedRemove assignment to unused variable
e(F841)
737-737: Within an
exceptclause, raise exceptions withraise ... from errorraise ... from Noneto distinguish them from errors in exception handling(B904)
🔇 Additional comments (11)
.github/workflows/main.yml (2)
147-150: LGTM! Consistent with Linux job changes.The changes in the Windows job mirror those made in the Linux job, which is good for consistency across platforms. This update successfully aligns the Windows environment setup with the new conda-based approach.
As mentioned in the previous comment, consider pinning the
miniforge-versionto a specific version for reproducibility.
Line range hint
1-164: Inconsistency in formatting job and clarification needed on caching.
The
formattingjob still usesmamba-org/setup-micromamba@v1. For consistency with the other jobs and alignment with the PR objectives, consider updating this to useconda-incubator/setup-miniconda@v3as well.The
cache-environmentoption has been removed from both theformattingandtestingjobs. While this change is not directly related to the PR objectives, it might affect the CI performance. Could you provide some context on why this change was made?To verify the inconsistency and the removal of caching, you can run the following script:
This script will help identify any remaining instances of mamba usage and confirm the removal of the
cache-environmentoption.snakemake/settings/types.py (3)
252-252: Update defaultconda_frontendto'conda'.The default value of
conda_frontendhas been correctly updated to'conda'to reflect the deprecation ofmambasupport.
262-263: Importloggerfor warning messages.The addition of
loggerimport is necessary for issuing deprecation warnings in__post_init__.
268-276: Add deprecation warning and reset for alternative conda frontends.The code appropriately warns users about the deprecation of alternative conda frontends and resets
self.conda_frontendto'conda'to ensure consistent behavior.snakemake/deployment/conda.py (6)
92-92: Removal offrontendparameter is correctly reflectedThe instantiation of
Condain thecondaproperty now omits thefrontendparameter, consistent with the updatedCondaclass definition wherefrontendis no longer required.
532-532: Updatedsubcommandto usecondaexclusivelyThe
subcommandis now set to["conda"], reflecting the deprecation ofmambasupport and ensuring that onlycondais used for environment creation.
653-653: Removedfrontendparameter fromConda.__new__methodThe
__new__method signature no longer includes thefrontendparameter, aligning with the decision to simplify theCondaclass by removing support for multiple frontends.
662-662: Removedfrontendparameter fromConda.__init__methodThe
__init__method now excludes thefrontendparameter, consistent with the refactoring to eliminatemambasupport and streamline the initialization process.
698-725: Simplified command availability check to focus oncondaThe
_checkmethod now setsfrontend = "conda"and removes conditional logic related tomamba. This change aligns with removingmambasupport and simplifies the command availability check.🧰 Tools
🪛 Ruff
710-710: Local variable
eis assigned to but never usedRemove assignment to unused variable
e(F841)
763-769: Updated minimum required conda version to 24.9.1The version check now requires conda version 24.9.1 or later, which aligns with the PR objective to rely on the latest conda features. This update ensures compatibility with the required functionalities introduced in newer conda versions.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
snakemake/deployment/conda.py (1)
Line range hint
535-544: Include--yesflag when creating environment from YAML fileIn the
create_envfunction, when thefiletypeis"yaml", theyes_flagis set to an empty list, omitting the--yesflag from theconda env createcommand. This might result in interactive prompts during environment creation, which could disrupt automated workflows. To ensure non-interactive execution, consider including the--yesflag even when using YAML files.Apply this diff to include the
--yesflag:if filetype == "yaml": subcommand.append("env") - yes_flag = [] + yes_flag = ["--yes"]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- snakemake/deployment/conda.py (8 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
snakemake/deployment/conda.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
🪛 Ruff
snakemake/deployment/conda.py
713-713: Local variable
eis assigned to but never usedRemove assignment to unused variable
e(F841)
740-740: Within an
exceptclause, raise exceptions withraise ... from errorraise ... from Noneto distinguish them from errors in exception handling(B904)
🔇 Additional comments (1)
snakemake/deployment/conda.py (1)
701-740: Duplicate Comment: Address unused variableeand enhance exception chainingThe variable
eis assigned in theexceptclause at line 713 but not utilized when raising the new exception at line 740. To preserve the original traceback and provide more context, it's advisable to use exception chaining withraise ... from e.This issue has been previously noted and the past review comment is still valid and applicable.
🧰 Tools
🪛 Ruff
713-713: Local variable
eis assigned to but never usedRemove assignment to unused variable
e(F841)
740-740: Within an
exceptclause, raise exceptions withraise ... from errorraise ... from Noneto distinguish them from errors in exception handling(B904)
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (4)
snakemake/deployment/containerize.py (2)
43-43: Approve the Docker image change, but consider using a specific version tag.The change from
condaforge/mambaforge:latesttocondaforge/miniforge3:latestaligns with the PR objective of deprecating mamba support. However, using thelatesttag may lead to inconsistent builds over time.Consider using a specific version tag for
miniforge3to ensure reproducibility. For example:-FROM condaforge/miniforge3:latest +FROM condaforge/miniforge3:4.10.3-10Replace
4.10.3-10with the most recent stable version available.
70-70: Approve the conda command change, but consider adding a version check.The change from
mamba env createtoconda env createaligns with the PR objective of deprecating mamba support.Consider adding a version check to ensure conda >24.7.1 is used, as mentioned in the PR objectives. You could add this check before the environment creation:
+RUN conda --version && \ + conda_version=$(conda --version | cut -d ' ' -f 2) && \ + if [ "$(printf '%s\n' "24.7.1" "$conda_version" | sort -V | head -n1)" = "24.7.1" ]; then \ + echo "Conda version $conda_version is compatible"; \ + else \ + echo "Error: Conda version must be >24.7.1" && exit 1; \ + fi RUN conda env create --prefix {prefix} --file {env_target_path} &&This ensures that the containerization process fails if the conda version requirement is not met.
snakemake/cli.py (1)
Line range hint
1624-1629: Update to conda frontend default and documentationThe default value for the
--conda-frontendargument has been changed from "mamba" to "conda". This change aligns with the PR objective to rely on conda >24.7.1 for conda environment deployment and deprecate mamba support.However, the help text still recommends mamba as being much faster. This might be confusing for users given the change in default behavior.
Consider updating the help text to reflect the new default and explain the rationale behind the change. For example:
group_conda.add_argument( "--conda-frontend", default="conda", choices=["conda", "mamba"], - help="Choose the conda frontend for installing environments. " - "Mamba is much faster and highly recommended.", + help="Choose the conda frontend for installing environments. " + "Default is conda (>24.7.1) which now uses the libmamba solver internally. " + "Mamba is still available but no longer recommended due to recent disruptive changes.", )snakemake/deployment/conda.py (1)
Remaining
frontendReferences Found in CodebaseThe following files still contain references to the
frontendparameter. Please remove these references to ensure consistency and prevent potential errors:
snakemake/cli.pysnakemake/settings/types.pysnakemake/workflow.pysnakemake/deployment/conda.py🔗 Analysis chain
Line range hint
657-666: Verify removal of allfrontendparameter referencesThe
frontendparameter has been removed from theCondaclass's__new__and__init__methods at lines 657-666. To prevent potential errors or unexpected behavior, ensure that all references to thefrontendparameter have been removed throughout the codebase.Run the following script to verify that no remaining references to
frontendexist:🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that there are no remaining references to 'frontend' in the codebase. # Test: Search for 'frontend' keyword in Python files. # Expect: No matches indicating all references have been removed. rg --type py '\bfrontend\b' -A 2 -B 2Length of output: 2591
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
tests/test_containerized/expected-results/test.outis excluded by!**/*.out
📒 Files selected for processing (6)
- snakemake/cli.py (1 hunks)
- snakemake/deployment/conda.py (9 hunks)
- snakemake/deployment/containerize.py (2 hunks)
- tests/test_containerized/Dockerfile (1 hunks)
- tests/test_containerized/Snakefile (1 hunks)
- tests/test_containerized/env.yaml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
snakemake/cli.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.snakemake/deployment/conda.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.snakemake/deployment/containerize.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
🪛 Ruff
snakemake/deployment/conda.py
714-714: Local variable
eis assigned to but never usedRemove assignment to unused variable
e(F841)
741-741: Within an
exceptclause, raise exceptions withraise ... from errorraise ... from Noneto distinguish them from errors in exception handling(B904)
🔇 Additional comments (15)
tests/test_containerized/env.yaml (3)
4-4: Excellent addition of the 'nodefaults' channel.Adding the 'nodefaults' channel is a good practice for ensuring reproducibility. It prevents conda from automatically including default channels, which can sometimes lead to inconsistent environments across different systems. This change aligns well with best practices for conda environment management.
6-6: Approved: BCFtools version update to 1.21.Updating BCFtools from version 1.10 to 1.21 is a significant upgrade that likely brings important improvements and bug fixes. This update aligns with the PR's objective of using more recent software versions.
To ensure this update doesn't introduce unexpected changes to your workflows, please verify:
- Compatibility with existing scripts and pipelines that use BCFtools.
- Any changes in command syntax or output format that might affect downstream processes.
Consider running the following command to check for any major changes in the BCFtools usage:
This script will highlight any differences in the command-line interface between the two versions, which could indicate potential breaking changes.
1-6: Verify completeness of dependencies for containerized tests.The environment file appears to be minimal, containing only one dependency (bcftools). While this might be intentional for a specific test case, it's worth verifying if all necessary dependencies for the containerized tests are included.
To ensure all required dependencies are present, consider running the following command to check for any import errors or missing dependencies in the test files:
This script will help identify any potential missing dependencies by checking for import errors in the test files. If any missing dependencies are found, consider adding them to the
env.yamlfile.tests/test_containerized/Snakefile (1)
1-1: LGTM! Verify the new Docker image.The update to the containerized directive looks good. The Docker image has been updated from version 1.0 to 1.2, and the repository has changed from "quay.io/snakemake" to "snakemake".
To ensure the workflow continues to function as expected, please verify:
- The new image "snakemake/containerize-testimage:1.2" exists and is accessible.
- The new image is compatible with the current workflow and contains all necessary dependencies.
You can use the following command to check if the image exists:
If the image doesn't exist or there are any issues, please update the directive accordingly.
tests/test_containerized/Dockerfile (5)
1-1: Approved: Base image change aligns with PR objectivesThe change from
condaforge/mambaforge:latesttocondaforge/miniforge3:latestas the base image is consistent with the PR's goal of deprecating mamba support and relying on conda. This modification ensures that the testing environment uses a minimal Conda-based image, which is appropriate for the new approach.
15-15: Verify compatibility with updated bcftools versionThe update of bcftools from version 1.10 to 1.21 is a significant version jump that likely includes new features and bug fixes. This update is generally positive for keeping dependencies up-to-date.
To ensure compatibility, please run the following script to check for any breaking changes or deprecations between these versions:
#!/bin/bash # Check for potential breaking changes in bcftools update echo "Checking for potential breaking changes in bcftools update from 1.10 to 1.21" # Search for bcftools usage in the codebase echo "Files using bcftools:" rg --type python "bcftools" -l echo "Please manually review the bcftools usage in these files and compare with the changelog of bcftools 1.21 to ensure compatibility." # Optionally, you can add a step to fetch and display the changelog between these versions # This would require additional setup to access the bcftools repository or release notes
9-9: Ensure consistency of the conda environment prefixThe update to the conda environment prefix is appropriate and likely reflects changes in the overall conda setup process. This modification is consistent with the PR's objectives.
To ensure consistency, please run the following script to check if the prefix is used consistently throughout the Dockerfile:
#!/bin/bash # Check for consistency of the conda environment prefix in the Dockerfile prefix=$(grep "prefix:" tests/test_containerized/Dockerfile | awk '{print $3}') echo "Conda environment prefix: $prefix" # Check if the prefix is used consistently if grep -q "$prefix" tests/test_containerized/Dockerfile; then echo "Prefix is used consistently in the Dockerfile." else echo "Warning: Prefix might not be used consistently in the Dockerfile." echo "Please manually verify the usage of the prefix." fi
21-22: Approved: Conda environment creation aligns with PR objectivesThe modification of the environment creation commands to use 'conda' instead of 'mamba' directly implements the PR's goal of deprecating mamba support. The adjustment of paths for environment creation and the environment.yaml file is consistent with the earlier prefix changes.
To ensure the conda environment is created correctly, please run the following script:
#!/bin/bash # Verify conda environment creation command # Extract the conda env creation command from the Dockerfile conda_command=$(grep "RUN conda env create" tests/test_containerized/Dockerfile) echo "Conda environment creation command:" echo "$conda_command" # Check if the command uses 'conda' and not 'mamba' if [[ $conda_command == *"conda env create"* ]] && [[ $conda_command != *"mamba"* ]]; then echo "Verification successful: The command uses 'conda' for environment creation." else echo "Verification failed: Please check the conda environment creation command." fi # Verify the paths used in the command prefix=$(echo "$conda_command" | grep -oP "(?<=--prefix )[^ ]+") yaml_file=$(echo "$conda_command" | grep -oP "(?<=--file )[^ ]+") echo "Verifying paths:" echo "Prefix: $prefix" echo "YAML file: $yaml_file" # Check if the paths are consistent with earlier changes if [[ $prefix == "/conda-envs/2a132eb0d84044eaf02032bd9f9851fd" ]] && [[ $yaml_file == "/conda-envs/2a132eb0d84044eaf02032bd9f9851fd/environment.yaml" ]]; then echo "Path verification successful: The paths are consistent with earlier changes." else echo "Path verification failed: Please check the consistency of paths in the conda command." fi
3-3: Verify the conda environment hashThe update to the conda environment hash label is appropriate, as it likely reflects changes in the conda environment definition. This update is crucial for maintaining proper caching and reproducibility of the conda environment.
To ensure the hash is correct, please run the following script:
snakemake/deployment/containerize.py (1)
74-79: Approve the step renumbering and cleanup command changes.The changes in step numbering and the switch from
mamba cleantoconda cleanare consistent with the overall objective of deprecating mamba support. The-yflag is maintained, ensuring non-interactive execution during the containerization process.snakemake/cli.py (2)
Line range hint
1-1629: Summary of changes and recommendationsThe primary change in this file is the update to the
--conda-frontendargument, switching the default from "mamba" to "conda". This change aligns with the PR objective to rely on conda >24.7.1 and deprecate mamba support.Key points and recommendations:
- Update the help text for
--conda-frontendto reflect the new default and explain the rationale.- Consider broader implications including documentation updates, backward compatibility, performance monitoring, and user communication.
- Implement a deprecation warning for explicit mamba usage.
- Add performance benchmarking to validate the change.
- Verify and update any other parts of the codebase that might assume mamba as the default.
These changes and considerations will ensure a smooth transition from mamba to conda as the default frontend while maintaining clear communication with users about the change and its implications.
Line range hint
1-1629: Consider broader impact of conda frontend changeWhile the change to the
--conda-frontenddefault is localized to a single argument, it may have broader implications for the Snakemake workflow and user experience.
Documentation: Ensure that all relevant documentation (both in-code and external) is updated to reflect this change in default behavior.
Backward Compatibility: Consider adding a deprecation warning if users explicitly set
--conda-frontend mamba, informing them about the change and future plans.Performance Monitoring: As the change is motivated by conda's improved performance with the libmamba solver, it might be beneficial to add performance monitoring or benchmarking to ensure the change meets expectations.
User Communication: Plan for how this change will be communicated to users, possibly through release notes or a migration guide.
To facilitate these considerations, you might want to:
- Add a deprecation warning in the argument parsing logic when mamba is explicitly selected.
- Implement a simple benchmarking function to compare conda and mamba performance in your test suite.
- Update the user guide and any examples that might reference mamba as the recommended or default option.
To ensure no other parts of the code assume mamba as the default, we can search for such occurrences:
✅ Verification successful
No further issues found regarding the
--conda-frontenddefault tomambaAfter comprehensive verification, all instances of
mambausage within the codebase are appropriately handled. The change to setmambaas the default conda frontend insnakemake/cli.pyis consistent with existing documentation, Docker configurations, and help descriptions. This adjustment aligns with the goal of leveraginglibmambafor improved performance without introducing any inconsistencies or overlooked references.Action Items:
- Ensure that all user-facing documentation has been reviewed and accurately reflects the change to
mambaas the default frontend.- Monitor user feedback post-release to identify any unforeseen issues related to this change.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for 'mamba' occurrences that might need updating rg 'mamba' --type pythonLength of output: 55
Script:
#!/bin/bash # Corrected command to search for 'mamba' in Python files rg 'mamba' --glob "*.py"Length of output: 417
Script:
#!/bin/bash # Search for 'mamba' across all files to identify any additional usages rg 'mamba'Length of output: 3283
snakemake/deployment/conda.py (3)
Line range hint
536-541: Confirm absence of--yesflag to ensure non-interactive environment creationAt lines 536-541, when
filetypeis'yaml', theyes_flaglist is set to empty:yes_flag = ["--yes"] if filetype == "yaml": subcommand.append("env") yes_flag = []This means the
--yesflag is omitted from the Conda command when creating environments from YAML files. This could cause Conda to prompt for confirmation, potentially interrupting automated workflows.Please confirm whether omitting the
--yesflag is intentional and that environment creation proceeds without user interaction. If non-interactive execution is desired, consider retaining the--yesflag:if filetype == "yaml": subcommand.append("env") - yes_flag = []
758-770: EnsureMIN_CONDA_VERaligns with required minimum versionAt line 765, the code checks if the Conda version is less than
MIN_CONDA_VER(which is"24.7.1"as defined at line 46). According to the PR objectives, the minimum required Conda version should be greater than24.9.1. Please updateMIN_CONDA_VERto reflect the correct minimum version to ensure consistency and prevent version mismatch errors.(This issue has been previously addressed in past review comments.)
714-741: Implement exception chaining for clearer error contextIn the exception handling block starting at line 714, the variable
eis assigned but not utilized when raising the new exception. To preserve the original exception context and provide more detailed traceback information, consider using exception chaining withraise ... from e.(This issue has been previously addressed in past review comments.)
🧰 Tools
🪛 Ruff
714-714: Local variable
eis assigned to but never usedRemove assignment to unused variable
e(F841)
741-741: Within an
exceptclause, raise exceptions withraise ... from errorraise ... from Noneto distinguish them from errors in exception handling(B904)
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
tests/test_conda_named/Snakefile (2)
7-7: LGTM! Consider specifying the minimum conda version.The change from
mambatocondaaligns with the PR objectives to deprecate mamba support. This modification ensures consistency with the rest of the codebase and tests the new behavior.To further align with the PR objectives, consider adding a check for the minimum conda version (>24.7.1) before running the command. This could be done by adding a version check at the beginning of the file:
import conda from packaging import version if version.parse(conda.__version__) <= version.parse("24.7.1"): raise RuntimeError("This test requires conda >24.7.1")This addition would ensure that the test is run with the intended conda version, preventing potential issues with older versions.
Line range hint
28-31: Enhance test robustness by verifying conda environment usage.The current test checks the ripgrep version, which indirectly verifies that the conda environment was created and used. To make the test more robust and directly tied to the conda environment creation, consider adding a step to verify that the command is indeed running in the created conda environment.
You could modify the shell command in rule 'a' to include a check for the conda environment:
rule a: output: "test.out", log: err="test.log", conda: "xxx-test-env" shell: r""" (conda info --envs | grep xxx-test-env && rg --version | grep -o 'ripgrep [0-9]*\.[0-9]*\.[0-9]*' > {output}) 2> {log.err} """This change ensures that the test fails if the conda environment is not created or activated properly, providing a more direct test of the conda functionality.
tests/test_conda_function/Snakefile (1)
1-7: LGTM! Consider specifying the conda version.The change from
mambatocondaaligns with the PR objectives to deprecate mamba support. This is a good step towards standardizing on conda for environment management.To ensure consistency with the PR objectives and maintain performance, consider specifying the conda version in the shell command. This will guarantee that a version > 24.7.1 is used. For example:
f"conda create -y -n {env_name} -c conda-forge --override-channels ripgrep=={wildcards.version} conda>=24.7.1"This addition will install conda itself in the new environment, ensuring the required version is used.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- tests/test_conda_function/Snakefile (1 hunks)
- tests/test_conda_named/Snakefile (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
tests/test_conda_named/Snakefile (1)
Line range hint
1-31: Overall, the changes look good and align with the PR objectives.The switch from mamba to conda in the environment creation command is implemented correctly. The rest of the file remains consistent with this change. The suggested improvements (checking conda version and verifying conda environment usage) would further enhance the test's effectiveness in ensuring the correct behavior of the updated conda-based workflow.
tests/test_conda_function/Snakefile (1)
Line range hint
20-37: Verify ripgrep versions in test casesThe test cases use ripgrep versions 12.1.1 and 13.0.0. While these haven't changed, it's worth verifying if these versions are still appropriate for testing, especially considering the recent changes in the conda environment setup.
To check the latest available versions of ripgrep, you can run:
This will show the 5 most recent versions of ripgrep available in the conda-forge channel. If there are significantly newer versions available, consider updating the test cases to include a more recent version.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
.github/workflows/main.yml (3)
61-65: LGTM! Consider specifying a fixed miniforge version for reproducibility.The change from
setup-micromambatosetup-minicondaaligns well with the PR objective of updating conda dependency and deprecating mamba support. This ensures that the CI environment uses conda >24.7.1 as intended.Consider specifying a fixed miniforge version instead of using
latestto ensure reproducible builds:miniforge-version: 23.11.0-0This way, you can control when to update the miniforge version explicitly.
147-151: LGTM! Consider specifying a fixed miniforge version and fix the typo.The change from
setup-micromambatosetup-minicondafor the Windows job is consistent with the changes made in thetestingjob and aligns well with the PR objective.
- Consider specifying a fixed miniforge version instead of using
latestto ensure reproducible builds:miniforge-version: 23.11.0-0
- There's a typo in the step name. It should be "Setup snakemake environment" instead of "Setup snakemke environment".
Action Required: Update
formattingJob to Use CondaThe
formattingjob still referencesmamba-org/setup-micromamba@v1. To ensure consistency across all jobs, please update this to useconda-incubator/setup-miniconda@v3.
- Change:
- From:
mamba-org/setup-micromamba@v1- To:
conda-incubator/setup-miniconda@v3This will align the
formattingjob with the other jobs that already use Conda, ensuring uniform dependency management.🔗 Analysis chain
Line range hint
1-165: Consider further improvements and verifications.The changes successfully implement the PR objective of updating conda dependency and deprecating mamba support. However, there are a few additional considerations:
The
formattingjob still usesmamba-org/setup-micromamba@v1. Consider updating this to useconda-incubator/setup-miniconda@v3for consistency.The
build-container-imagejob might need to be updated if the Dockerfile was modified to remove mamba dependencies.It would be beneficial to verify that all conda-related commands in the workflow file are compatible with the new conda version.
To verify the conda-related commands and potential missed mamba references, you can run the following script:
This will help ensure that all references to conda, mamba, and micromamba are intentional and consistent with the new changes.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for conda and mamba related commands and references # Check for conda commands echo "Conda commands:" rg '\bconda\b' .github/workflows/main.yml # Check for mamba references echo "\nMamba references:" rg '\bmamba\b' .github/workflows/main.yml # Check for micromamba references echo "\nMicromamba references:" rg '\bmicromamba\b' .github/workflows/main.ymlLength of output: 586
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
- .github/workflows/main.yml (2 hunks)
- setup.cfg (1 hunks)
- snakemake/deployment/conda.py (12 hunks)
- test-environment.yml (1 hunks)
- tests/tests.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- test-environment.yml
🧰 Additional context used
📓 Path-based instructions (2)
snakemake/deployment/conda.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.tests/tests.py (1)
Pattern
**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
🪛 Ruff
snakemake/deployment/conda.py
714-714: Local variable
eis assigned to but never usedRemove assignment to unused variable
e(F841)
741-741: Within an
exceptclause, raise exceptions withraise ... from errorraise ... from Noneto distinguish them from errors in exception handling(B904)
🔇 Additional comments (2)
setup.cfg (1)
54-54: Approve the dependency version update.The update to the
snakemake-interface-executor-pluginsdependency version (from>=9.2.0,<10.0to>=9.3.2,<10.0) is appropriate. This change ensures the project uses a more recent version of the executor plugins interface while maintaining compatibility with versions below 10.0.To ensure this change doesn't introduce any unexpected issues, please verify:
- The compatibility of this updated dependency version with the rest of the project.
- That the changelog or release notes for
snakemake-interface-executor-pluginsbetween versions 9.2.0 and 9.3.2 don't contain any breaking changes or deprecations that might affect Snakemake.You can use the following script to check for any potential issues:
✅ Verification successful
Dependency version update verified.
The update to the
snakemake-interface-executor-pluginsdependency version (from>=9.2.0,<10.0to>=9.3.2,<10.0) has been verified. No usages or explicit version checks were found in the codebase, ensuring that the update maintains compatibility without introducing issues.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for potential compatibility issues with the updated dependency # Test: Search for usage of snakemake-interface-executor-plugins in the codebase echo "Searching for usage of snakemake-interface-executor-plugins:" rg --type python "from snakemake_interface_executor_plugins import" -A 5 # Test: Check if there are any explicit version checks for this dependency echo "Checking for explicit version checks:" rg --type python "snakemake_interface_executor_plugins.__version__" # Note: Review the output manually to ensure there are no compatibility issuesLength of output: 420
Script:
#!/bin/bash # Description: Identify Python files and search for usage of snakemake-interface-executor-plugins # Step 1: Find all Python files echo "Finding all Python files in the repository:" fd --extension py > python_files.txt cat python_files.txt # Step 2: Search for usage of snakemake-interface-executor-plugins in Python files echo "Searching for usage of snakemake-interface-executor-plugins in Python files:" xargs -a python_files.txt -I {} rg "from snakemake_interface_executor_plugins import" {} -A 5 # Step 3: Check for explicit version checks of snakemake-interface-executor-plugins echo "Checking for explicit version checks of snakemake-interface_executor_plugins:" xargs -a python_files.txt -I {} rg "snakemake_interface_executor_plugins\.\_\_version\_\_" {} # Cleanup rm python_files.txtLength of output: 24569
Script:
#!/bin/bash # Description: Identify Python files and search for usage of snakemake-interface-executor-plugins # Step 1: Find all Python files echo "Finding all Python files in the repository:" fd --extension py > python_files.txt cat python_files.txt # Step 2: Search for usage of snakemake-interface-executor-plugins in Python files echo "Searching for usage of snakemake-interface-executor-plugins in Python files:" xargs -a python_files.txt -I {} rg "from snakemake_interface_executor_plugins import" {} -A 5 # Step 3: Check for explicit version checks of snakemake-interface-executor-plugins echo "Checking for explicit version checks of snakemake_interface_executor_plugins:" xargs -a python_files.txt -I {} rg "snakemake_interface_executor_plugins\.__version__" {} # Cleanup rm python_files.txtLength of output: 4341
tests/tests.py (1)
499-499: Update to use new function for checking environment setup.The code has been updated to use the
get_env_setup_done_flag_filefunction to check for the existence of the environment setup done flag file. This change improves the robustness of the test by using a centralized function to determine the correct path for the flag file.To ensure that the
get_env_setup_done_flag_filefunction is correctly implemented and used, we can run the following verification:
🤖 I have created a release *beep* *boop* --- ## [8.20.6](v8.20.5...v8.20.6) (2024-10-07) ### Bug Fixes * rely on conda >24.7.1 for conda env deployment and deprecate mamba support ([#3121](#3121)) ([9ece2db](9ece2db)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>



Rationale:
Since a while, conda uses internally the libmamba solver (i.e. the same thing as mamba). Mamba development itself is basically over, as the devs concentrate on rattler-based solving. The latter is the future for Snakemake as well, by natively interfacing with rattler via py-rattler. However, until then, the recent quite disruptive changes in mamba 2.0 (including CLI and unexpected behavior changes) suggest that it is more robust for us at the moment to move back to conda, and simply require a recent conda release, such that it is as fast as mamba.
QC
docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).Summary by CodeRabbit
New Features
mambatocondaacross various components, simplifying environment setup.Bug Fixes
Chores
mamba, and updated the testing environment configuration for better compatibility.conda.nodefaultschannel to configuration files for improved package management.