-
Notifications
You must be signed in to change notification settings - Fork 89
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
[WIP] Utilize environment.yml or requirements.txt directly #275
Conversation
Can you also support the case where there is an anaconda-project.yml file, but it doesn't describe the environment, only the commands? That way people could ship an environment.yml file to describe the environment for both conda and anaconda-project, but still be able to specify the commands to execute in that environment. |
I believe that works since I've seen a hash in the anaconda-project.yml when using environment.yml. I'll look into that. |
I've also got an issue to "rebuild" the anaconda-project.yml file from a live environment, which is tangentially related to this. Also, the |
@jbednar , yes you can use the anaconda-projec.yml file solely for commands and leave packages in the environment.yml or requirements.txt files. I just need to push another commit turn off some prompts since it asks you to confirm including the packages defined in these auxiliary files before it runs. |
Great! |
Fixed. You can provide an environment.ymlname: envYaml
dependencies:
- python=3.7
- requests
- pip:
- rope
- tranquilizer
- werkzeug==0.16
channels:
- defaults
- conda-forge anaconda-project.ymlname: envyaml
commands:
api:
unix: tranquilizer cheese_shop.py {{'--port %s' % port if port is defined }}
supports_http_options: false runAs expected
|
This is great! I've been testing the 0.8.4+88 package with the workflows you describe above and here are my observations so far:
|
Thanks!
|
Good point about If the Maybe you would only be able to point to auxiliary environments specified in the |
I don't like having the name required to match. I think the project name should come from the project file, while the environment need not have a name and if it does need not match. Shouldn't I be able to make 20 projects where 10 of them point to ../env1.yml and the other 10 point to ../env2.yml, so that I can maintain environments independently of choosing to use them in a particular project? |
An anaconda-project.yml file is no longer required. * If environment.yml or environment.yaml file exists Create the env as envs/{name} where name comes from the file. This works for pip entries, too. * If requirements.txt file exists Create the env as env/default with the latest version of python. Add packages from requirements.txt as pip installs
the --python=x.x flag will ensure that the base conda environment has your requested version of python before running pip installs * also stop anaconda-project run from writing the file to disk
* also list pip packages with list-packages command
d57fb1f
to
63b77e2
Compare
Closing this to continue the effort at #363. All comments here will be considered. |
Marked as WIP to solicit feedback on the workflow. TODO:
This PR implements a minor change which enables the use of
environment.yml
orrequirements.txt
files directly without the need to create ananaconda-project.yml
(nor will the file be created for you).Enabled use cases
anaconda-project prepare
anaconda-project run <executable> [<arg1>, <arg2>, ...]
Note The run command can execute any executable in the environment and pass arguments to it. Commands need not be specified in an
anaconda-project.yml
file to be able to run.In the two use cases shown below there is no
anaconda-project.yml
file and it will not be created with the commands shown. For both cases you can useanaconda-project prepare
to create the file and import the required packages from eitherenvironmnent.yml
orrequirements.txt
.environment.yml
Here's a typical environment specification file.
Create the environment at
envs/envYaml
where the name of the environment comes from thename:
key.There are no commands
But, we can still run something
Finally, after adding packages to the the
environment.yml
file they can be installed. (use the--refresh
to completely rebuild the env, prepare will not remove packages)requirements.txt
If there is a
requirements.txt
in the project directory (and noenvironment.yml
) all packages listed will be installed as pip packages.Running the prepare will first create a Conda environment with the most recent version of Python (3.8) and pip and then add the packages in the
requirements.txt
file.And confirm the pip packages were installed
If you require a different version of Python it can be supplied during prepare
Again, you can run any executable in the environment
Again, you can add packages to
requirements.txt
and install them with prepare