Skip to content
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

conda: use an environment file #447

Closed
henryiii opened this issue Jun 10, 2021 · 3 comments
Closed

conda: use an environment file #447

henryiii opened this issue Jun 10, 2021 · 3 comments

Comments

@henryiii
Copy link
Collaborator

henryiii commented Jun 10, 2021

How would this feature be useful?
Many projects define dependencies in an environment file. You can list channels, etc. in such a file. For example:

name: myenv
channels:
  - conda-forge
dependencies:
  - python==3.9
  - pip >=18
  - pytest >=5
  - pip:
    - -e .

More realistic example here: https://gitlab.cern.ch/LHCb-Reco-Dev/pv-finder/-/blob/master/environment.yml

I don't see a way to specify this with conda_install, since it's a different command used when making the environment (and it can set a Python version for the conda environment).

Describe the solution you'd like

Open for ideas. It seems rather like it should be part of the session decorator? But not sure how it might tie in. One possible idea would be to pick up environment.yml if it exists (conda env create will pick it up that name automatically), but there should be a way to configure it (-f environement2-yml, etc) or ignore an environement.yml if one exists)?

Currently I want to set up an environment for nox, but in GHA, I'd like to use https://github.com/conda-incubator/setup-miniconda - so this would let me share the (non-trivial) environment between nox, GHA, and mybinder (which automatically loads an environment.yml file).

@henryiii henryiii changed the title conda: use an environment conda: use an environment file Jun 10, 2021
@henryiii
Copy link
Collaborator Author

FYI, it's not as "nice", but you can use conda update to inject an environment into the current environment; this is how mybinder was implemented, IIRC. You can't keep the environment name this way, which can be affect running notebook kernels.

@henryiii
Copy link
Collaborator Author

Oops, dup of #260

@cjolowicz
Copy link
Collaborator

Thanks @henryiii , closing as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants