Skip to content

Commit

Permalink
Bulk sort environment yamls (#7372)
Browse files Browse the repository at this point in the history
* fix: Remove second conda-env-sorter

* style: Run ruff

* style: Bulk update sort

In theory should:
- Sort dependencies
- Add yaml schema
- Remove quotes
  • Loading branch information
edmundmiller authored Feb 4, 2025
1 parent 70802aa commit 8188078
Show file tree
Hide file tree
Showing 1,304 changed files with 2,422 additions and 406 deletions.
37 changes: 16 additions & 21 deletions .github/scripts/conda_env_sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
# uv run --with pytest -- pytest -v .github/scripts/conda_env_sorter.py

import argparse
import sys
from pathlib import Path
from typing import Optional, Sequence

import ruamel.yaml
import sys

# Add pytest imports conditionally
if 'pytest' in sys.modules:
if "pytest" in sys.modules:
import pytest
from tempfile import NamedTemporaryFile

yaml = ruamel.yaml.YAML()
yaml.indent(mapping=2, sequence=2, offset=2) # Set indentation to 2 spaces
Expand Down Expand Up @@ -79,24 +79,19 @@ def main(argv: Optional[Sequence[str]] = None) -> None:
main()

# Pytest tests (only loaded when running pytest)
if 'pytest' in sys.modules:
@pytest.mark.parametrize("input_content,expected", [
# Test basic sorting
(
"dependencies:\n - zlib\n - python\n",
["python", "zlib"]
),
# Test dict sorting
(
"dependencies:\n - pip:\n - b\n - a\n - python\n",
["python", {"pip": ["a", "b"]}]
),
# Test existing headers
(
"---\n# yaml-language-server: $schema=...\ndependencies:\n - b\n - a\n",
["a", "b"]
)
])
if "pytest" in sys.modules:

@pytest.mark.parametrize(
"input_content,expected",
[
# Test basic sorting
("dependencies:\n - zlib\n - python\n", ["python", "zlib"]),
# Test dict sorting
("dependencies:\n - pip:\n - b\n - a\n - python\n", ["python", {"pip": ["a", "b"]}]),
# Test existing headers
("---\n# yaml-language-server: $schema=...\ndependencies:\n - b\n - a\n", ["a", "b"]),
],
)
def test_conda_sorter(tmp_path, input_content, expected):
test_file = tmp_path / "environment.yml"
test_file.write_text(input_content)
Expand Down
9 changes: 0 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ repos:
args: ["--schemafile", "subworkflows/yaml-schema.json"]
- id: check-github-workflows
- id: check-github-actions
- repo: local
hooks:
- id: conda-env-sorter
name: Sort dependencies in conda environment files.
entry: ./.github/scripts/conda_env_sorter.py
language: python
files: environment
types: [yaml]
additional_dependencies: ["ruamel.yaml"]
# use ruff for python files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/abacas/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/abricate/run/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/abricate/summary/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/abritamr/run/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/adapterremoval/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/adapterremovalfixprefix/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/admixture/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/affy/justrma/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/agat/convertbed2gff/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::agat=1.4.2"
- bioconda::agat=1.4.2
2 changes: 2 additions & 0 deletions modules/nf-core/agat/convertspgff2gtf/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/agat/convertspgff2tsv/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/agat/convertspgxf2gxf/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
4 changes: 3 additions & 1 deletion modules/nf-core/agat/spaddintrons/environment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::agat=1.4.2"
- bioconda::agat=1.4.2
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::agat=1.4.2"
- bioconda::agat=1.4.2
2 changes: 1 addition & 1 deletion modules/nf-core/agat/spmergeannotations/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::agat=1.4.2"
- bioconda::agat=1.4.2
2 changes: 2 additions & 0 deletions modules/nf-core/agat/spstatistics/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/agat/sqstatbasic/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/agrvate/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/ale/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ channels:
- tanghaibao
dependencies:
# renovate: datasource=conda depName=bioconda/ale
- "bioconda::ale=20180904"
- bioconda::ale=20180904
2 changes: 2 additions & 0 deletions modules/nf-core/allelecounter/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/ampcombi/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/ampcombi2/cluster/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::ampcombi=2.0.1"
- bioconda::ampcombi=2.0.1
2 changes: 1 addition & 1 deletion modules/nf-core/ampcombi2/complete/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::ampcombi=2.0.1"
- bioconda::ampcombi=2.0.1
2 changes: 1 addition & 1 deletion modules/nf-core/ampcombi2/parsetables/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::ampcombi=2.0.1"
- bioconda::ampcombi=2.0.1
2 changes: 2 additions & 0 deletions modules/nf-core/ampir/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/amplify/predict/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/amps/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/amrfinderplus/run/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/amrfinderplus/update/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/angsd/contamination/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/angsd/docounts/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
4 changes: 2 additions & 2 deletions modules/nf-core/angsd/gl/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::angsd=0.940"
- "bioconda::htslib=1.17"
- bioconda::angsd=0.940
- bioconda::htslib=1.17
2 changes: 2 additions & 0 deletions modules/nf-core/anndata/barcodes/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/anndata/getsize/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/annotsv/annotsv/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/annotsv/installannotations/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/anota2seq/anota2seqrun/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::bioconductor-anota2seq=1.24.0"
- bioconda::bioconductor-anota2seq=1.24.0
2 changes: 2 additions & 0 deletions modules/nf-core/antismash/antismashlite/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/arcashla/extract/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
4 changes: 3 additions & 1 deletion modules/nf-core/argnorm/environment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::argnorm=0.5.0"
- bioconda::argnorm=0.5.0
2 changes: 2 additions & 0 deletions modules/nf-core/aria2/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/ariba/getref/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/ariba/run/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/arriba/download/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/art/illumina/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/artic/guppyplex/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/artic/minion/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/ascat/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/ashlar/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/assemblyscan/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/ataqv/ataqv/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-core/ataqv/mkarv/environment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
Expand Down
Loading

0 comments on commit 8188078

Please sign in to comment.