-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add / remove packages commands #112
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
==========================================
+ Coverage 97.75% 98.07% +0.31%
==========================================
Files 9 9
Lines 846 985 +139
==========================================
+ Hits 827 966 +139
Misses 19 19 ☔ View full report in Codecov by Sentry. |
Something to consider here: Right now running |
I notice that https://anaconda.org/pypi indicates that it is an index mirror of pypi perhaps we can allow pip packages to be added on the CLI with the prefix |
I've had the same thought. We should just dump a set of templated files at that point and skip the lock. Maybe there's a more general feature like "if there are no packages specified for any environments, skip the lock". I'm not sure why that would ever be the case after init but I suppose it is possible if you cleared out your environment files to "restart". |
Added a model for "channels:" to provide an ordered unique list. The add behavior matches the "conda install" experience: if you add a package that already exists with a different matchspec, that package gets replaced. See tests for more details.
this works by 1. write the updated environment source 1. lock the dependencies 1. if the lock fails replace environment source with previous content 1. if the lock solves run clean() then install() this means that installing packages will force a from-scratch relock and completely replace the live env. If the live env had and manually-installed packages they will not get re-installed.
same procedure as add
this supports the workflow of conda project init conda project add ... where the first command will not make a lockfile and even if dependencies are added in the init step, you must explicitly ask for the lockfile, which is generated on install anyway.
_update() is now private and it is preferred to user .add() and .remove()
only lock the current platform
e4284a8
to
49b0a12
Compare
Tests are failing for Conda versions 4.9 and 4.10 and I think we may just end up dropping support for those versions in conda-project. Here's how to reproduce. The problem appears to be limited to scenarios where these old versions of conda attempt to install environments with Python 3.10 or newer. It may be that the envs are created correctly, but
|
in both add/remove and init
I'm not sure that you can actually get a dependency added where the env yaml changes, but is still locked (meaning the file changed but the hash didnt')
The current implementation destroys the existing conda env and re-installs from the updated lock. Now that |
What does it do if there is a valid conda channel that overlaps with the prefix name? I think it is totally fine if the answer is "don't name channels pypi or r". |
Thanks, @bkreider . I can add a warning that If this is confusing do you think there might be a better way to express it for the CLI? I was trying to go for a single add/remove/init command to get both conda and pypi packages. |
The only thing i can think of to differentiate
Or just keep the current method and warn/document? |
I'll go with |
This PR provides interactive dependency management. One use case enabled here is to initialize an empty project and then add dependencies as needed. With each add/remove command the full dependencies are re-locked from scratch and the live environment is replaced with new locked dependencies.
Pip packages are specified with the prefix
@pip::
. The@pip::
prefix can also be used in theinit
command when the project is initialized.TODO: