Skip to content

Conversation

sidhant007
Copy link
Contributor

@sidhant007 sidhant007 commented Jun 22, 2020

This PR closes #3781

Added a new CLI command named compare as specified in my proposal

This command reports about packages lacking in myenv requiredby.yml` and also identifies if there are version/build string mismatches.

The return status code of the command is 0 for success, i.e if all the packages mentioned in <file>.yml are present in the myenv and 1 otherwise.

Example to demonstrate the command:

Let the conda env dummy have the following packages installed:
(Ran conda list to print this)

#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main
astroid                   2.4.2                    py38_0
babel                     2.8.0                      py_0
blas                      1.0                         mkl
ca-certificates           2020.1.1                      0
certifi                   2020.4.5.2               py38_0
intel-openmp              2020.1                      217
lazy-object-proxy         1.4.3            py38h7b6447c_0
ld_impl_linux-64          2.33.1               h53a641e_7
libedit                   3.1.20191231         h7b6447c_0
libffi                    3.3                  he6710b0_1
libgcc-ng                 9.1.0                hdf63c60_0
libgfortran-ng            7.3.0                hdf63c60_0
libstdcxx-ng              9.1.0                hdf63c60_0
mkl                       2020.1                      217
mkl-service               2.3.0            py38he904b0f_0
mkl_fft                   1.1.0            py38h23d657b_0
mkl_random                1.1.1            py38h0573a6f_0
ncurses                   6.2                  he6710b0_1
numpy                     1.18.1           py38h4f9e942_0
numpy-base                1.18.1           py38hde5b4d6_1
openssl                   1.1.1g               h7b6447c_0
pip                       20.1.1                   py38_1
python                    3.8.3                hcff3b4d_0
pytz                      2020.1                     py_0
readline                  8.0                  h7b6447c_0
setuptools                47.3.0                   py38_0
six                       1.15.0                     py_0
sqlite                    3.32.2               h62c20be_0
tk                        8.6.10               hbc83047_0
wheel                     0.34.2                   py38_0
wrapt                     1.11.2           py38h7b6447c_0
xz                        5.2.5                h7b6447c_0
yaml                      0.1.7                had09818_2
zlib                      1.2.11               h7b6447c_3

And let the environment.yml be:

name: dummy2
channels:
  - defaults
dependencies:
  - pip=20.1.1=py38_1
  - babel>=1.4,<=5.6
  - yaml>=0.1.8,<=0.2
  - pip:
    - numpy
    - pandas

Then conda compare -n dummy environment.yml --json will print:

[
  "yaml found but mismatch. Specification pkg: yaml[version='>=0.1.8,<=0.2'], Running pkg: yaml==0.1.7=had09818_2",
  "pandas not found"
]

and returns with exit code 1.

And if we fix these issues (i.e pip install pandas and rectify yaml version), then it prints:

[
  "Success. All the packages in the specification file are present in the environment with matching version and build string."
]

and returns with exit code 0.

@sidhant007 sidhant007 requested a review from a team as a code owner June 22, 2020 11:08
@cla-bot
Copy link

cla-bot bot commented Jun 22, 2020

We require contributors to sign our Contributor License Agreement, and we don't have one on file for @sidhant007. In order for us to review and merge your code, please e-sign the PDF at https://conda.io/en/latest/contributing.html#conda-contributor-license-agreement. We then need to manually verify your signature. We will ping the bot to refresh the PR status when we have confirmed your signature.

@cla-bot
Copy link

cla-bot bot commented Jun 22, 2020

We require contributors to sign our Contributor License Agreement, and we don't have one on file for @sidhant007. In order for us to review and merge your code, please e-sign the PDF at https://conda.io/en/latest/contributing.html#conda-contributor-license-agreement. We then need to manually verify your signature. We will ping the bot to refresh the PR status when we have confirmed your signature.

@cla-bot
Copy link

cla-bot bot commented Jun 22, 2020

We require contributors to sign our Contributor License Agreement, and we don't have one on file for @sidhant007. In order for us to review and merge your code, please e-sign the PDF at https://conda.io/en/latest/contributing.html#conda-contributor-license-agreement. We then need to manually verify your signature. We will ping the bot to refresh the PR status when we have confirmed your signature.

@cla-bot
Copy link

cla-bot bot commented Jun 22, 2020

We require contributors to sign our Contributor License Agreement, and we don't have one on file for @sidhant007. In order for us to review and merge your code, please e-sign the PDF at https://conda.io/en/latest/contributing.html#conda-contributor-license-agreement. We then need to manually verify your signature. We will ping the bot to refresh the PR status when we have confirmed your signature.

@jjhelmus
Copy link
Contributor

@cla-bot check

@cla-bot cla-bot bot added the cla-signed [bot] added once the contributor has signed the CLA label Jun 24, 2020
@cla-bot
Copy link

cla-bot bot commented Jun 24, 2020

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Contributor

@mcg1969 mcg1969 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. It's significant enough I feel I should seek consensus here from other core team members, but I would find this useful

@cjmartian cjmartian self-requested a review July 15, 2020 17:00
@github-actions
Copy link

Hi there, thank you for your contribution to Conda!

This pull request has been automatically locked since it has not had recent activity after it was closed.

Please open a new issue or pull request if needed.

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 20, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH] Compare environments
4 participants