Skip to content

packagedcode: add CondaEnvironmentYmlHandler to parse environment.yml#4804

Open
kumarasantosh wants to merge 1 commit intoaboutcode-org:developfrom
kumarasantosh:feature/conda-environment-yml
Open

packagedcode: add CondaEnvironmentYmlHandler to parse environment.yml#4804
kumarasantosh wants to merge 1 commit intoaboutcode-org:developfrom
kumarasantosh:feature/conda-environment-yml

Conversation

@kumarasantosh
Copy link

@kumarasantosh kumarasantosh commented Mar 10, 2026

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

  • Reviewed contribution guidelines
  • PR is descriptively titled and links the original issue above
  • Tests pass
  • Commits are in uniquely-named feature branch and has no merge conflicts

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>
@kumarasantosh
Copy link
Author

@pombredanne @AnotherDaniel

The two failing checks (core_tests misc_and_scancode) look like
a pre-existing issue — #4732 is failing with the same thing.

My changes only touch conda.py, test_conda.py and the fixture files
so shouldn't be related.

I would really appreciate your feedback on this if you have time!

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Conda environment.yml

1 participant