packagedcode: add CondaEnvironmentYmlHandler to parse environment.yml - #4804
kumarasantosh wants to merge 1 commit into
Conversation
Add support for parsing Conda environment.yml files which contain environment name, channels, conda dependencies with versions and nested pip dependencies. Fixes aboutcode-org#3694 Signed-off-by: kumarasantosh <santosh.pulikond02@gmail.com>
|
The two failing checks (core_tests misc_and_scancode) look like My changes only touch conda.py, test_conda.py and the fixture files I would really appreciate your feedback on this if you have time! Thanks! |
There was a problem hiding this comment.
Closing this PR as the code is not usable at all as the functionality already exists to some extent and might need updating, not completely new code. Even without that, this code was not mergable.'
Please open a new PR if you have some usable code which improves functionality
| return result | ||
|
|
||
|
|
||
| class CondaEnvironmentYmlHandler(BaseDependencyFileHandler): |
There was a problem hiding this comment.
Have you actually looked at the code/run a scan on the test file to see this is not already detected somewhat?
See https://github.com/aboutcode-org/scancode-toolkit/blob/develop/src/packagedcode/conda.py#L357 where we already support this (but this needs enhancement of course)
Yes we should have updated/closed #3694 when this was added, but you should always do basic checks and read the code before writing code blindly.
| @@ -0,0 +1,63 @@ | |||
| import os | |||
There was a problem hiding this comment.
This is not how we run tests, see https://github.com/aboutcode-org/scancode-toolkit/blob/develop/tests/packagedcode/test_conda.py, where we have sample tests, and that is where the new tests will live.
| @@ -0,0 +1,9 @@ | |||
| name: testenv | |||
There was a problem hiding this comment.
You need to use real examples seen in the wild, not made up examples.
See examples already in https://github.com/aboutcode-org/scancode-toolkit/tree/develop/tests/packagedcode/data/conda/conda-yaml
Fixes #3694
Conda environment.yml files were not being parsed by ScanCode at all.
This PR adds CondaEnvironmentYmlHandler in conda.py to fix that.
The handler picks up *environment.yml files and pulls out the
environment name, channels and conda dependencies with their versions.
It also handles the pip section inside dependencies and marks those
packages correctly as pypi type. Channels go into extra_data.
Tested with a real fixture from the multiregex project and a simple
hand-crafted one to cover edge cases like missing name or empty
dependencies.
Tasks