diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b4a69307..51cadb9c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -48,15 +48,13 @@ jobs: cache-downloads-key: downloads-${{ needs.date.outputs.date }} cache-environment: true cache-environment-key: environment-${{ needs.date.outputs.date }} + micromamba-version: '2.0.4' init-shell: bash generate-run-shell: false - run: echo "filename=stenv-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ needs.date.outputs.date }}.yaml" >> $GITHUB_OUTPUT id: output - run: | micromamba env export --no-build | grep -v "name:" | grep -v "prefix:" > ${{ steps.output.outputs.filename }} - pip freeze > pip_requirements.txt - python tools/mamba_export_pip.py ${{ steps.output.outputs.filename }} pip_requirements.txt > mamba_packages.yml - mv mamba_packages.yml ${{ steps.output.outputs.filename }} cat ${{ steps.output.outputs.filename }} - run: pip install pytest - run: pytest tests/test_import.py diff --git a/tools/mamba_export_pip.py b/tools/mamba_export_pip.py deleted file mode 100644 index 8aed1f3e..00000000 --- a/tools/mamba_export_pip.py +++ /dev/null @@ -1,34 +0,0 @@ -import argparse -import yaml -from pathlib import Path - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - prog="mamba_export_pip", - description="appends the output of `pip freeze` to the end of an existing Mamba YAML exported with `mamba env export`, in the corresponding `pip` section", - epilog="this script replicates the functionality of https://github.com/mamba-org/mamba/pull/2104, and will be obsolete when it is merged", - ) - - parser.add_argument("mamba_export_filename") - parser.add_argument("pip_freeze_filename") - - arguments = parser.parse_args() - - mamba_export_filename = Path(arguments.mamba_export_filename) - pip_freeze_filename = Path(arguments.pip_freeze_filename) - - with open(mamba_export_filename) as mamba_export_file: - mamba_export = yaml.safe_load(mamba_export_file) - - with open(pip_freeze_filename) as pip_freeze_file: - pip_freeze = pip_freeze_file.readlines() - - pip_freeze = [ - requirement.strip() - for requirement in pip_freeze - if " @ file" not in requirement - ] - - mamba_export["dependencies"].append({"pip": pip_freeze}) - - print(yaml.dump(mamba_export))